What's WP
Our everything is about WordPress - best choice of WordPress users!
How to Control WordPress Image Compression

How to Control WordPress Image Compression

WordPress is built with an image compression feature. When JPEG files are uploaded to your WordPress sites, they will be compressed automatically even if you don’t tell WordPress to do so. Once WordPress compressed JPEG images to 90% of their quality, but in WordPress v4.5, the percentage decreases to 82%.

The default image compression is good for improving the website performance and guaranteeing a better user experience without bringing a large visual difference of the quality. However, if you run a photography site which displays high quality images, or want to change the default image compression settings to something else you want, you will need some simple skills.

In below, we will show you how to increase, decrease and disable image compression easily in WordPress to make sure everything is under control.

Option 1: Change WordPress Image Compression Manually

The manual method is easy to take as you only need to make simple changes to your theme files. Just follow the guides below.

Increase/decrease WordPress image compression

In the case that your WordPress site doesn’t rely much on images, you can decrease the WordPress image compression percentage to a lower value so as to further boost the page loads, relieve your disk space and save the bandwidth. This can be done quickly by adding the code below to the functions.php file of your theme.

Change Image Compression

As you may have guessed, “78” in the code refers to the percentage of the compression applied to uploaded images automatically. By changing the number to whichever you want from 0 to 100, you can have complete control over the file size. However, you must note that lower compression rates mean lower image quality, so you should not define the percentage to be less than 70 if you want to deliver a good reading experience.

Disable image compression

Despite the performance benefits of image compression, photographers and anyone else who displays high quality images only on his/her sites may want to disable the compression so that their images can be viewed optimally even by the professionals.

Besides, if you have already resized your images before uploading them, you will not need the compression feature, either, because allowing compression will cause a second-time decrease of the image quality. For example, when an image with 90% quality is uploaded to a WordPress site which is configured with 80% compression, the image quality would then become 72% only.

In such cases, add the following code in functions.php. Since “100” is the highest compression rate, WordPress will keep the highest possible quality for the images you upload, which actually means the image compression is disabled.

Disable Image Compression

Special notes

Changing the compression percentage doesn’t affect the existing images on your site, and only the new images will be compressed with the new percentage. Besides, after modifying the compression settings, you’d better regenerate the thumbnails to make sure your images will not be in a disorder.

Option 2: Control WordPress Image Compression with a Plugin

Besides modifying WordPress settings manually, you can make use of an image resizer to control the WordPress image compression. A good choice is the Imsanity plugin.

Use Imsanity to compress WordPress images

Imsanity is easy-to-use and comes with quite a few settings only. Once it is activated, it starts compressing your new images without any manual work from you. However, right after installing the plugin, you can still go to Settings > Imsanity to make the following configurations so that the plugin works better.

  • Configure the maximum width and height of the images on your site. Those uploaded images which exceed the configured values will be resized automatically to the size you have defined.
  • Select the compression percentage of JPG images.
  • Decide whether to convert BMP and PNG to JPG.

Configure Imsanity

After saving the changes, you can start uploading images from your local PC, phone, camera or anywhere else without worrying about the image size. The magic all happens automatically.

However, one thing to note is that with Imsanity, the compressed images will replace the original ones, so if you would like to store the original images for future use, you have to keep a local backup.

Compress existing images with Imsanity

If you want to compress the existing images, you can use the bulk resize feature built in Imsanity. To use this feature, you first need to click on the “Search Images” button which will return you a list of images. Then, you can select the images you want to compress and click on “Resize Checked Images”. All the rest works will be handled by the plugin automatically.

Bulk Resize Existing Images

For bulk resizing the old images, there are two suggestions.

  • Back up the uploads folder before resizing so you gain a change to convert the images back if there is any trouble with the plugin.
  • Select several images for a test before bulk resizing all images to make sure the plugin works alright.

Ignore certain images for compression

Imsanity provides the possibility to prevent some images from being compressed automatically. This is good if you want to use several high-resolution images in certain conditions. To let the plugin ignore an image, you can keep “-noresize” in the file name. For example, if you have an image named “christmas.jpg”, you need to rename it to “christmas-noresize.jpg”. Then this image will be uploaded in full size.

Author

Joyce is a professional writer & SEOer who loves trying new things and sharing the experience through blogging. She loves clean design, playing with different WordPress themes, SEO, etc. Now she is very struggle with purchasing a bubbling apartment in downtown. You can help her by clicking our ADs or making a purchase via our links ;-)

Close

Want to Learn More About WordPress?

Get Our Free Themes, Plugins, Support, SEO Tips, and Other Tutorials!

Email *