How to Change JPEG Compression in WordPress

Have you ever uploaded an image to WordPress and wondered why it looks pixelated on the front-end?

WordPress automatically compresses JPEG images to 90% of their original size, which can be helpful in terms of improving performance and page speed, but it also means your images don’t look their best.

If you miss that extra 10% and would rather control image compression on your site, or you want to more aggressive in compressing JPEG files, I’ll show you how to do both in this Weekend WordPress Project.

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 add the functionality to your site in a plugin:

This snippet will completely disable JPEG compression on your site.

How to Increase JPEG File Compression

Compressing your images more than 90% will make your file sizes smaller and could boost your site’s speed and performance.

With a compression rate of 80% or 85%, you may not even notice the difference.

The important thing to remember is that the more you decrease the percentage, the more your images will be compressed.

Any changes you make now will only affect new images uploaded to your site and not existing images in your media gallery. WordPress will not automatically resize all your old images.

If you want to compress existing images on your site, you may want to check out our WP Smush Pro plugin, which lets you bulk compress images in your media gallery.

You may also want to use Regenerate Thumbnails, a free, handy plugins that will quickly go through all of your thumbnails and perform the changes for you.

Do you prefer optimized images or full quality images? Let us know what you think in the comments below.