Customize the JPEG Image Compression in WordPress

When you upload an JPEG image to WordPress, it compresses that image to improve performance when the site is being downloaded.  The default level of compression is 10% – that is to say the filesize is reduced to 90% of the original.

If your site and it’s message depends upon it’s imagery, or your target audience is sure to have a fast connection, you may feel that this level of image compression is too high.  Similarly, if your website’s imagery is not critical to the it’s purpose, you might like to increase the compression to maximise website performance.

To remove image compression in WordPress, add the following line of code to your theme’s functions.php file:

add_filter(‘jpeg_quality’, function($arg){return 100;});

To increase the level of image compression in WordPress, add the following line of code to your theme’s functions.php file instead:

add_filter(‘jpeg_quality’, function($arg){return 60;});

I have selected ’60′, but try a few different settings from 1-100, using Alex Mills’ Regenerate Thumbnails plugin to update your site after each change.

"a great communicator with an easy going yet professional and articulate manner"

Denise Ross
UX Designer Barclays Bank PLC

Think we may be able to help you? Why not start a conversation - chances are, you'll go away with some new ideas and knowledge.