Full Name | PNG (Portable Network Graphics) |
Format ID | IG_FORMAT_PNG = 33 |
File Extension(s) | *.png |
Data Type | Raster Image |
Data Encoding | Binary |
ImageGear Multipage Support | No |
ImageGear Alpha Channel Support | Supports single alpha channel for read/write. |
ImageGear Platforms Support | WIN32, WIN64, Unix, Unix64, .NET, .NET64, MAC |
ImageGear Supported Versions:
- 10th draft (future drafts will be backward-compatible)
- PNG v2
ImageGear Supported Features:
- IG_FLTR_DETECTSUPPORT - autodetection
- IG_FLTR_PAGEREADSUPPORT - single page file reading
- IG_FLTR_PAGEINSERTSUPPORT - single-page file writing
ImageGear Read Support:
- IG_COMPRESSION_DEFLATE:
- Indexed RGB: 1, 2, 4, 8 bpp;
- Grayscale: 1, 2, 4, 8, 16 bpp;
- Grayscale + Alpha: 8, 16 bpp;
- RGB: 24, 48 bpp;
- RGB + Alpha: 32, 64 bpp
ImageGear Write Support:
- IG_COMPRESSION_DEFLATE:
- Indexed RGB: 1, 4, 8 bpp;
- Grayscale: 8, 16 bpp;
- Grayscale + Alpha: 16, 32 bpp;
- RGB: 24, 48 bpp;
- RGB + Alpha: 32, 64 bpp
ImageGear Filter Control Parameters:
Filter Control Parameter | Type | Default Value | Available Values | Description |
BUFFER_SIZE | DWORD | 0 | Size of the buffer for strip if STRIP_CONFIG is IG_PNG_STRIP_FIXED_BUFFER | |
COMP_LEVEL | UINT | IG_PNG_DEFAULT_COMPRESSION | IG_PNG_DEFAULT_COMPRESSION, IG_PNG_MIN_COMPRESSION, IG_PNG_MAX_COMPRESSION | Compression level. It must be between IG_PNG_MIN_COMPRESSION and IG_PNG_MAX_COMPRESSION. Better compression takes more time for compression. |
KEEP_ALPHA | AT_BOOL | TRUE | TRUE, FALSE | When loading: if this parameter is TRUE, then alpha channel is loaded into Alpha DIB. Otherwise, the image is transformed into RGB, by compositing over the background supplied in the bKGD chunk, if it is present, or over the default background. When saving: if this parameter is TRUE, and alpha DIB is present, it will be written to the file. |
SAVE_INDEXED_GRAY_AS_GRAY | AT_BOOL | FALSE | FALSE, TRUE | Affects saving of images that have grayscale palette. If TRUE then ImageGear saves the image as Grayscale (type 0). Otherwise, ImageGear saves the image as Paletted (type 3). |
STRIP_CONFIG | INT | IG_PNG_STRIP_FIXED_COUNT = 0 | IG_PNG_STRIP_FIXED_COUNT,IG_PNG_STRIP_FIXED_BUFFER | Format of PNG strip, see IG_PNG_STRIP_... constants |
STRIP_COUNT | INT | 0 | Number of lines in one strip if STRIP_CONFIG is IG_PNG_STRIP_FIXED_COUNT |
Comments:
The PNG (pronounced "Ping") format was created out of reaction to Unisys's announcement that it would begin requiring royalty fees for use of its LZW compression scheme. This was the compression scheme for the widely-used GIF format (found in Web pages and online library images).
Thomas Boutell and a host of other programmers began working to devise a new file format to eliminate the need for payment of royalty fees. The result was a file format that offers better compression than GIF, and adds features GIF doesn't offer, including truecolor, and full alpha channel and gamma correction.
The basic organization of the PNG file format utilizes storage structures known as "chunks". A chunk is a block of data that contains its own header (identifying the chunk size and type). This makes it easy for a PNG viewer to identify chunks and to skip over the ones that are not necessary.
The first entry in a PNG file is the "PNG signature" that identifies the format as PNG. The file then proceeds with a series of chunks.
The IHDR Image Header, or IHDR Chunk, contains a number of fields including the height, width, depth, color type, and compression type of the image. The only valid compression value is 0, which indicates the PNG's custom compression scheme, a deflate/inflate compression with a 32k sliding window. This is a derivative of ZZ77, the precursor to LZW. ZZ77 is the compression scheme used by pkzip software.
The "PLTE Palette Chunk" contains 1 to 256 palette entries. This is present if the type field of the header chunk is set to 3. The number of colors cannot exceed the range provided by the bit depth.
The image data is stored in "IDAT Image Data Chunks". These are subdivided into chunks whose size is usually determined by the size of the encoder's buffer. The data may be stored in "interlaced order" allowing the image to be "faded in". The data may also be interlaced. Interlacing helps the appearance of an image as it displays while being decompressed, so that it "fades in". In a non-interlaced file, the presentation of the image data begins with row 1 and works downward to the last row of data. This method of display does not allow a quick preview of the whole image. When the data is interlaced, the lines are saved and displayed out of sequence. Every fourth row is displayed first and then filled in with every remaining fourth row, until all of the lines are displayed. This allows the eye to perceive the basic subject of the whole image before it is completely displayed.
"Ancillary Chunks" are optional. They must appear before the first IDAT and after the PLTE. One chunk is the "bKGD chunk" that sets the default background color for the image. Two of the other ancillary chunks are the "hHist Chunk" or histogram chunk, and the "tEXt" chunk. The histogram chunk appears if there is a palette. It stores the frequency of each color of the palette as it occurs in the image data. If the application doesn't support all of the colors in the palette, the histogram can be used to choose a subset of colors. There may be any number of text chunks. They can vary in length from 0 to the maximum chunk size. They include the image author, copyright information, and any desired comments.
Questions about PNG can be e-mailed to: png-info@uunet.uu.net
References Used:
Murray, James D. "Graphic Image Format FAQ 3-4". James D. Murray, 1994-1996.
PNG (Portable Network Graphics), tenth draft. Page 5, copyright Thomas Boutell, May 1995.
Wegner, Tim. "Coding for PNG Graphics", "PC Techniques", Feb/Mar 1996, pp 32-38.