Data Compression


Criteria

Survey Formats

Basics

Compression Methods

Data Formats


Run Length Encoding

General Principle

Control Characters

RLE for Image Data

Implementations

MS-Windows .bmp RLE8

Encoded Mode

Absolute Mode

Marker

Example "B"

"B" uncompressed

MS-Windows .bmp RLE4


Glossary

Index


Download


www.BinaryEssence.com

Example "B" compressed according to RLE8


The image following is compressed according to the 8 bit RLE as specified for Microsoft bitmaps. The encoding process is separated line by line using corresponding markers (in red). The data block is terminated by the "end of bitmap" marker.


The exemplary coding contains neither header data nor colour tables. According to Microsoft's conventions the coding starts with the last line (14) as listed at "encoded data".


Coding according to Microsoft 8 bit RLE



Encoded data:


 14.  0F FF  00 00
 13.  02 FF  09 00  04 FF  00 00
 12.  04 FF  03 00  03 FF  02 00  03 FF  00 00
 11.  04 FF  03 00  04 FF  02 00  02 FF  00 00
 10.  04 FF  03 00  04 FF  02 00  02 FF  00 00
  9.  04 FF  03 00  04 FF  02 00  02 FF  00 00
  8.  04 FF  03 00  03 FF  02 00  03 FF  00 00
  7.  04 FF  03 00  01 FF  03 00  04 FF  00 00
  6.  04 FF  03 00  01 FF  03 00  04 FF  00 00
  5.  04 FF  03 00  03 FF  02 00  03 FF  00 00
  4.  04 FF  03 00  04 FF  02 00  02 FF  00 00
  3.  04 FF  03 00  04 FF  02 00  02 FF  00 00
  2.  04 FF  03 00  03 FF  03 00  02 FF  00 00
  1.  02 FF  0A 00  03 FF  00 00
  0.  0F FF  00 00  00 01

The data part of an identical, uncompressed Microsoft bitmap would consist of 15 lines each with 16 pixels. The additional pixel is added due to Microsoft's specification and will not be used. Accordingly the exemplary data require a volume of 300 Byte for the contents of the image.


Instead the run length encoding above mentioned requires 162 byte. Technical drawings, diagrams or sketches providing a comparable type of contents achieve a clearly better compression, because their resolution is typically higher.


 <   ^   > 

MS-Windows .bmp RLE8 Marker B uncompressed