Robert P. Poole Created 2026-10-13 Updated 2026-11-05
Robert P. Poole is credited as an author of the PNG specification, the shared technical description of a file format for raster images using lossless source coding.[ref]
Run-length encoding 2026-10-13
Run-length encoding replaces each maximal consecutive group of equal values, called a run, by its value and length. Decoding repeats each value the specified number of times. It is lossless source coding: no values are discarded. For a binary string, successive maximal runs alternate between 0 and 1, so storing the first bit and all run lengths is enough.
Take this raster image, with 0 black and 1 white, read left to right across each row and then top to bottom:Reading the whole image as one 64-bit binary string gives exactly seven runs:The lengths sum to . Repeating the alternating values for these lengths and splitting after every eighth pixel reconstructs every displayed row exactly.
00000000
00001111
11110000
00001111
11110000
00001111
11110000
00000000Here is a complete toy file format. Its file header is an eight-bit unsigned width, an eight-bit unsigned height, then a one-bit mode: 0 means raw pixels, 1 means run-length encoding. Fields are written most significant bit first; this profile accepts only width and height 8, so both decoders know to stop at 64 pixels. Raw mode contains 64 bits. RLE mode contains the initial bit, followed by seven-bit unsigned run lengths in the range 1 to 64. Zero and lengths above 64 are invalid; a decoder rejects a run that would exceed the remaining pixel count. It stops when the decoded lengths sum to 64, so no run-count field or end marker is needed.
For this image, the complete RLE serialization is:Spaces and vertical bars are explanatory separators, not stored characters. The seven-bit fields directly store the lengths; 64 would be
00001000 00001000 1 | 0 | 0001100 0001000 0001000 0001000 0001000 0001000 00011001000000. The payload costs bits, versus 64 raw bits. The 17-bit file header has the same size in either mode, giving complete sizes of 67 versus 81 bits. If packed into eight-bit units, append zero padding only at the end: the sizes become 72 versus 88 bits. These are sizes of this toy representation, not sizes of PNG files.The field design matters. Restarting RLE on every row costs eight initial bits plus four bits per run when lengths are stored directly: three bits represent only 0 through 7, whereas a row can have length 8. This pattern has row-run counts , totalling 14, so that payload costs bits, with no saving. Storing length minus one would instead fit lengths 1 through 8 into three bits, but is a different declared file format. An alternating flat 64-bit binary string has 64 runs and costs payload bits in our flat format; restarting each row costs payload bits. A one-run image costs only eight payload bits. These extremes explain when RLE is useful: long uninterrupted regions make short instructions, while frequent changes make instructions expensive.
Prefix codes of unequal lengths can replace fixed-width run lengths, provided the decoder knows the code and any necessary code description is counted. Run-length encoding names a technique, not one universal serialization. For a real implementation, Microsoft's bitmap documentation specifies
BI_RLE8 with count and value fields plus special commands, rather than our initial-bit convention.[ref]https://learn.microsoft.com/en-us/windows/win32/gdi/bitmap-compression. Microsoft, Bitmap Compression, BI_RLE8 encoded and absolute modes
Stuart Parmenter Created 2026-10-13 Updated 2026-11-05
Stuart Parmenter is credited as an author of the PNG specification, the shared technical description of a file format for raster images using lossless source coding.[ref]
SVG 2026-10-13
SVG, short for Scalable Vector Graphics, is a markup file format for two-dimensional graphics, specified by the W3C SVG Working Group. It describes vector graphics shapes, text and image objects, with grouping and transformations; it can therefore contain both geometric objects and raster images. The small command strings in vector graphics are path data within this format, not complete standalone documents.[ref]
https://www.w3.org/TR/SVG2/intro.html#AboutSVG. W3C SVG Working Group, SVG 2, section 1.1: scope, graphical objects and transformations
Tim Wegner Created 2026-10-13 Updated 2026-11-05
Tim Wegner is credited as an author of the PNG specification, the shared technical description of a file format for raster images using lossless source coding.[ref]
Tom Lane Created 2026-10-13 Updated 2026-11-05
Tom Lane is credited as an author and former editor of the PNG specification. This source identifies a role in the development and editorial history of the interoperable raster image file format.[ref]
Portable Network Graphics (PNG) Specification (Third Edition) by Mark Adler and others. front matter, Former editors and Authors
Willem van Schaik Created 2026-10-13 Updated 2026-11-05
Willem van Schaik is credited as an author of the PNG specification, the shared technical description of a file format for raster images using lossless source coding.[ref]
