With my switch to Fedora as my main working operating system I needed to change how I process images for this site. I want images to be small, but still a good enough quality to see. On macOS I used Permute via SetApp to batch process images, but Permute is not available on Linux.

So let’s turn to some terminal tools to batch process images and make them ready for the web.

Install ImageMagick

Our first step is to make sure that we have ImageMagick installed. ImageMagick is a library specifically for manipulating images. You’ll find it on most servers, and it can be what powers the image manipulation tools built into systems like WordPress.

To install ImageMagick on Fedora run: sudo dnf install ImageMagick

If you’re on another system you can find ImageMagick install instructions here.

Converting Images

All the systems I have take screenshots in .png format and I find that I get best compression out of a .jpg image so my first step is to convert images between the formats.

To batch convert images from .png to .jpg and leave them in the same place run:

mogrify -format jpg *.png

Using *.png is a wildcard for all the images with the .png file extension.

Compressing JPG Images

Now to compress these new .jpg images we can use jpegoptim. To install it on Fedora run: sudo dnf install jpegoptim.

Now I run jpegoptim --strip-all -t --max=70 *.jpg to compress all the .jpg images in my folder. This command uses —strip-all to strip out all EXIF data from the file. -t shows me the total filesize of the compressed file. —-max lets me set the maximum quality of the image. You can see all the options on the manpage.

Another great use for this is to go back and compress all the images in place on a server. I’ve done this for a client and changed his image directory on his site from 60GB to 30GB with no loss in quality. To do that I run the following search on the top level directory, which will search all sub-directories and compress the images in place.

find . -name '*.jpg' | xargs jpegoptim --max=70 --strip-all

Permute on macOS?

One great thing about the methods above is that with the commands set I can stop worrying about Permute on macOS for compressing images as both ImageMagick and jpegoptim run on macOS. That means my automations are cross-platform which helps me be platform agnostic in my computing.

Become a TickTick Expert

TickTick is a superb task manager that works across macOS, Windows, and mobile platforms. It combines a robust calendar view for planning with excellent automation features. This course will help you get the most out of your TickTick setup. You can also become a member to get all my courses.

$49 USD (30-day guarantee)