WordPress

Stop WordPress Compressing JPEG Images

Compress

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;} );
Back to top ^

Join Paulund

  • Access 100s of premium tutorials and downloadable content
  • Members content consists of premium WordPress plugins, CSS packages, jQuery packages, tutorial demo files and templates for 100s of web development tutorials
  • In-depth development tutorials
  • Priority tutorial requests
  • No ads

Join Paulund