0

Different image weights were generated in different servers when Uploading images to Media.

For instance, an original image of 2.1Mb uploaded to a server generated a 700Kb image, for the medium size, which is too big. The same image uploaded to my local server, generated a 70Kb image for the medium size, which looks horrible.

Does anyone know what it may be due to? What parameters affect the image compression rate?

1

This depends on two things

  • the image library WP uses
  • the settings of your WP install

Image Library: ImageMagick vs GD

Since WP 3.5 ImageMagick is the default, but if this isn't available WP will fall back to GD.

ImageMagick generally does have better quality which is why it is preferred.

Settings

There are some filter to change the quality WP uses to resize images, the main one being this one:

add_filter( 'wp_editor_set_quality', 'wpse_176452_custom_image_quality' );
function wpse_176452_custom_image_quality( $quality ) {
    return 96;
}

More details can be found at the announcement I linked to above.


So you need to check if your install differs in any of those factors.

  • OK, this explains it. Probably ImageMaginck is not available in my local install. Thanks! There is another point we have noticed, and this is that images should be first optimized in photoshop or equivalent as saved for web, otherwise compression rate in wordpress is not as effective. We think this could be related to metadata associated with the file. – Marc Jan 30 '15 at 8:48

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.