Preventing Automatic Image Compression in WordPress

Have you ever uploaded a sharp, gorgeous image to your WordPress site only to find it looks fuzzy or not as crisp as expected? That’s because WordPress sometimes compresses your images automatically. While this can be helpful for speed, it’s not great when you want pro-level visuals. In today’s guide, we’ll uncover how to stop WordPress from compressing your images and keep them looking sharp and stunning!

TLDR (Too long, didn’t read):

  • WordPress compresses images automatically to save space and load faster.
  • If you want full-quality visuals, you can disable or reduce this compression.
  • There are different ways to do it—using code, plugins, or theme settings.
  • With a few tweaks, your images will stay as beautiful as you made them!

Why Does WordPress Compress My Images?

WordPress is designed for performance and speed. So, by default, it compresses JPEG images to about 82% of their original quality. That can help your site load a little faster, especially on mobile. But, if you’re a photographer, designer, or just a stickler for detail, that’s not ideal.

This compression only affects JPEGs. PNGs, SVGs, and GIFs are generally not compressed the same way. But, most photos are JPEGs—so you’ll probably feel the difference.

So what can you do about it?

Option 1: Stop Image Compression With a Simple Code Snippet

This is the quickest, cleanest solution if you’re comfortable adding a little code.

Add this to your functions.php file in your theme, or via a site-specific plugin:


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

What it does: This tells WordPress to set the JPEG image quality to 100% instead of 82%. Easy!

What to keep in mind: This only affects new uploads. Your old images will stay compressed unless you regenerate them.

Option 2: Use a Plugin to Override Compression

Not everyone loves editing code. And that’s totally okay!

There are plugins that can help you control image compression, without touching a single line of PHP.

Two good plugin options are:

  • Imsanity – Limits image size but allows quality tweaks.
  • Disable JPEG Compression – As the name suggests, it disables default compression entirely.

Just search for them in your WordPress dashboard, install, and follow the simple settings to keep that full resolution goodness.

Option 3: Manually Upload Images Outside the Media Library

If you’re feeling adventurous, there’s a way to bypass the compression altogether — don’t use WordPress’s built-in media uploader.

Instead, upload your images by FTP or your hosting file manager and then reference them manually in your content using HTML:


<img src="https://yourdomain.com/wp-content/uploads/image.jpg" alt="Your Image">

Pros: No compression gets applied. Sweet!

Cons: You lose the convenience of the media library, and it’s a bit more work.

Option 4: Replace Default Image Sizes with Custom Quality Settings

WordPress automatically creates different versions of your image (like thumbnail, medium, and large). These are also compressed.

You can override their quality with another snippet:


add_filter('wp_editor_set_quality', function($quality) {
    return 100;
});

This ensures images edited in the media library also use 100% quality.

The Regeneration Trick — Fixing Past Uploads

If you’ve already uploaded lots of images, changing the future doesn’t fix the past.

But don’t worry, you can regenerate all your media files with a free plugin like:

  • Regenerate Thumbnails

Once your image compression settings are updated, use this plugin to recreate all existing image sizes using the new rules.

A Few Quick Tips for Best Results

  • Always resize before upload: Don’t upload a 5000px-wide image if your layout needs only 1200px.
  • Use PNG when transparency matters: Compression doesn’t affect them like JPEGs.
  • Install a visual check plugin: Preview your media library’s real quality with plugins like “Enable Media Replace.”

Bonus: Disable WebP Conversion (If Enabled)

Some hosting services or WordPress setups automatically convert your images to WebP format, a next-gen format with smaller file sizes.

These versions might look different from your originals and may also be compressed further.

To turn this off:

  1. Check your hosting dashboard or caching plugin (like WP Rocket or SG Optimizer).
  2. Look under image optimization settings and toggle off WebP conversion.

Advanced Trick: Use a Hook to Control Specific Sizes

If you want a mix (e.g., full-size images at 100%, thumbnails at 80%), you can customize per image size like this:


add_filter('wp_editor_set_quality', function($quality, $mime_type, $image_size) {
    if ($image_size === 'full') {
        return 100;
    }
    return 85;
}, 10, 3);

This gives you precise control over which versions get what level of quality.

Testing Your Image Quality Like a Pro

After you’ve made your changes, you’ll want to make sure they worked!

Here are some ways to test:

  • Right-click your image in the browser and “Open in new tab” – then zoom in.
  • Compare file size – the original vs the one in WordPress.
  • Use a browser extension like “Image Info” to preview compression differences.

In Summary

WordPress tries to help performance by compressing your JPEGs. But if you care deeply about visual quality, that can be a problem. Thankfully, you’ve now got all the tools you need to turn compression off, choose when it’s okay, and make your site look awesome.

Just remember—the goal isn’t to make your images massive. It’s to keep them looking just right for your audience, your brand, and your style.

Happy uploading!