How to Optimize or Compress Images in WordPress

wordpress image opimzation

We are all concerned with the website’s speed as it not only keep the visitors away but it can also kill the SEO. There any methods by which we can increase the speed of the website but all are complimenting each other. Improving the performance of the site is the sum of all these methods combined. One of the methods is image optimization or compression which we will discuss in the following post. So get ready to learn how to optimize or compress the images either by using plugins or by writing codes manually. So this is a step-by-step guide on image compression in WordPress website that will help to reduce the whole media size and make your site load faster.

Best practice when you upload images to WordPress website is to keep the size of the images well below hundred kilobytes. You can compress the images further by saving your images as “web optimized” JPEGs or PNGs that will make the images with a resolution of 72 dots per inch (dpi), which is the web standard. You will be able to use photo editing softwares such as Photoshop, Lightroom or a similar to reduce the image size to around 1,500 pixels or less in width.

WordPress will automatically compress the images to 90 % quality whenever you upload images in the website. In WordPres 4.5 this compression percentage has been further reduced to 82 to improve site performance for mobile users.

In special cases where you don’t need any images compression and wanted to display the images at the highest quality, then you can turn off image compression in WordPress.

Image Compression in WordPress – Manual

Important Note: Before making changes on a website, be sure to create a backup of it.

To disable default image compression in WordPress, add the following filter to the site theme’s function.php file:

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

When you set the ‘return value’ to 100, it means that WordPress compresses the image at its highest quality.

To increase the automatic compression rate of WordPress, add the following filter. By adding the following code snippet, the image will be compressed to about 75%.

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

Compress Images Using WordPress Using Plugins

There are a number of plugins that can be used to compress the images existing on your website. This following tutorial will show how to use ‘Imagify’.

image compression in WordPress

Imagify do image optimization by compressing it as needed for the website and speed up the website.

When using this image optimization plugin, you can use three levels of optimization:

  • With the’Normal-standard lossless image compression algorithm’, the image quality will not be affected at all.
  • Opting for ‘Aggressive’, a more powerful lossy image compression method will be used, resulting in very little quality loss.
  • Ultra – will use the strongest lossy compression method and make the quality loss easier to find.

Imagify can also help convert and make WebP images in WordPress. This is the latest image format developed by Google, which can provide higher quality images and significantly reduce the file size.

Other Image Compression Plugins

Here are few more plugins for your WordPress image compression job.

A) Smush Image Compression and Optimization

Smush’s image compression plugin can help you load your website faster by resizing and optimizing all of your images for the web.

B) ShortPixel Image Optimizer – To Compress PDF Files

This plugin can compress all past and future images including PDFs uploaded to your media library. The plugin can provide both lossy and lossless compression for most file types.

C) Compress JPEG & PNG images

Want to optimize JPEGs and PNGs? This one can offer image compression services TinyJPG and TinyPNG by doing a compression of 40-60 percent and PNG images by 50-80 percent without visible loss in quality.

I hope now you understood how to do JPEG image compression and PDF file size optimization in WordPress. If you’re a photographer or graphic artist, then you may want to check out Envira Gallery to create beautiful responsive photo & video galleries for your site in seconds.

You May Also Like

About the Author: BW

4 Comments

  1. Pingback: Increase or Decrease the Compression Quality of Images | WordPress
  2. Pingback: Introduction to Lossy and lossless image compression - BookWebmaster
  3. Pingback: Social Media Logo Evolution: Now and Then - Infographic
  4. Pingback: Many Ways to Speed Up Your WordPress Website - BookWebmaster

Leave a Reply

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