How to Optimize WordPress Image Compression

It is no secret that compressing images used in a post leads to better website loading time. WordPress has its own built in image compression capability. Every time you upload a image (JPEG or PNG), WordPress will compress the image to 80% of the original quality. It is done in order to optimize and reduce website loading time. Depending on the nature of your website, you must take control of WordPress image compression settings. For an example, a website about photography would need high quality images. So to preserve the original images you upload, you must disable or reduce WordPress image compression.

WordPress image compression

We can use a simple PHP code to take control of WordPress image compression settings. Open up your functions.php file in WordPress Directory and add the following code. Note that following code represent image compression to 85% of the original quality.

 

If you would like to leave the image at its original quality, adjust this number to 100. This would also means that you are disabling WordPress image compression. Add the following code to your WordPress functions.php file and save.

Adjust the compression number to your liking. Lower number would increase the image compression and decrease the website loading time.

 

If you don’t like to mess with PHP, Optionally you can use a WordPress Image Compression plugin to achieve the same result. Simply download the one of the plugins I have listed below and adjust the settings.

  1. WP Smush – This plugin help you optimize images using loss-less image compression techniques. All files (JPEG, PNG, GIF) can be compressed automatically during upload or after upload. This plugin is completely free to use. Download it from your WordPress plugins section.
  2. EWWW Image Optimizer – Similar to WP Smush, this plugin helps optimize your images automatically during upload process or afterwards. Optionally you can apply latest loss-less image compression techniques available from the plugin dashboard.
  3. Compress JPEG & PNG Images – This plugin help you compress both JPEG and PNG file formats. One of the most download plugins in the WordPress directory and it is completely free to download. This plugin also compatible with WooCommerce. Similar to other two plugins mentioned above, Compress JEPG & Images plugin can automatically optimize the images on upload or do it later in batches.

 

WordPress image compression plugins mentioned above help you take complete control of WordPress image compression. You can use the PHP code mentioned above as well to achieve the same results. Either way, you must optimize your image compression settings according to your website’s nature. This will help cut your website loading time significantly.

 

Also read: How to Set Leverage Browser Caching in WordPress

Leave a Reply