WordPress Automatically Compresses Images

Did you know that WordPress automatically compresses your JPEG files when you upload them to the media library? By default, WordPress used to compress images down to 90% of their original size. However, as of  WordPress 4.5 , this has been increased to  82%  to further increase performance across the board. If you were wondering why your images look a little pixelated on a fresh WordPress install, this is why.

While automatic compression is great, we’ve generally found that 82% is nowhere near enough when it comes to actually impacting your site’s performance. So you can disable this option if you wish by adding the following filter to your functions.php file. Remember, always  back up  your site before editing it.

If you want to increase the automatic compression ratio of WordPress, you can add the filter and reduce the percentage of the original file, let’s say up to 70% as shown in the following example.

Remember, this won’t affect already uploaded images. To do that you’ll need to use a plugin like  Regenerate Thumbnails  to apply the changes to your existing media library. Or better yet, use a WordPress image optimization plugin (we’ll go into more depth on this later) or compress WordPress Automatically your images before uploading them.

Compress Images with Save for Web (Software)

You can use tools like Adobe Photoshop, Affinity Photo, Affinity Designer, or other image editors to adjust the quality greece email list settings of an image (as seen below). In most tools, this is found under “Save to Web” or “Export Settings.”

If we do a little comparison of lossy compression rates, we can see that 50% compression looks great. At 33% it starts to get a little blurry on some of the background details (but they’re practically unnoticeable), and at 5% it’s obviously not acceptable. This is just one example of why WordPress’s automatic 82% isn’t enough. You can, and should, compress your images at much higher rates to decrease their weight even further.

Let’s say you choose to use the 50% compressed image

The file size is 227 KB, which is how to make a tv bracket yourself definitely a lot smaller than the original 2MB+ file. However, it’s still not enough if this is just one of 15+ images on a page. In general, it’s best to keep all your images under 100 KB if possible. In my experience, you should be able to make them even lighter. So, this is where it’s also important to resize your images . If you first WordPress Automatically resize the image from 50% to 1251 px by 916 px then it will only weigh 95 KB. 

But remember, you may not want cyprus business directory to make your images too small, as starting with WordPress 4.4,  support for responsive  (non-CSS scaled-down) images was added. WordPress automatically creates multiple sizes for each image uploaded to the media library. By including an image’s available sizes in a srcset attribute, browsers can now choose to download the most appropriate size and ignore the others. See below for an example of what this looks like in code.

Leave a Comment

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

Scroll to Top