How to do RLE (run length encoding) in C# on a byte array?

Posted by CuriousCoder on Stack Overflow See other posts from Stack Overflow or by CuriousCoder
Published on 2009-12-19T11:38:05Z Indexed on 2010/05/19 0:20 UTC
Read the original article Hit count: 1507

Filed under:

I am trying to XOR two bitmap files (their byte arrays) to produce a byte array that can be used to change image A into image B or vice versa. I am sending this over the network so I would like to do some basic compression before this happens.

Is there a way to do RLE (run length encoding) in C# (using a built-in, or fast reliable 3rd party library) on a byte array for this purpose?

Notes:

  • If you are going to suggest an alternative to my approach please keep in mind that the decompression and transformation on the remote machine has to be as quick and efficient as possible.

© Stack Overflow or respective owner

Related posts about c#