Convert image to 8-bit BMP with a predefined palette

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
rling
Posts: 7
Joined: 2007-10-07T16:21:15-07:00

Convert image to 8-bit BMP with a predefined palette

Post by rling »

Hi all!

I need to convert images to 8-bit BMPs with one byte per pixel and a palette.
The palettes in the output BMPs must have exactly 256 entries (even if some are unused).
The entries must be the grayscale levels 0..255 in increasing order. That is, index 0 is RGB triple (0,0,0) etc.

So far I've tried (in various combinations): -type Grayscale, -type Palette, -depth 8, -colors 256.
I can get a paletted bitmap easily, but I can't force it to use the exact palette I described: the
number of colours in the palette is always reduced to only those that are used by pixels.

I notice there is a -remap option which is not in my version (6.3.6).
Will -remap do what I need, given a BMP with the correct palette as its parameter?
If so I would have to upgrade.... but upgrading has implications, so if -remap won't help, I prefer not to.

Thanks!!
R
Post Reply