Un-RLE transparent index in 8bit BMP

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
User avatar
Sam.
Posts: 6
Joined: 2012-02-10T18:26:10-07:00
Authentication code: 8675308
Location: USA

Un-RLE transparent index in 8bit BMP

Post by Sam. » 2012-05-06T20:05:30-07:00

I am writing a program to convert an image from a game format into a regular 8-bit/256 color bitmap (BMP). The image data I read from the game format is in standard 8-bit data format, except the entries (into the palette) that are the color that the game treats as the background color (usually the 1st entry in the palette) are run-length-encoded. These are the ONLY entries in the frame data that are encoded. Basically, any byte which is not the transparent index (to the background color) represents itself. The transparent index followed by a byte x represents (x+1) copies of the transparent index. Is it possible to un-RLE the transparent index with IM? I will be happy to provide an example if that would help clarify what I am trying to do.

Note that I use the command-line/binary version of ImageMagick.

TIA,
Sam.

Post Reply