Page 1 of 1

[solved] from PNG til 1bpp BMP in one step ?

Posted: 2012-07-12T05:00:53-07:00
by myicq
I need to create a 1bpp BMP image, plain and simple.

My source for test is a PNG as exported by InkScape.

I think I tried every single combination of -type bilevel, -depth 2 etc etc - but always I get returned a 24 bpp image.

I have put sample files here: http://ge.tt/5Ob8ZOK/v/0

What I need is to go from drawing.png to drawing.bmp, but have the result be like drawing2.bmp

A diff with identify:
drawing.txt: Depth:8/1-bit 0..255 color 2.348 MB
drawing2.txt Depth: 1-bit 0..1 color 98 KB

it works if I do an additional
convert -threshold 2 drawing.bmp drawing2.bmp

but it's an extra step.

I use WinXP ImageMagick 6.7.6-5 Q16

Feel free to use my sample files to test.

Thanks !

Re: from PNG til 1bpp BMP in one step ?

Posted: 2012-07-12T10:07:20-07:00
by fmw42
You need to look more closely at the verbose info. Your file has an alpha channel. Turn it off.

convert drawing.png -alpha off drawing.bmp

If that does not work, then try using BMP3:drawing.bmp or BMP2:drawing.bmp

convert drawing.png -alpha off -depth 1 -type bilevel BMP3:drawing.bmp

But I get the same result as the first.

As far as I know the result will always be palette, 8/1 bit. I do not know if IM supports a bilevel BMP.

however, see
http://www.imagemagick.org/Usage/formats/#bmp and the part about using ppm and pnmdepth

[solved] Re: from PNG til 1bpp BMP in one step ?

Posted: 2012-07-13T00:28:03-07:00
by myicq

Code: Select all

c:\im\convert drawing.png -type bilevel -colors 256 drawing.bmp
This did the trick. The -colors 256 is from the section on BMP linked to here.

Thanks for all help :)