Automate Lossless Image Compression Process in WordPress

According to Wikipedia, Lossless compression is a class of data compression algorithms that allows the original data to be perfectly reconstructed from the compress data. It’s used in situations where the original and decompressed data need to be identical, or where data needs to be in a small form factor for better transition while still keeping in good or the same quality.

In fact, if you run speed test services, such as Google PageSpeed Insights or GTmetrix on any websites, you will probably notice that picture compression is a fairly important factor that matters to the final test result. A web page that uses lossless compressed images will most likely score higher than those that only use original uncompressed images.

What needs to be compressed?

Not all images are suitable for compression. RAW, BMP,  and PNG images are all lossless image formats, so they are ok to use. JPEG and GIF files are not so never compress them as the quality will decrease dramatically after compression. TIFF file can be used in either way.

Since only PNG, JPEG, and GIF files are used on the web, the only format we need to deal with here really is just PNG files, unless you care about the speed score more than the quality of the image.

What tool to use?

There are many options out there for PNG lossless compression. Check out some of the choices below and choose one that fits you the most.

If you need a web app

Yahoo’s smush.it used to an awesome choice, but now it’s dead. So if you still need a web app for occasional use, give it a try compressor.io or TinyPNG. But if you have a mass files that need to compress or need to do so very frequently, you should look at the desktop options instead.

If you are using Mac

ImageOptim should be your choice to go. It’s free and works on Mac OS X 10.7 and above.

ImageOptim — better Save For Web - 2015-07-03 17_15_10

If you are on Windows

PngOptimizer is the one you should try out first. It’s free, portable, and super easy to use. It’s mostly for PNG file compression, but it also converts GIF, BMP, or TGA files into PNG and compresses them. What I like the most is that it compresses all files and saves them into original files automatically so that if I have a large file structure with full of PNG files I can simply drop the whole folder into the application and PngOptimizer will take care of the rest.

PngOptimizer-2.0-usage-1

If you need to compress a bunch of JPEG, FileOptimizer could be your friend. In fact, it’s the tool that can compress almost any image format you can imagine, PNG, JPEG, GIF, TIFF, BMP, SVG, MKV, to name a few. Same as PNGOptimizer, you can drag a folder of images to the tool and FileOptimizer will take care of the rest. By default, the original images will be moved to the recycle bin before being replaced by the compressed version.

What about WordPress powered website?

There are quite a few plug-ins ready for lossless image compression. I would recommend starting with Compress JPEG & PNG images first. This plugin automatically optimizes your images by integrating with the popular image compression services TinyJPG and TinyPNG.

If you run a site that doesn’t have a huge image library, you can install the plug-in, and go to Tools → Compress All Images to compress all your existing images to a compressed format.

Wordpress - Tools - Compress all Images

But if you run a site that has a huge image library, you better use the tools mentioned above to compress your library instead of using the plug-in, as it may use too much server power that would be in result impact your website performance during the compression.

What nice thing about this plugin is that you can basically install it and forget about it. After getting your existing library all compressed, it compresses automatically whenever you upload an image, which means at the time after you publish the post all images in the post are already losslessly compressed.

One thought on “Automate Lossless Image Compression Process in WordPress

Leave a Reply

Your email address will not be published.