- Shopping Bag ( 0 items )
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