Support » Fixing WordPress » WebP images are increasing in file size on upload

  • Hi I am creating a number of image sizes for picture uploads in my functions.php with:

    add_image_size( 'cropped', 338, 241, true);
    add_image_size( 'cropped_xs', 478, 340, true);
    add_image_size( 'cropped_sm', 676, 482, true);
    add_image_size( 'cropped_md', 856, 610, true);
    add_image_size( 'cropped_lg', 1081, 699, true);
    add_image_size( 'cropped_xl', 1403, 921, true);

    When I check the WebP files after upload I notice that a lot of the pictures are much bigger in file size.

    For instance I uploaded a picture that was 1403px wide x 1000px tall and it was 83kb in size. The last 3 image sizes in the above list (cropped_md, cropped_lg, cropped_xl) produced file sizes of 84kb, 119kb and 142kb respectively.

    Does anyone know what I can put in my functions.php to stop WordPress increasing the files size like this please?


    • This topic was modified 1 year, 10 months ago by cannon303.
    • This topic was modified 1 year, 10 months ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Developing with WordPress topic
Viewing 4 replies - 1 through 4 (of 4 total)
  • You could check to see if the file type has changed. The add_image_size creates a new image maybe it using a different format for the new image.

    I tried it with several images and the size increased on images whose size was close to the original. I don’t think they’re is much you can do add_image_size is a core function. There are some plugins in the plugin directory that will optimize your images. You might want to look at one of them.

    Thread Starter cannon303


    Thanks for your help @mrtom414. That’s pretty poor from WordPress. I’m trying to create a super optimised site and it means I’m going to have to manually create all of the images sizes myself. Unless of course there is indeed a plugin to the rescue….

    Moderator Steven Stern (sterndata)


    Volunteer Forum Moderator

    WordPress uses gd or imagemagick to resize images, so whatever’s happening is in those utilities or the PHP libraries used to interface with them.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘WebP images are increasing in file size on upload’ is closed to new replies.