How To Stop WordPress From Compressing JPEG Images

WordPress automatically compress all your re-sized JPEG images to the 90% of original quality, which is something that you’d like to stop in your site. The original uploaded image is saved unaltered, as the “full” size.

This saves a lot of space in your hosting, but most of us have unlimited hosting accounts, so why should we worry about the image size? You can stop WordPress from compressing JPEG images by putting following code into your functions.php file:

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

Leave a Reply

Your email address will not be published. Required fields are marked *