8-bit Grayscale BMP

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
compmaniac

8-bit Grayscale BMP

Post by compmaniac »

I have two 8-bit grayscale bmps.

I want to composite one over the other, and still maintain the 8-bit and grayscale (in bmp format)

How would I maintain the grayscale and 8-bit, or if that's not possible, could somebody tell me how to convert an RGB 24-bit bmp to grayscale 8-bit? Thanks.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: 8-bit Grayscale BMP

Post by anthony »

See IM Examples, Misc Formats, BMP
http://www.imagemagick.org/Usage/formats/#bmp

Basically make sure your image is 8bit index compatible (eg less that 256 colors)
by using a "-colors 256" operation.

If BM is GIF-like with transparency handling (I don't know for BMP) you may need

Code: Select all

-quantize transparent   -colors 254   -channel A   -threshold 50%

instead.

This is actually what IM does automatically for GIF with thransparency, it just has other options with BMP, so you may need to DIY.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
compmaniac

Re: 8-bit Grayscale BMP

Post by compmaniac »

Thanks, but after the -colors 256 operation on a 192kb file, the file is now around 3kb ish...

Am I supposed to type the following command to get it back to 65kb?

convert test.bmp bmp3:test.bmp

?

Sorry if I'm not doing it correctly.

I need to get an 8-bit file (around 65kb) from a 24-bit, regular grayscale BMP ( around 192kb)

I'm using 256x256 images.
Post Reply