My original images are 420x500/840x1000 and the file size varies around 15-30kb per image. Though when resized by wordpress/woocommerce into a thumb to 340x340(crop) the image size gets to 50kb+. The resizing happends automatically by Wordpress/woocommerce.

Link to website - I'm using XING, a theme from Themeforest.

The image sizes has been changed in Woocommerce "Image Alternatives" to crop and 340x340px.

function gpp_jpeg_quality_callback($arg)
return (int)100;

add_filter('jpeg_quality', 'gpp_jpeg_quality_callback');

Found this code in Functions.php though. Is this the issue?

  • 1
    Please show us how and where you registered the themes/plugins image sizes. No chance to help you without seeing actual code in an edit. If you didn't code it yourself, you'll have to come up with your plugins source code. – kaiser Mar 4 '14 at 11:15

What you need to do is to compress the image. Wordpress offers a filter to set the compression ratio.

function my_jpg_compression($args) {
    return 75;
add_filter('jpeg_quality', 'my_jpg_compression');

NOTE: What you are returning is the compression ratio. 70-80% is manageable and you will not notice much reduced image quality. Also, after applying this filter only future image's size can be reduced and not the one which are already uploaded.

What for already uploaded images?

You can use some awesome plugins to reduce image size and still keeping manageable quality. One of such a plugin is WP SmushIt. In fact you can use this plugin for future uploaded images too.

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.