How to Stop WordPress Compressing JPG Images

This post may contain affiliate links. If you purchase something through one of those links then we'll get a small commission.

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!

Pixelated image of Homer Simpson
Pixelated image of Homer Simpson

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. I'll also explain how to bypass the image compression feature without editing a file or installing a plugin.

See also: Useful Code Snippets for Your WordPress Functions File

Disable image compression using the functions file

1. Open your FTP client (I use FileZilla) and enter your FTP host, username, password and port number.

FileZilla login form
FileZilla login form

2. Once you've entered your FTP account details, click "Quick Connect" to connect to your website.

FileZilla quick connect button
FileZilla quick connect button

3. Next, use your FTP client to navigate to the folder where your theme's files are located. This is usually public_html/wp-content/themes/[your-theme]/.

WordPress theme folder
WordPress theme folder

4. Then right-click your theme's functions.php file and click "Download" to download it to your computer.

Download the WordPress functions file
Download the WordPress functions file

5. Once the file has downloaded, open it with a text editor (I use the excellent Sublime Text) and insert the code snippet below. Don't forget to save the file to your computer once you've added the snippet.

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

6. Finally, open your FTP client again and browse to your theme folder. Find the modified functions file on your computer, right-click it and click "Upload" to upload it to your website, overwriting the existing functions.php file.

Upload the WordPress functions file
Upload the WordPress functions file

Disable WordPress image compression using a 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.

'Add New Plugins' page
'Add New Plugins' page

2. Then in the search box, enter "SMNTCS".

Search for 'SMNTCS Deactivate Image Compression'
Search for 'SMNTCS Deactivate Image Compression'

3. Once you've found the plugin, click "Install Now". The plugin will then be downloaded to your WordPress plugins folder.

Install SMNTCS Deactivate Image Compression
Install SMNTCS Deactivate Image Compression

4. Finally, click the "Activate" button to enable the plugin and disable WordPress' image compression feature.

Activate SMNTCS Deactivate Image Compression
Activate SMNTCS Deactivate Image Compression

Upload PNG images instead

If you don't want to edit your functions file and you don't want to add another plugin, there's one option available to you: upload PNG images instead.

There's nothing in the WordPress core to handle PNG image compression, so uploading PNGs is without doubt the quickest and easiest way to prevent WordPress from compressing your image files. But that doesn't mean it's the best solution.

PNG is a lossless file format and is a good choice for illustrations, line drawings and iconic graphics. Unfortunately, the same can't be said for photographs.

If you try saving you photos as PNGs, you'll notice that the file size is much larger than their equivalent JPG versions. That's because JPG images contain less data than PNG ones.

Image size matters on the web. If you want your visitors to stick around and buy your products or services, you'd better make sure your web pages load quickly. And pages with massive images tend not to load very quickly.

To sum it up: JPGs are for photographs and realistic images; PNGs are for illustrations, line art and text-heavy images.

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.

Rob Carter
Rob Carter

Rob Carter is a digital marketing expert with a genuine passion for helping businesses thrive online. Rob has been building websites and crafting marketing campaigns for over 20 years, and his creativity and analytical ability are highly sought after by businesses and non-profits around the world.

Articles: 67

4 Comments

    • I’m not sure I follow.

      Are you saying that your PNG images are being converted into JPG images? If so, it won’t be WordPress that’s doing it.

      If you have an image compression plugin installed on your site, that’s the first thing you need to check. Many of them have an option to convert PNG images into JPGs when they’re uploaded, as JPGs are usually smaller.

  1. My problem isn’t so much the compression as the conversion to webp. My lightbox doesn’t work with webp so I want to retain the jpg format. Do these methods stop the conversion too?

    • Neither of the methods outlined above will change the format of your images. If you upload JPGs, they’ll remain as JPGs on your server.

Leave a Reply

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