fill the palette when converting to 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
goolmoos
Posts: 1
Joined: 2019-04-06T06:47:40-07:00
Authentication code: 1152

fill the palette when converting to bmp

Post by goolmoos »

I am trying to convert a png image with 4 unique colors to a bmp3 with a 256 color palette.
I am using this command:

Code: Select all

convert image.png -type palette -depth 8 -compress none BMP3:image.bmp
and getting this error:

Code: Select all

convert: bKGD: invalid `image.png' @ warning/png.c/MagickPNGWarningHandler/1747.
the image is converted, and the resulting image looks exactly like the original. However, when I use identify on image.bmp I can see that the depth is 4/8-bit and not 8-bit and that the colormap contains only 16 color(the 4 colors of the image and 12 times black) instead of 256 colors(depth 8).
I want the resulting colormap to contain 256 colors(the 4 of the image and 252 more). how do I do that?

Version: ImageMagick 7.0.8-37 Q16 x64 2019-04-03 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2018 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Visual C++: 180040629
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib cairo flif freetype gslib heic jng jp2 jpeg lcms lqr lzma openexr pangocairo png ps raw rsvg tiff webp xml zlib
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: fill the palette when converting to bmp

Post by snibgo »

If the image contains only 16 colours, you can't tell IM to make a larger palette.
snibgo's IM pages: im.snibgo.com
Post Reply