Date: 02-16-2022
Return to Index
created by gbSnippets
'PNG (Portable Network Graphics) file format is the free, open-source successor to the GIF.
'Supports 24-bit, truecolor images (GIF supports only 256 colors) and uses lossless compression.
'Best used when the image has large, uniformly colored areas.
'The lossless PNG format is best suited for editing pictures
'JPG files are smaller than PNG files.
'PNG is supported by contemporary web browsers, including full 8-bit translucency
'Indexed-color, grayscale, and truecolor images are supported, plus an optional alpha channel.
'Fully streamable with a progressive display option.
'File Header (8-byte signature 89 50 4E 47 0D 0A 1A 0A)
'Bytes Purpose
89 'High bit set. Detects systems not supporting 8 bit data. Reduces mistaking file as text file
50 4E 47 'ASCII letters "PNG"
0D 0A 'DOS style line ending (CRLF) to detect DOS-UNIX line ending conversion of the data
1A 'Stops display of the file under DOS when TYPE command Type is used
0A 'UNIX style Line ending (LF) to detect UNIX-DOS line ending conversion.
'Chunks (critical or ancillary)
'Length (4), Type/Name (4), Chunk Data (length bytes), CRC (4)
'Chunks are given a four letter case sensitive ASCII Type/Name, which declares
'the chunk as critical/ancillary.
' - 1st letter uppercase means is critical chunk
' - 2nd letter uppercase indicates "public"
' - 3rd letter must be uppercase to conform to the PNG specificatio
' - 4th letter uppercase means chunk is safe to copy
'Standardize Chunk Names:
* IHDR 'the header (must be 1st chunk)
* PLTE 'palette
* IDAT 'image (multiple IDAT chunks used to support streaming)
* IEND 'marks the Image End.
'Selected ancillary Chunk Names:
* pHYs 'holds the intended pixel size and/or aspect ratio of the image
* tRNS 'transparency info. For truecolor/greyscale images, it stores transparent pixel value
'gbs_00419
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm