Appendix B. Common Tools

In Chapter 14 and others, you’ve read a lot about ImageMagick and some of the tools in the ecosystem. It’s worth taking some time to investigate other utilities that, if perhaps not quite ready for a large-scale image workflow due to their interface (GUI) or performance (slow), could still prove useful. Since tastes vary, it’s not unusual for two tools to provide similar functionality but with slightly different results, so try a few to see which one suits you best!

PNG Utilities

PNG is one of the formats that gets a lot of optimization attention. There are a few reasons for this. First, since it’s a lossless format, there aren’t a lot of dials you can tweak to sacrifice a bit of quality at the expense of fewer bytes. Second, it’s a relatively straightforward format in terms of implementation, and has a number of parts of its binary format that aren’t necessary for rendering the image. Lastly, PNG uses DEFLATE compression for its pixel data, and there have been a couple of attempts to improve it over the years.

pngcrush

One of the more well-known PNG optimizers, pngcrush attempts to reduce the size of PNGs by trying a number of different filtering and compression methods, as well as removing unneeded metadata.

OptiPNG

Similar to pngcrush in terms of methodology, OptiPNG has some performance benefits over its predecessor in that the trials used during filtering and compressing are performed in-memory.

pngquant

A “lossy” PNG optimizer, pngquant leverages quantization algorithms to reduce the number of colors, and therefore, the perceived quality of the image. This has the effect of reducing the amount of data in the image, and in turn the number of bytes.

ZopfliPNG

Google has published a few research papers describing their work on better compression algorithms, and Zopfli is an output of those exercises. One of the more interesting attributes of Zopfli is that it retained compatibility with DEFLATE encoding, which means that it can be used to compress PNGs. To highlight this, as part of the Zopfli source distribution, it includes a command-line tool called zopflipng that encodes PNGs using Zopfli.

A nice breakdown of what it takes to compress and optimize a PNG, as well as a list of a few other tools, can be found on the OptiPNG site.

JPEG Utilities

Since JPEG is by far the most prevalent image format on the Internet, there are a number of tools that have been built to optimize JPEGs in various ways. Many of these try to do clever things like optimizing the compression algorithms, often taking wildly different approaches.

cjpeg and jpegtran (part of most JPEG suites, like libjpeg/libjpeg-turbo/MozJPEG)

A Swiss Army knife for JPEGs, jpegtran has a number of features that allow you to do transformations like optimize Huffman tables, convert to progressive JPEG, as well as make visual changes like cropping, rescaling, and various forms of rotation. While usually used for encoding JPEGs, the cjpeg utility has some additional command-line arguments under the “Switches for wizards” help heading, like -qtables and -qslots, which allow you to use a different set of quantization values for encoding the image and tuning the chrominance and luminance of the output image. These settings aren’t for the faint of heart, so make sure you read Chapter 4 closely before tweaking them. Some more details about them can be found here: http://uw714doc.sco.com/en/jpeg/wizard.txt.

JPEGrescan

Previously a standalone utility, JPEGrescan employs a technique that is now included in the MozJPEG encoder, which means it’s not only faster, but you can get its benefits just by running MozJPEG. If you want to go the standalone tool route, JPEGrescan has a number of optimizations it tries to do on the compression settings, and also includes options to remove Exif and JFIF metadata.

Adept

Described as the “adaptive JPEG compressor,” Adept uses a novel approach to compression by looking for parts of the image that might be more compressible than others by leveraging a saliency algorithm to detect where to attempt higher compression levels.

Animated GIF Utilities

Animated GIFs have taken the Web by storm (again!). Unfortunately, many GIF authoring tools create poorly optimized images, but there are some tools available to help you.

gifsicle

Perhaps the best-known standalone tool for creating and optimizing animated GIFs, gifsicle can perform a number of different optimizations to animated GIFs. In particular, it performs a number of color optimizations to reduce file size.

giflossy

Based on gifsicle, giflossy implements lossy LZW (Lempel–Ziv–Welch, named after its creators) compression onto the tool, which allows for significantly smaller animated GIFs while sacrificing a little quality.

gifify

In contrast to gifsicle and giflossy, gifify’s authoring tools are focused on creating optimized animated GIFs from video sources. It leverages giflossy for its optimizations.

GUI Utilities

For those who feel more comfortable with a GUI than stringing together commands at the command line, there are a few options out there that can be quite useful for those who prefer to use their mouse.

ImageOptim

One image utility to rule them all? If you prefer a single GUI tool to numerous command-line utilities and use a Mac, ImageOptim might be the tool for you. It brings the best of many of the aforementioned tools to a simple-to-use GUI interface, and supports PNG, GIF, and JPEG input. Its drag-and-drop interface makes optimizing images a breeze.

RIOT

Similar to ImageOptim, RIOT too supports optimizing PNG, GIF, and JPEG input. Unlike ImageOptim, though, RIOT is a Windows-only tool. The software also has a plug-in architecture allowing its functionality to be extended, and can itself be used as a plug-in to popular Windows image tools like IrfanView or the cross-platform GIMP.

Caesium

A cross-platform tool that optimizes JPEGs and PNGs, Caesium has a nice GUI to help you process files one at a time or as a batch. It is available in a few different forms, including desktop GUI application, command-line utility, and mobile app.

Exif Utilities

Exif is one of the more interesting metadata attributes found in images, since it can contain valuable information, like copyright and ownership data, as well as add unnecessary bloat to your images. Exif is supported by both JPEG and TIFF formats. Here are a few utilities that can help you rein in the beast:

jhead

An incredibly easy-to-use tool to manage Exif metadata, jhead allows you to view the contents of an image’s Exif segments, as well as perform operations like copying, adding, and removing. It also supports autorotating images based on Exif data, as well as allows you to copy Exif over when modifying the image using a tool like ImageMagick.

exiv2

While similar in spirit to jhead, exiv2 is a very powerful tool that comes as both a standalone utility and a C++ library. If you have a need for advanced Exif management, spend some time understanding exiv2 and all it can do for you.

exiftool

exiftool is another Exif management utility that comes as both a command-line tool and a Perl library. Similar to exiv2, it’s an incredibly powerful tool that contains numerous options to add, view, edit, and delete Exif. It is well documented with a number of usage examples to help you add it to your workflow.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset