As I am about to add over 50,000 product photos to a site in development, I am more than concerned about the thumbnails being generated and “optimized” by WordPress. Between WordPress, Woocommerce, and my theme, 11 additional thumbnail images were being created from each original. I am figuring out with ones are necessary, but have not figured out how to adjust the “optimization”.

My image files are fairly simple, line art 8-bit PNG (<256 colors) files that are already optimized from Adobe Illustrator. The screen shot below shows two images, “AAA.png” and “AAAE.png” that are both 1200 x 1200 px. You can see that the closest thumbnails (in size) created are over 4X and 5X the size of the original.

enter image description here

I have tried adjusting the “optimization” with these two code snippets added to my functions.php file:

add_filter(‘jpeg_quality’, function($arg){return 100;});
add_filter(‘wp_editor_set_quality’, function($arg){return 100;} );

I tried the above, and I also tried:

add_filter(‘jpeg_quality’, function($arg){return 60;});
add_filter(‘wp_editor_set_quality’, function($arg){return 60;} );


add_filter(‘jpeg_quality’, function($arg){return 40;});
add_filter(‘wp_editor_set_quality’, function($arg){return 40;} );

These made little to no difference in the file sizes. I’m guessing the WordPress optimization settings, which uses ImageMagick to resize and optimize images, are targeting JPG and 24-bit PNG (those usually guilty of large file size), but how can I tweak it for my already optimized 8-bit PNGs? Perhaps the WordPress Imagemagick code is converting my 8-bit PNGs to 24-bit PNGs (or JPGs) before optimizing and resizing them?

My 50,000 1200 x 1200 px PNG files add up to about 2.5 GB of images. (I do plan to serve those as even smaller Webps, with the PNGs as fallbacks). With WordPress automatic thumbnails and “optimizations”, those files would jump to 53.75 GB!

Solutions welcome.

1 Answer 1


Rather than messing with it yourself, this is a great scenario in which to consider offloading it to a third party (and also using modern formats like WebP). Something like PicPerf.io or other optimization plugins out there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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