Flaca v1.7.6
License: WTFPL
Released: 2021-09-11

Flaca

Flaca is a CLI tool for x86-64 Linux machines that simplifies the task of maximally, losslessly compressing JPEG and PNG images for use in production web environments.

It prioritizes compression over speed or resource modesty, and runs best on systems with multiple CPUs. There are only so many ways to be a JPEG, but calculating the optimal construction for a PNG can take a lot of work!

Compression is mainly achieved through the removal of metadata and optimization of pixel tables. Under the hood, Flaca leverages the jpegtran functionality from MozJPEG for JPEG images, and a combination of Oxipng and Zopflipng for PNG images.

Metadata

For web images, metadata is just so much wasted bandwidth. Stock photos in particular can be bloated 50% or more with embedded keywords and descriptions that browsers make zero use of. Removing that data — particularly at scale — leads to both lower hosting costs for site operators and faster page loads for visitors.

And it helps close the digital divide.

But in other contexts, metadata may matter.

As a general rule, you should not try to feed your entire personal media library or raw print/design assets to Flaca or it may eat something important.

Installation

Debian and Ubuntu users (and probably Arch Linux users too) can just grab the pre-built .deb package from the release page.

To build it from source, refer to the documentation in the repo.

Usage

It's easy. Just run flaca [FLAGS] [OPTIONS] <PATH(S)>….

The following flags and options are available:

-h, --help           Prints help information
-l, --list <list>    Read file paths from this list (one per line).
-p, --progress       Show progress bar while minifying.
-V, --version        Prints version information

You can feed it any number of file or directory paths in one go, and/or toss it a text file using the -l option. Directories are recursively searched.

Flaca can cross filesystem and user boundaries, provided the user running the program has the relevant read/write access. (Not that you should run it as root, but if you did, images would still be owned by www-data or whatever after compression.)

Some quick examples:

# Compress one file.
flaca /path/to/image.jpg

# Tackle a whole folder at once with a nice progress bar:
flaca -p /path/to/assets

# Or load it up with a lot of places separately:
flaca /path/to/assets /path/to/favicon.png …