Blog post

Compressing Images on Linux

111backup-compression

This was the first blog post here, and the idea was to share at least a couple of useful tips each week. A good one to start with:

At one point I was looking for a way to compress image files without changing their format, just reducing file size while keeping quality intact.

There are a few interesting tools for that, but the ones that felt both fast and effective were these:

I used Ubuntu 14.04 Server, but it should also work on similar systems.

For PNG files, install OptiPNG with:

sudo apt-get install optipng

Or compile it manually using these instructions.

For JPEG files, install JpegOptim with:

sudo apt-get install jpegoptim

After that, run these commands inside the folder that contains your images:

For PNG:

find . -type f -name '*.png' -exec optipng {} \;

For JPEG:

find . -type f -name '*.jpg' -exec jpegoptim --strip-all {} \;

That is it. You save storage and bandwidth without losing quality.