How to Stop WordPress Compressing JPG Images

Disclaimer: This post may contain affiliate links. If you purchase something through one of those links you won’t pay a penny more, but we’ll get a small commission.

Problems with pixelated photos?

Do you find that WordPress image optimisation plugins compress your JPG images too much, resulting in pixelated, poor-quality photos?

If this is happening to you, it’s probably because your images are being compressed twice!

What many people don’t realise is that WordPress automatically compresses uploaded JPG images by up to 90%. If these images are further compressed with an image optimisation plugin like ShortPixel or WP Smush, the drop in image quality is often noticeable.

You could just disable your image compression plugin, but a dedicated plugin usually offers more control and delivers much better results than WordPress’ native compression function, so it’s not recommended.

There are two ways to turn off WordPress’ built-in image compression feature: by editing the functions.php file or by using a plugin.

In this article I’ll show you how to stop WordPress compressing JPG images using the two methods mentioned above.

Stop!

Before proceeding any further, do yourself a favour and make a backup of your site. It’s much better to have pixelated images than a broken website.

Disable WordPress’ image compression feature

Functions file

FTP instructions

1. Connect to your website using an FTP client like FileZilla.

2. Next, use your FTP client to navigate to the folder where your theme’s files are located. This is usually “/wp-content/themes/[your-theme]/”.

3. Then select your theme’s functions.php file and download it to your computer.

Read
100 Ways to Repurpose Your Content - Part 1

4. Once the file has downloaded, open it with a text editor (I use the excellent Sublime Text) and insert the following code snippet:

// Disable WordPress image compression
add_filter( 'jpeg_quality', function( $arg ) {
    return 100;
});

5. Finally, save the file and use your FTP client to upload it to your website, overwriting the existing functions.php file.

WordPress editor instructions

1. Log into your WordPress dashboard and go to Appearance > Theme Editor.

2. Next, make sure your current theme is selected in the theme selection drop-down and click on the functions.php file.

3. Once the file has loaded in the editor, insert the following code snippet:

// Disable WordPress image compression
add_filter( 'jpeg_quality', function( $arg ) {
    return 100;
});

4. Click on the “Update File” button at the bottom of the editor screen to apply your changes.

Plugin

The SMNTCS Deactivate Image Compression plugin is the quickest and easiest way to disable the built-in image compression feature in WordPress.

Installing a plugin in order to accomplish such a simple task is a bit overkill, but for people who don’t feel comfortable editing files directly it’s the preferred option.

The instructions for installing SMNTCS Deactivate Image Compression are the same as for any plugin in the official WordPress repository:

1. Log into your WordPress dashboard and go to Plugins > Add New.

2. Then in the search box, enter “SMNTCS”.

3. Once you’ve found the plugin, click “Install”. The plugin will then be downloaded and installed.

4. Finally, click the “Activate” button to enable the plugin and disable WordPress’ image compression feature.

Read
Useful Tricks for Your WordPress Functions File

Small (and beautiful) images

That’s all there is to it! From now on, any JPG images you upload to your website won’t be automatically compressed by WordPress.

This will enable you to compress your images using your preferred plugin without them looking like they were taken on a mobile phone from 2005.

Small images that load quickly and still look beautiful – and all for just a few minutes’ work!

If you’ve got any other image optimisation tips and tricks you want to share, please let us know in the comments below.

Take the next step

Subscribe to our newsletter, where we share actionable advice for building your brand and growing your online business.

Share on facebook
Facebook
Share on twitter
Twitter
Share on linkedin
LinkedIn

1 Response

  1. Outstanding post Rob. Well done and thanks for sharing. Gave me something to think about. Because I do have an image compression plugin. And never thought much of WordPress image compression. Thanks for the advice…

Leave a Reply

Your email address will not be published. Required fields are marked *

Wait, don't leave empty-handed!

Subscribe to our newsletter and get actionable advice on how to grow your business sent straight to your inbox.

Newsletter

Sign up, strap yourself in and get ready to build your brand.