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

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
selma
Posts: 2
Joined: 2018-10-01T17:54:45-07:00
Authentication code: 1152

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

Post 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!
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

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

Post 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.
snibgo's IM pages: im.snibgo.com
selma
Posts: 2
Joined: 2018-10-01T17:54:45-07:00
Authentication code: 1152

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

Post 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.
Post Reply