How to stop compressing JPEG Files

If you want WordPress to stop automatically compressing image, you need to tell it to load these files at 100% quality.

Add the following snippet to your theme€™s functions.php file, or search the string add_filter through theme files and add to a proper location:

add_filter( ‚jpeg_quality‘, create_function( „, ‚return 100;“ ) );

This snippet will completely disable JPEG compression on your site in future, so for already uploaded you will need to run regenerate thumbnails plugin.

After a while, I saw that:
PHP Warning:  create_function() expects exactly 2 parameters, 1 given in /var/www/userland/it/wp-content/themes/clean-retina/library/functions/functions.php on line 136, referer:
And further searchings lead to that snippet:

add_filter( ‚jpeg_quality‘, ‚jpeg_full_quality‘ );
function jpeg_full_quality( $quality ) { return 100; }