The PNG Guide is an eBook based on Greg Roelofs' book, originally published by O'Reilly.

Image Converters

Conversion to PNG from other image formats (or even from PNG) remains a popular approach for the simple reason that other formats have traditionally been better supported by applications. Even with good, current application support for PNG, users typically have large archives of older images, at least some of which may they desire to convert to PNG format.

Just as one would like to see certain basic PNG features supported in image editors (which may be thought of as a special case of conversion utilities, converting and optionally modifying a previously saved image file) one would like certain basic PNG features supported in converters. These include:

  • Preservation of basic image types: RGB, grayscale, and palette-based

  • Option to convert ``truecolor'' images with fewer than 256 colors to palette-based (or grayscale, if appropriate)

  • Preservation of simple transparency in palette images (e.g., when converting from GIF), including the ability to reorder the palette so the transparent entry comes first, which avoids wasting space in PNG's transparency chunk

  • Preservation of unassociated alpha transparency (e.g., when converting from TIFF)

  • Preservation of gamma, chromaticity, sRGB, or full ICC profile information (see Chapter 10, "Gamma Correction and Precision Color", for details)

  • Option to preserve ``deep'' samples, such as from 12-bit JPEG or medical images or 16-bit-per-sample TIFF images

  • Preservation of text information (e.g., from JPEG, GIF, and TIFF images)

  • Preservation of interlacing or ``progressiveness''

  • Option to scan for unused palette entries and eliminate any from the palette

  • Reasonable default compression settings: adaptive filtering turned on for all image types except palette-based; ``medium'' zlib compression level (say, between 3 and 7)

  • Option for maximal (slowest) compression

Clearly, different users have different needs, but fundamental things that should be preserved when converting between image formats include the basic pixel information, transparency, and text. Items in the preceding list that involve optimization and compression of PNG images can be dealt with after the initial conversion is complete, but restoring text or transparency information that was lost in translation is tedious and to be avoided if at all possible.

In the next few sections, we will look at a number of conversion utilities in some detail. Most of these are command-line programs--not because we want the reader to suffer,[28] but because dedicated converters such as these typically do the best job and are often capable of batch (automated) conversions. I have also listed many image viewers with conversion capabilities in Chapter 3, "Applications: Image Viewers" and several image editors in Chapter 4, "Applications: Image Editors"; thse are, by necessity, graphical and may be preferable for the casual user.

[28] For real suffering, write a book.

Last Update: 2010-Nov-26