Prevent WordPress to compress your JPG images for better quality

WordPress compress all your uploaded jpeg images by default to 90% of their original quality. While this is done in order to save your hosting bandwidth sometimes it doesn’t work that well because sometimes the quality of the image is very low.

If you publish a lot of images, screenshot, infographic, always save your images as png format. If you want to use JPG images, you can add twp lines of code in functions.php file to force WordPress to serve high-quality JPG images.

You can optimize PNG images with to reduce size without losing quality. It is a free service.

Add the following code in functions.php file

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

You May Also Like

Leave a Reply

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