Page 1 of 1

Bitmap has 4-bit-palette instead of 8-bit

Posted: 2018-10-01T18:28:29-07:00
by selma
Hi,

I'm trying to convert a 4-bit-Bitmap into an 8-bit-Bitmap. When I use the command

convert testimage.bmp -colors 256 -depth 8 -type Palette testimage2.bmp

the result is still a 4-Bit-Bitmap. Calling identify for both images returns

testimage.bmp BMP 1302x272 1302x272+0+0 4-bit sRGB 16c 178KB 0.000u 0:00.000
and
testimage2.bmp BMP 1302x272 1302x272+0+0 4-bit sRGB 16c 178KB 0.000u 0:00.000

What am I doing wrong?

This is the image I'm using: https://www.dropbox.com/s/xbhqdzcm9ikoc ... e.bmp?dl=0

I'm using ImageMagick 6.9.7-4 in a Shell on Ubuntu 18.04.

Thank you in advance for your help!

Re: Bitmap has 4-bit-palette instead of 8-bit

Posted: 2018-10-02T04:36:57-07:00
by snibgo
Don't use "identify" to find the structure of an image file, because identify will tell you the structure of the image after it has been decoded. Instead, use exiftool:

Code: Select all

f:\web\im>exiftool testimage.bmp

ExifTool Version Number         : 10.97
File Name                       : testimage.bmp
:
:
Bit Depth                       : 4
Num Colors                      : 16
Num Important Colors            : 16
I don't think there is a reliable method for telling IM to use a palette that is larger than it needs to be. The image has only 8 different colours, so IM uses a palette with 16 entries.

"-colors N" is a colour reduction method. If your image already has N or fewer colours, it has no effect.

Re: Bitmap has 4-bit-palette instead of 8-bit

Posted: 2018-10-02T04:43:30-07:00
by selma
Thank you very much for your answer and your comments! I will look for another tool to (always) get an 8-bit-Bitmap then.