PREVIOUS CONTENTS NEXT PREVIOUS CONTENTS NEXT PNG The Definitive Guide Greg Roelofs Greg Roelofs San Jose (Publisher) PREVIOUS CONTENTS NEXT PNG: The Definitive Guide by Greg Roelofs Copyright © 1999 O'Reilly & Associates, Inc. All rights reserved. Printed in the United States of America. Published by O'Reilly & Associates, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. Additions specific to the ``Second Edition'' (HTML Version): Copyright © 2002-2003 Greg Roelofs. All rights reserved. Published by Greg Roelofs, roelofs @ pobox.com. Cover design, trade dress, Nutshell Handbook, the Nutshell Handbook logo, and the O'Reilly logo are registered trademarks of O'Reilly & Associates, Inc. The association between the image of a kangaroo rat and the topic of PNG is a trademark of O'Reilly & Associates, Inc. Used with permission. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O'Reilly & Associates, Inc. was aware of a trademark claim, the designations have been printed in caps or initial caps. While every precaution has been taken in the preparation of this book, the publisher assumes no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein. Permission is granted to copy, distribute, and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License". While every precaution has been taken in the preparation of this book, the publisher assumes no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein. PREVIOUS CONTENTS NEXT PREVIOUS CONTENTS NEXT To Dad, who missed so much. You've always been my role model. PREVIOUS CONTENTS NEXT Preface Contents: About This Book Part I, Using PNG Part II, The Design of PNG Part III, Programming with PNG Conventions Used in This Book How to Contact Us About the ``Second Edition'' (HTML Version) History Version 1 Version 2 Acknowledgments Once upon a time, the only images were those painted on the walls of caves. Then came papyrus, stucco walls (and a chapel ceiling), the printing press, photography, television, and computers. Whether it's progress or not is a question for philosophers, but there is no doubt that creating, copying, modifying, and transmitting images has never been easier or faster than it is today. PNG, the Portable Network Graphics image format, is one little piece of the puzzle. In PNG: The Definitive Guide, I attempt to make PNG a little less puzzling by explaining the motivations behind PNG's creation, the ways in which it can be used, and the tools that can manipulate it. The intended audience is anyone who deals with PNG images, whether as an artist, a programmer, or a surfer on the World Wide Web. About This Book This book covers a lot of ground, as one would expect from anything with the word ``Definitive'' in its title. It is divided into three main parts. As much as possible, each part is written so that it can be read independently of the others. Even individual chapters are written this way, within reason; to avoid too much repetition, I'll periodically refer to other chapters. Part I, Using PNG Part I is intended for designers, web site owners, casual image creators, and web surfers--anyone who wants a quick start on using PNG images in a variety of applications. Such users may need only a brief overview of PNG features, but they want to know what applications support the format and to what extent, how to invoke PNG-specific features within the applications, and how to work around certain bugs or incompatibilities in the applications. Of course, a book like this cannot possibly stay current, particularly not when it comes to software, but every effort has been made to ensure that the information is accurate as of the day this is written (mid-April 1999). Chapter 1, "An Introduction to PNG", covers some basic concepts of computer images and file formats, explains how PNG fits in and where using it is most appropriate (and most inappropriate!), and ends with an in-depth look at an image-editing application with particularly good PNG support. Chapter 2, "Applications: WWW Browsers and Servers", looks at PNG support in web browsers and servers and shows how to use the HTML OBJECT tag and server-side content negotiation to serve PNG images to browsers capable of viewing them. Chapter 3, "Applications: Image Viewers", lists more than 75 applications capable of viewing PNG images, with support for a dozen operating systems. Viewers that are additionally capable of converting to or from other image formats are so noted. Chapter 4, "Applications: Image Editors", looks at PNG support in five of the most popular image editors, showing how to invoke such features as gamma correction and alpha transparency, and indicating some of the problems unwary users may encounter. Chapter 5, "Applications: Image Converters", covers five conversion applications in detail, including one specifically designed to optimize PNG images and another designed to test PNG images for conformance to the specification. In addition, the chapter lists another 16 dedicated image converters beyond those in Chapter 3, "Applications: Image Viewers". Chapter 6, "Applications: VRML Browsers and Other 3D Apps", looks at PNG as a required texture format of the VRML 97 specification and investigates the level of conformance of seven browsers. It also lists a dozen PNG-supporting applications designed for the editing or rendering of 3D scenes. Part II, The Design of PNG Part II looks at the PNG format from an historical and technical perspective, detailing its structure and the rationale behind its design. Part II is intended for more technical readers who want to understand PNG to its core. Chapter 7, "History of the Portable Network Graphics Format", looks at the events leading up to the creation of PNG, some of the design decisions that went into the format, how it has fared in the subsequent years, and what to expect for the future. Chapter 8, "PNG Basics", covers the basic ``chunk'' structure of PNG files and compares PNG's level of support for various fundamental image types against that of other image formats. Chapter 9, "Compression and Filtering", delves into the heart of PNG's compression engine, provides the results of some real-world compression tests, and offers a number of tips for improving compression to both users and programmers of the format. Chapter 10, "Gamma Correction and Precision Color", discusses one of the least understood but most important features of PNG, its support for platform-independent image display. That is, in order for an image to appear the same way on different computer systems or even different print media, it is necessary for both the user and the program to understand and support gamma and color correction. Chapter 11, "PNG Options and Extensions", details the optional features supported by PNG, including text annotations, timestamps, background colors, and other ancillary information. Chapter 12, "Multiple-Image Network Graphics", is a brief look at PNG's multi-image cousin, MNG, which supports animations, slide shows, and even highly efficient storage of some types of single images. Part III, Programming with PNG Part III covers three working, libpng-based demo programs in detail, and lists a number of other toolkits that offer PNG support for various programming languages and platforms. It is intended for programmers who wish to add PNG support to their applications. Chapter 13, "Reading PNG Images", is a detailed tutorial on how to write a basic PNG-reading display program in C using the official PNG reference library. The application is divided into a generic PNG back end and platform-specific front ends, of which two are provided (for 32-bit Windows and the X Window System). Chapter 14, "Reading PNG Images Progressively", inverts the logic of the previous chapter's demo program, simulating the design of a web browser's display-as-you-go PNG code. Progressive display of interlaced, transparent PNG images over a background image is supported. Chapter 15, "Writing PNG Images", shows how to create a basic PNG-writing program. The supplied code compiles into a simple command-line program under both Windows and Unix, and it includes support for interlacing, gamma correction, alpha transparency, and text annotations. Chapter 16, "Other Libraries and Concluding Remarks", lists a number of alternative libraries and toolkits, both free and commercial, including ones for C, C++, JavaTM, Pascal, tcl/tk, Python, and Visual Basic. The chapter ends with a look back at what parts of the PNG design process worked and what didn't, and also a look forward at what lies ahead. The References section lists technical references and resources for further information, both printed and electronic. The Glossary defines a number of acronyms and technical terms used throughout the book. Conventions Used in This Book Italic is used for pathnames, filenames, program names, new terms where they are defined, newsgroup names, and Internet addresses, such as domain names, URLs, and email addresses. Constant width is used to show code, commands, HTML tags, and computer-generated output. Constant width bold is used in examples to show commands or other text that should be typed literally by the user. Constant width italic is used in code fragments and examples to show variables for which a context- specific substitution should be made. The variable email address, for example, would be replaced by an actual email address.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages354 Page
-
File Size-