The BMP RLE 8 Compression Algorithm


Original Documentation

--- BMP RLE_8 compression

		  The BMP can be compressed in two modes, absolute mode and RLE
		  mode. Both modes can occur anywhere in a single bitmap.

		  The RLE mode is a simple RLE mechanism, the first byte contains the
		  count, the second byte the pixel to be replicatet. If the count byte
		  is 0, the second byte is a special, like EOL or delta.

		  In absolute mode, the second byte contains the number of bytes to be
		  copied litteraly. Each absolute run must be word-aligned that means you
		  will may have to add an aditional padding byte which is not included
		  in the count. After an absolute run, RLE compression continues.

		  Second byte           Meaning

				 0              End of line
				 1              End of bitmap
				 2              Delta. The next two bytes are the horizontal
								and vertical offsets from the current position
								to the next pixel.
			 3-255              Switch to absolute mode


This information is from Corion.net and is used with permission.

More Resources