ImageGear for .NET User Guide > ImageGear Imaging Formats Reference > ImageGear Supported Compressions Reference > RLE Compression |
Full Name | Run length encoding compression |
Compression ID | ImGearCompressions.RLE = 7 |
ImageGear Assembly | ImageGear21.Core Assembly |
Bit Depth | 1, 4, 8, 16 bpc |
File Formats | BMP, CLP, CUT, DCX, DICOM, GEM, IFF, MSP, PCX, Adobe PDF, Adobe PS, RAS, SGI, TGA, WPG |
IG Platforms Support | WIN32, WIN64, Unix, Unix64, .NET, .NET64, Silverlight, MAC |
RLE (Run Length Encoding) is normally a 1-dimensional compression scheme. Working sequentially from left to right and top to bottom, it compares the value of each byte with the value of the previous byte. Each data value is recorded into a "packet" of two bytes where the first byte contains the number of times the value is repeated, and the second packet contains the actual value. The bytes in the pocket are called the "run count" and the "run value". When an image contains many repeat values, the compression ratio is very high (for example, if every byte in a 100 byte image were the same, its size could be reduced to 2 bytes giving a 50:1 ratio). A very noisy image, or a plain ASCII text file typically does not compress well, and in fact could become larger for example, if all bytes in image are different from the ones next to them, the image doubles, because 2 bytes are used to store each byte in the image.