What is .png file?
Portable Network Graphic is a raster image. It was created by PNG Development Group in 1996.Images are compressed.
File extension is .png.
Software handling .png files
Rest7 Free Online ConverterStructure of .png images
The header is 8 byte long.Name | Type | Description |
---|---|---|
Magic | String[8] | #89 + "PNG" + #0D #0A #1A #0A |
Name | Type | Description |
---|---|---|
Length | UInt32 | |
Chunk Type | String[4] | For example "IHDR", "PLTE", "IDAT", "IEND" |
Chunk Data | UInt8[Length] | |
CRC-32 | UInt32 | Computed from Chunk Type and Chunk Data |
IHDR - The first chunk
Name | Type | Description |
---|---|---|
Width | UInt32 | |
Height | UInt32 | |
BPP | UInt8 | Bits per pixel. Possible values: 1- only grayscale or palette 2- only grayscale or palette 4- only grayscale or palette 8- every type 16- not for palette |
Color Type | UInt8 | Possible values: 0- grayscale 2- RGB 3- palette 4- grayscale + alpha 6- RGBA |
Compression | UInt8 | Possible values: 0- deflate |
Filter | UInt8 | Possible values: 0- adaptive filtering with five basic filter types |
Interlace | UInt8 | Possible values: 0- no interlace 1- Adam7 interlace |
PLTE - palette chunk
Number of entries is determined by chunk length divided by 3. Each entry is:Name | Type | Description |
---|---|---|
Red | UInt8 | |
Green | UInt8 | |
Blue | UInt8 |
IDAT - the image data chunk
Each scanline is prepended with UInt8 defining filter type.IEND - the last chunk
This chunk has no data, hence the Chunk Length is 0.Data types:
UInt8, UInt16, UInt32, UInt64 - Unsigned Integer 8 bit, 16 bit, 32 bit, 64 bit
Int8, Int16, Int32, Int64 - Signed Integer 8 bit, 16 bit, 32 bit, 64 bit
UMint16, UMint32 - Unsigned Motorola Integer 16 bit, 32 bit (Big Endian)
Char8, Char16 - Char 8 bit, 16 bit