Can't write real Bilevel png or bmp images

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
mhoehn@hotmail.de
Posts: 5
Joined: 2010-02-08T06:47:10-07:00
Authentication code: 8675309

Can't write real Bilevel png or bmp images

Post by mhoehn@hotmail.de »

I can't write real Bilevel png or bmp images.
They always appear as RGB images using identify -verbose.
Is this a limitation of those image formats or am I doing something wrong?
Here is one convert example:
convert -density 600 test.tif -profile AdobeRGB1998.icc -strip -type TrueColor -background white -resize 367x367 -colorspace Gray -ordered-dither checks -define png:bit-depth=1 test.png

Even a "convert test.png -type Bilevel test.bmp" after above example writes an RGB image .

How can I really create Bilevel formats and not RGB simulated ones?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Can't write real Bilevel png or bmp images

Post by fmw42 »

Have you tried -type bilevel or use -monochrome?

This works for me on IM 6.6.9.7 Q16 Mac OSX Tiger for both png and bmp.

convert logo: -type bilevel logo_tmp1.png
freds-mac-mini:~ fred$ idv logo_tmp1.png
Image: logo_tmp1.png
Format: PNG (Portable Network Graphics)
Class: PseudoClass
Geometry: 640x480+0+0
Resolution: 72x72
Print size: 8.88889x6.66667
Units: Undefined
Type: Bilevel
Base type: Bilevel
Endianess: Undefined
Colorspace: Gray
Depth: 8/1-bit
Channel depth:
gray: 1-bit
Channel statistics:
Gray:
min: 0 (0)
max: 255 (1)
mean: 222.145 (0.871156)
standard deviation: 85.432 (0.335028)
kurtosis: 2.9092
skewness: -2.21567
Histogram:
39581: ( 0, 0, 0) #000000 black
267619: (255,255,255) #FFFFFF white
Colormap: 2
0: ( 0, 0, 0) #000000 black
1: (255,255,255) #FFFFFF white



Note that PNG has been under development for some time and you may have a version with bugs. You don't say what version and platform you are using?

Please read viewtopic.php?f=1&t=9620
Post Reply