README.md

ImageOptim-CLI

📋 Summary

While other image optimization tools are available from the command line, ImageOptim-CLI exists
because the current benchmarks suggest that
ImageOptim, ImageAlpha and JPEGmini currently outperform those alternatives over lossless and lossy
optimizations.

ImageOptim-CLI is written in TypeScript and AppleScript but is distributed as a self-contained
executable binary, you don't need Node.js installed to use ImageOptim-CLI.

⚠️ JPEGmini and support for assistive devices

You may be presented with the following message the first time you run ImageOptim-CLI with the
--jpegmini flag.

To automate JPEGmini we need to add Terminal.app (or iTerm.app etc) to the 'support for assistive
devices' whitelist.

The JPEGmini OS X Apps don't include a command line API, so a real user is simulated by entering
synthetic clicks and keyboard commands instead. This requires your permission and is easily set up
in System Preferences as shown by these guides.

Article for Smashing Magazine

Alfred Workflow

❓ FAQs

General

Do ImageOptim, ImageAlpha, or JPEGmini come bundled with the ImageOptim-CLI installation?

You will need to install these applications separately.

Do I have to pay to use ImageOptim-CLI?

The CLI, ImageOptim and ImageAlpha are all free. JPEGmini is a paid-for product but you can use
ImageOptim-CLI and choose not to run JPEGmini.

The WebP image format looks promising, can you get ImageOptim-CLI to convert images to it?

WebP looks great and may well overtake the formats handled by ImageOptim-CLI, but converting images
to WebP is outside ImageOptim-CLI's chosen remit.

Can you get ImageOptim-CLI to skip images it has already processed, if they haven't changed?

JPEGmini does this today, but for ImageOptim and ImageAlpha I feel a feature like this belongs in
those applications rather than this automator.

ImageOptim

ImageOptim makes the fans on my Mac run at full power.

Optimising images is a pretty intensive process, so instead of optimising one image at a time (which
would take forever) — ImageOptim optimises many images at the same time until all of them are done.

A side effect of this is that the fans come on at full power to keep your machine cool while it's
maxed out.

ImageAlpha

I don't think ImageAlpha is running, I can't see anything.

ImageOptim-CLI uses ImageAlpha's internal installation of pngquant so it's
normal that nothing is shown on screen.

It's also possible that if you look in the Activity Monitor
you will not see pngquant displayed but it is being run. In my experience it's only when you run
ImageOptim-CLI on a very large number of PNGs that you have enough time to spot it. ensure that
Activity Monitor's Update Frequency is set to Very Often (1 sec).

JPEGmini

Can I use ImageOptim-CLI with JPEGmini Lite, the free version of JPEGmini?

Yes.

I upgraded from JPEGmini Lite to JPEGmini but ImageOptim-CLI still says JPEGmini is not installed.

Performing the in-app upgrade leaves the app named as jpegmini-lite, so ImageOptim-CLI can't
determine whether it's the free or full version. It is better to instead buy
the full version of JPEGmini separately.

ImageOptim-CLI says “To automate JPEGmini we need to enable GUI Scripting”, how do I do that?