0

I have an image with file size 93.8 KB (1900x940), and there is an image size in the theme:

add_image_size('my-image-size', 1402, 920, true)

After uploading the image, I found the cropped image has the file size 173 KB (1402x920)

This is almost double size of the original image, is it normal?

2
  • You could change the wordpress jpeg compression, or you could have more control over the different image sizes with a plugin like this.
    – D. Dan
    May 18 '18 at 6:41
  • This can happen, as the implemented cropping/resizing methods are very basic. (I can't find any resources about it now but remember having read about it a couple of times, be it PHP or WordPress.) Either use a plugin that you have tested or do the resize/crop yourself and upload the image then
    – kero
    May 18 '18 at 7:07
1

Yes, this is normal, given how ImageMagick, the PHP image editor WP uses by default, resizes images. Actually, it first expands the image and then scales it back again, sticking to its own resizing quality settings, not the one of the source image.

So, if you have a low quality image (say, 93.8 kb at 1900x400px) and the settings stipulate a high quality, you will get a lower compression rate on the resulting image. This won't make blurry pictures sharp, of course, but it will lead to a file size that is relatively higher compared to pixel sizes.

If this bugs you, you can lower the compression grade using the functions made available in the wp_image_editor class. Two filters provide shortcuts you can include in your functions.php file:

add_filter ('jpeg_quality', $quality); // for jpeg images
add_filter ('wp_editor_set_quality', $quality) // for other mime types

Where $quality is an integer with values between 0 and 100.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.