PNG
Portable Network Graphics (PNG) was created in 1996 as an open-source alternative to JPEG and GIF. It supports 24-bit true color, grayscale, and 8-bit transparency.
PNG is one of the graphics formats used in BD-J and most developers
use PNG for its better lossless
compression without losing the quality of complex images and fast
loading times. It's primary used for interactive graphics, buttons,
sprites, fonts, backgrounds, and decorations. It is faster than JPEG
if 8-bit color is used. If a developer wishes to converse memory and
increase performance, they should implement 8-bit color and use
optimization software (e.g. PNG crush) to compress the images to get rid
of unnecessary data chunks.
Unlike GIF, PNG officially
supports only still graphics, not animation. The Blu-ray standard does
not officially support animated PNG formats such as APNG and MNG. So,
alternatively, animated PNG images are put together using Java or a
combination of XML and Java. The reason why developers don't often use GIF is because it runs slower and it is not mandatory.
Graphics are often grouped together in a single PNG image (image mosaic) and the Java Xlet puts them together. Typically, it's faster to load one big image rather than several small images.
A PNG with 256 colors, which is only 269 bytes large with pre-filter. The same image as a GIF would be more than twelve times larger. |
An image mosiac from the 2011 BD edtion of Hugo's menu. |
A PNG file consists of an 8-byte signature, followed by a sequence of chunks. Each chunk has an 8-byte header containing a 4-byte chunk length, and a 4-byte chunk type code. Each chunk also has a 4-byte trailer containing a checksum.
A standard PNG file also has ASCII "IHDR
" at offset 12.
Values (Hex) | Purpose |
---|---|
89 |
Has the high bit set to detect transmission systems that do not support 8-bit data and to reduce the chance that a text file is mistakenly interpreted as a PNG, or vice versa. |
50 4E 47 |
In ASCII, the letters PNG, allowing a person to identify the format easily if it is viewed in a text editor. |
0D 0A |
A DOS-style line ending (CRLF) to detect DOS-Unix line ending conversion of the data. |
1A |
A byte that stops display of the file under DOS when the command type has been used—the end-of-file character. |
0A |
A Unix-style line ending (LF) to detect Unix-DOS line ending conversion. |
89 50 4E 47 0D 0A 1A 0A PNG signature |
IHDR Image header |
IDAT Image data |
IEND Image end |
Hex | As characters |
---|---|
89 50 4E 47 0D 0A 1A 0A 00 00 00 0D 49 48 44 52 |
.PNG........IHDR |
Offset into chunk | Hex Value | Decimal Value | Text | Meaning |
---|---|---|---|---|
0 | 0x0D | 13 | IHDR chunk has 13 bytes of content | |
4 | 0x49484452 | IHDR | Identifies a Header chunk | |
8 | 0x01 | 1 | Image is 1 pixel wide | |
12 | 0x01 | 1 | Image is 1 pixel high | |
16 | 0x08 | 8 | 8 bits per pixel (per channel) | |
17 | 0x02 | 2 | Color type 2 (RGB/truecolor) | |
18 | 0x00 | 0 | Compression method 0 (only accepted value) | |
19 | 0x00 | 0 | Filter method 0 (only accepted value) | |
20 | 0x00 | 0 | Not interlaced | |
21 | 0x907753DE | CRC of chunk's type and content (but not length) |
Offset into chunk | Hex Value | Meaning |
---|---|---|
0 | 0x0C | IDAT chunk has 12 bytes of content |
4 | 0x49444154 | Identifies a Data chunk |
8 | 0x08 | DEFLATE compression method using a 256-byte window |
9 | 0xD7 | ZLIB FCHECK value, no dictionary used, maximum compression algorithm |
10 | 0x63F8CFC00000 | A compressed DEFLATE block using the static Huffman code that decodes to 0x00 0xFF 0x00 0x00 |
16 | 0x03010100 | The ZLIB check value: the Adler32 checksum of the uncompressed data |
20 | 0x18DD8DB0 | CRC of chunk's type and content (but not length) |
Displayed in the fashion of hex editors, with on the left side byte values shown in hex format, and on the right side their equivalent characters from ISO-8859-1 with unrecognized and control characters replaced with periods. Additionally the PNG signature and individual chunks are marked with colors. Note they are easy to identify because of their human readable type names (in this example PNG, IHDR, IDAT, and IEND).
Advantages
Reasons to use this International Standard for graphics:
- Portability: Transmission is independent of the software and hardware platform.
- Completeness: it's possible to represent truecolor, indexed-color, and greyscale images.
- Coding and decoding in series: allows to generate and read data streams in series, that is, the format of the data stream is used for the generation and visualization of images at the moment through serial communication.
- Progressive presentation: to be able to transmit data flows that are initially an approximation of the entire image and progressively they improve as the data flow is received.
- Soundness to transmission errors: detects the transmission errors of the data stream correctly.
- Losslessness: No loss: filtering and compression preserve all information.
- Efficiency: any progressive image presentation, compression and filtering seeks efficient decoding and presentation.
- Compression: images can be compressed efficiently and consistently.
- Easiness: the implementation of the standard is easy.
- Interchangeability: any PNG decoder that follows the standards can read all PNG data streams.
- Flexibility: allows future extensions and private additions without affecting the previous point.
- Freedom of legal restrictions: the algorithms used are free and accessible.
Specifications
- W3C PNG specification (latest version)
- Specific versions: 1996-10-01 · 2003-05-20 · 2003-11-10
- RFC 2083: PNG Specification Version 1.0
- ISO/IEC 15948:2004 (not free to download)
Software
- libpng and zlib
- pngcheck: official PNG tester and debugger
- TweakPNG: low-level utility for examining and modifying PNG image files
- LodePNG
- libspng
- Bad Peggy: scans images for problems
- PNGtools: low-level manipulation of PNG structure
- PNGThermal: indicates compression cost per pixel
- Konvertor
Author(s) : Æ Firestone
Popular Pages
-
Type Programming /scripting language Paradigm Multi-paradigm: event-driven, functional, imperative, procedural, object-orie...
-
HDMV (High Definition Movie) mode is an interactive framework with the well-known features of DVD, but it's more advanced than DVD m...
-
MPEG-2 Transport Stream Type of format Container format for video, audio, data First released August 2004 Latest relea...