PNG: The Definitive Guide

PNG: The Definitive Guide

by Greg Roelofs, Richard Koman
     
 

PNG (Portable Network Graphics) is the next-generation graphics file format for the Web. Designed as an open-source format to replace the proprietary GIF format, PNG is better, smaller, more extensible, and free. Already supported by major software like Macromedia Fireworks, Adobe Photoshop, and Microsoft Office, as well as Netscape Navigator and Microsoft

Overview

PNG (Portable Network Graphics) is the next-generation graphics file format for the Web. Designed as an open-source format to replace the proprietary GIF format, PNG is better, smaller, more extensible, and free. Already supported by major software like Macromedia Fireworks, Adobe Photoshop, and Microsoft Office, as well as Netscape Navigator and Microsoft Internet Explorer, PNG is an elegant and feature-rich image format that has finally achieved broad industry support.PNG: The Definitive Guide addresses the needs of both graphic designers who want to get the most out of the format and programmers who want to add full PNG support to their own applications.In the "Using PNG" section, Roelofs covers Web browsers and servers, image viewers, image editors, image converters, and 3D applications, with particular attention to the level of PNG support in each. In the "Design of PNG" section, he includes detailed information on compression and filtering, gamma correction and precision color, PNG options and extensions. In the "Programming PNG" section, he steps through three sample programs that implement PNG with the libpng C library.PNG: The Definitive Guide is the first book devoted exclusively to teaching and documenting this important new image format. It is an indispensable compendium for Web content developers and programmers and is chock full of examples, sample code, and practical hands-on advice.

Editorial Reviews

Lou Grinzo

Nearly all long-time programmers have a love-hate relationship with file formats. Those standards can be both a blessing, by allowing programs to exchange highly complex data, and a curse, when there are ambiguities in the specifications or how certain programs interpret them. A good reference book can easily make the difference between those polar opposites, particularly when dealing with graphics formats. The PNG (Portable Network Graphics) file format is a relative newcomer on the scene, and is one of the more intricate ones, even for a graphics standard. This is, by any measure, not your father's bitmap.

Into this breach steps Greg Roelofs and his book, PNG: The Definitive Guide. The first question most people will ask is: "A 300-plus page book about a single file format?" Surprisingly, the answer is yes, and it's not padded with copious code listings or screen shots. If anything, the book is light on those staples of programmer's reference books, but luckily it provides a considerable amount of information about the background of the PNG format, as well as available tools for various platforms and needs. And yes, there are some programming examples.

Roelofs takes a somewhat unusual approach in this book, in that he doesn't bludgeon you with data structures and other minutiae, but instead works hard to detail the infrastructure around the PNG format. This will be a little off-putting at first for programmers (including me) who have grown accustomed to being so bludgeoned, but there are merits to this approach as well.

Roelofs presents the material in three sections. The first is "Using PNG," which provides a general introduction and then five more chapters discussing various applications that support PNG files to various degrees. The next section is "The Design of PNG" and a history of the format, along with a lengthy description of the various "chunks," some required and some optional, that make up a PNG file, as well as how certain graphics features are handled, including compression, gamma correction, and precision color matching. The final section is "Programming with PNG," where Roelofs walks you through examples of reading a PNG file all at once or progressively, as well as writing PNG files, using the most popular code for PNG support, libpng.

Throughout his discussion of PNG features, Roelofs compares PNG to other formats, mostly GIF and JPEG, and occasionally TIFF. He's surprisingly even-handed with comparisons, and doesn't sound at all like a zealot pushing his favorite techno-toy. Several times he states clearly that PNG is not a good choice for certain particular conditions. Clearly he was absent from class on the day programmers were taught how to practice arrogance and boosterism.

Similarly, Roelofs avoids the politics of PNG's birth, as it was begun in response to the infamous patent and royalties issue over the compression algorithm used in GIF files that arose in the closing days of 1994. He does explain the impetus for creating the PNG format and how it was developed, but he mercifully doesn't climb up on his soapbox about it. Given his involvement with the PNG specification, and his maintenance of the sizable and "official" PNG web site, this objectivity is a particularly welcome surprise.

Many readers who are relative newcomers to graphics work will appreciate the time the book spends on more advanced topics like gamma correction, alpha channels, progressive display of images, and the various basic formats of graphics files. There's a lot of worthwhile material here that is not specifically tied to PNG files, but is prerequisite to fully understanding them.

Roelofs spends a chapter on one of the lesser-known topics in the PNG universe, the MNG (Multiple-Image Network Graphics) format, basically a more complex version of a PNG file. MNG files allow for multiple images per file and special features, such as partial-frame updates and display timing parameters, that make it very versatile. He presents a detailed overview of the MNG format's capabilities and structure, including the "chunks" that are unique to it. His treatment is not meant to be a definitive guide to MNG, as he says clearly, but it should easily give anyone interested in PNG files a working knowledge of this related format.

I have only two criticisms of this book, neither of which I think is serious. First, I do wish Roelofs had included a bit more down-and-dirty programming how-to. His examples are good, but a few more highlighting various tasks a programmer might have to perform in dealing with PNG files would have been welcome. (In the author's defense, he does provide numerous URLs in a "References" section in the end of the book that point to source code, articles, specifications, and other resources, so the reader is not left wandering about the Internet aimlessly). The second problem is that Roelofs provides references to so many third-party applications and libraries that there's no way he could have presented any significant depth on them all; a reader interested in the capabilities of a specific tool is likely to be disappointed in his sparse comments, although the chances are very good that the tool of interest will be mentioned.

A programmer who needs a quick and dirty code snippet, a magic incantation in C, so to speak, to do some specific task with PNG files can probably find a good solution on the Internet without this book's help. But Roelofs' aim goes deeper than that, and anyone who wants to understand the Zen of PNG should read PNG: The Definitive Reference.
Electronic Review of Computer Books

Product Details

ISBN-13:
9781565925427
Publisher:
O'Reilly Media, Incorporated
Publication date:
06/28/1999
Series:
O'Reilly Nutshell Series
Pages:
340
Product dimensions:
7.06(w) x 9.20(h) x 0.88(d)

Meet the Author

Greg Roelofs is a senior researcher at Philips Electronics, specializing in compression, graphics, 3D, and audio software. He helped design the PNG image format, maintains its official web site, and writes free software in his spare time. Greg holds a doctorate in astrophysics from the University of Chicago.

Customer Reviews

Average Review:

Write a Review

and post it to your social network

     

Most Helpful Customer Reviews

See all customer reviews >