Paul Underwood
PaulundSoftware Engineer

Stop Wordpress Compressing JPEG Images

Whenever you upload an image to Wordpress media library it will automatically compress your images to 90% quality, this is to size a bit of bandwidth on displaying images on your web page. But if your a photographer and you want to always have the highest quality images on your site then you can change the default compression to 100% quality. All you have to add the following to your functions.php file, this will run when compressing your images and return the value of the quality you want.

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