Page 1 of 1

Un-RLE transparent index in 8bit BMP

Posted: 2012-05-06T20:05:30-07:00
by Sam.
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.