How do I compress an image with Run-Length Encoding using C#? Are there any available libraries to support this?
Does Run-Length Encoding only work on bitmapped images? If so, How will I convert image types to bitmap using C#?
I'd also like to ask what's their resulting file type after this, will they retain their file type or will they have a new one?
To compress an image I have written some function: This will resize the width and determine the height by aspect ratio. Note that if the original width of the image is less than the new width then the image is not sized (you can definitely change that in the code).
If you look around you will find quite a few resources...
Run length encoding works on just about any type of data in the form of a string.
But here is an example from Rosetta Code:
You will have to suit this to your needs but it should get you started.
I know this is an old question, but it is one of the few things that comes up for RLE compression in C# on Google search. For someone like me, who has no experience with image processing at all, this was a very frustrating experience, so hopefully this answer will save some others pain in the future.
I understand that RLE is an out-dated form of compression, but some of us are stuck with constraints (such as exporting a bmp to a custom device) that require us to use it. The following requires an 8bpp indexed bitmap in order to work. If you need help converting an image to that format, there are a good number of resources online to help out.
I put this inside a class called BmpCompressor.
Hope this helps!