Page 1 of 1

convert -type Bilevel broken

Posted: 2011-02-01T15:13:50-07:00
by bill_h
Hi all.

I was happily 'convert'ing on Ubuntu 10.04 using the built in version of ImageMagick, 6.5.7.8-1ubuntu1.1.

After I upgraded to Ubuntu 10.10 with ImageMagick 6.6.2.6-1ubuntu1.1 "convert -type Bilevel" started mangling my images. Essentially the image gets squished to the left, and a large black bar is on the right side of the image.

I thought this might just be an issue with Ubuntu but the same behavior occurs on Arch Linux with ImageMagick 6.6.4.10-1.

My usual invocation of the command is "convert -type Bilevel file.jpg file.png"

I did notice a difference in the 'identify' output for the old and new versions of ImageMagick.

Original image: SCAN0165.JPG JPEG 944x1616 944x1616+0+0 8-bit DirectClass 193KiB 0.000u 0:00.000
After convert on old/working ImageMagick: SCAN0165-1.png PNG 944x1616 944x1616+0+0 8-bit PseudoClass 256c 25.1KiB 0.040u 0
After convert on new/broken ImageMagick: SCAN0165.png PNG 944x1616 944x1616+0+0 8-bit DirectClass 32.6KiB 0.050u 0:00.050

Here is an example of working and broken output using the rose image on the ImageMagick convert "example usage" web page:

ImageMagick command: "convert -type Bilevel rose.jpg rose.png"

Original Image identify: rose.jpg JPEG 70x46 70x46+0+0 8-bit DirectClass 3.97KiB 0.000u 0:00.000
Orignal Image base64 encode:

/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEB
AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEB
AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wAARCAAuAEYDASIA
AhEBAxEB/8QAHQAAAQUBAQEBAAAAAAAAAAAACQAGBwgKBQQDC//EAC4QAAEEAQMEAQQBBAMBAAAA
AAMBAgQFBgcREggTFCEACRUiMUEXI1FhJDJDUv/EABsBAAICAwEAAAAAAAAAAAAAAAcIBAYDBQkK
/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vXJzWc3e9ne0VSsfVJ+mJM+nlc6bc9Y4erlHqybLlqe5ghMMtseDjLaQnCwUWV5FDtSS0uUGpYyV
jB+Mr+y/v8BCsxyjjyLWO8LWFDBeebehlJw7lOJ0Tb7SQTSEZbIiTGt8lzYaI4HLn+fHUDhKimFN
mur3VaepbUqDWUx1lcmuCCd6gZICYM/E7+I/NFmvXivUoNr47N5d2PyLYkqSiyAqvlE6W5ybUoQJ
anZGwZP7T9Z+RnuR9Y8XwLA4FaYJbTI7eAY9hj6ChKwDJxjPX7v91jSogPuEZ6OQJYh5XiGYYYmb
AejD0OzAbeofSa6ra2DX183KYVBX1sKKGLBpYs9h61K8rRu4sJHDLNIWeYjny07kkpVKr/keap18
rIM6ya/uJall5BaSLJXgb20BGdxFBiNCrVaxsKAKNCG1r3N7cdq8t1VfkajobioOOxp7RBr3mbMI
SRGIjlTi1ELFRVRE3VvJqNe1qqrFaq/L/WwFJ2OYoCmPeUmVzme8DI2EkJaCJgAkJYfQuslGy3Mw
RdlF5ryTI8syr7t+fFqqVCvU7kxdepMlIj23MG0jOXOZ12ZaWPRQrADrZ1q/Tze/MZPjDo661dT1
LiFYgOHCURZTlTdhJVr46y3ERVXxxAE38BN+L4JfN5GWphYMXsLIDhV2SV05ZEeQd0jvFoJIgxVl
Oix3So0YKkQRSgAZVejSNere4q+VLH8Bx0VQgrhxqZgYAD69I1Az86+Sj7T8Rrcx+/2I04Kv0jbt
/wCJiJ1MfXU/cJKJ3r9z/wC63+f/2Q==

After convert on old/working ImageMagick: rose1.png PNG 70x46 70x46+0+0 8-bit PseudoClass 256c 641b 0.000u 0:00.000
rose1.png base64 encode:
iVBORw0KGgoAAAANSUhEUgAAAEYAAAAuCAAAAACw4jBvAAAACXBIWXMAAAsSAAALEgHS3X78AAAA
CXZwQWcAAABGAAAALgDH1F1UAAABc0lEQVRIx62WAQ7DIAwD+f+nb1ILxQmmhXbdtEkVGOMkTkq5
fzi+3x/+tOZPALcr4R0ZRiDYx0l7Dgz2ueTI7ZKh4eTTX6TEidIJUK+1mnnHej0VuRObuUXlc76j
gayKXDcSle4wSmfODf3n/HADc7GL5+bLUapSMxjkQInyJUXnPYUp4RUpIjlAlfyUTUhUss5EARwb
VUJVGitgUBgTFJKY6gk1CSVcjk1K3ABgC73RmtoAmijOrugiDebREmK4kRRCr0cYapOSSlcVRmVG
88CSuSJ+haeyH+DbqmxiHaYKHXf0nzGajkxwujXzCNna7+NrHb2thjvmutisLEw+bmw4OlFEyXWJ
u1Oq4rDWlUeqrKSgNzyca1n3cFbvmnNCwhorl619GS2YJYaElIW2Q/G9AB7OcU7nTvWWd9ePh1nl
Y5MnV9Wi8mMkpVOtDy3GoBpO92l2o1+0X2yOCmZUiTAvZkv4iDTF2IDhEWkVKw4Zb1B+QUnXRfYm
sjQAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTEtMDItMDFUMTc6MDU6MDgtMDU6MDBjsN1NAAAAJXRF
WHRkYXRlOm1vZGlmeQAyMDExLTAyLTAxVDE3OjA1OjA4LTA1OjAwEu1l8QAAABF0RVh0anBlZzpj
b2xvcnNwYWNlADIsdVWfAAAAIHRFWHRqcGVnOnNhbXBsaW5nLWZhY3RvcgAyeDIsMXgxLDF4MUn6
prQAAAAASUVORK5CYII=


After converting on new/broken ImageMagick: rose.png PNG 70x46 70x46+0+0 8-bit DirectClass 852b 0.000u 0:00.000
rose.png base64 encode:
iVBORw0KGgoAAAANSUhEUgAAAEYAAAAuCAIAAAAa6/jkAAAACXBIWXMAAAsSAAALEgHS3X78AAAA
CXZwQWcAAABGAAAALgDH1F1UAAACRklEQVRo3t2ZPU4DQQyFHUSzN+AIVBBBkxKRJkhUEHEaxGW4
BCWClkPkCNzgkdnMj+dnN6NUz+wQSMIq2U/PfmN7ReYPjD8dx8f3epj63/bpeXu3/+seu6/1cH4j
crZ0a//G1bjkcemWyMPSLZHrW7dEXlZuiWxWm9ViIfL5th5+33/iZ1/sH5fu+1/vB+k70HmOIaRe
YEtIszIB4Qy7KqGGAmwH3uH6MyDbKqFywCCSRSQEJhTBB9uOdyBCjD740LOCpGNsvHYtD1TcmbMH
FJAIqAhAI6uxwPMQyF0iIYEUqbDnhk5Bm5BSFpBituR6lAEI8ZllAQlKCOXcMXWSniaQUrJXwVa/
hBfVhEpZgYDSI5AHKbtKOnN0VtVVUOUOzCaOmDrppe4j/IarbI9dpaJgyGCajh/k4lVJ7U3QG1EL
HimpeJHGS0O08CzqVDGUalWo54RIkKLE1u4AbRHQ3h5EYt6XvEaBwUdYhRrOiu/QIQEJyZtEfvXp
V+2KtP1SVTpgejhUNE6MgZcKUUl9atvkQmORLJxWJaixgrroYobSGDt4mfiQCqKyZkUr7rIwJTXx
1uwRdaVXZJxw13jVFAX5yKvRDXpx+WcPaNTkaDbvvjWkQoL03kOaGsDSq6RsGh2jMEaVpmIOc5tt
lW1ESC012q3s3EyZuAUETrlPy7kvqbq1NV89Hnlkjodqkjc9ep3yCbZcUi0g9BPLgQc1mtSzLKNI
+a2iHElMIqEcIJ9Gxeh4+D9IOErVxUWmUn5j5TSleJD+ALT/Sk/TFsPJAAAAJXRFWHRkYXRlOmNy
ZWF0ZQAyMDExLTAyLTAxVDE2OjQ5OjUwLTA1OjAwb8zXxwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAx
MS0wMi0wMVQxNjo0OTozNy0wNTowMB1ZWHIAAAARdEVYdGpwZWc6Y29sb3JzcGFjZQAyLHVVnwAA
ACB0RVh0anBlZzpzYW1wbGluZy1mYWN0b3IAMngyLDF4MSwxeDFJ+qa0AAAAAElFTkSuQmCC


Thanks!

Re: convert -type Bilevel broken

Posted: 2011-02-01T15:59:27-07:00
by fmw42
the following works fine for me under IM 6.6.7.4 Q16 Mac OSX tiger:

convert rose: rose.jpg
convert rose.jpg -type bilevel rose.png

The correct syntax in this case is to put the input image right after convert, though it usually does not matter. See

http://www.imagemagick.org/Usage/basics/#cmdline


By the way, the PNG format has been under development and improvements over some releases now and may have had some changes for the worse temporarily under certain releases. Review the changelog at http://www.imagemagick.org/script/changelog.php

Re: convert -type Bilevel broken

Posted: 2011-02-01T19:38:53-07:00
by bill_h
fmw42, you're right on the money. I downloaded/compiled 6.6.7-4. That version of convert works again.

Re: convert -type Bilevel broken

Posted: 2011-02-02T00:36:43-07:00
by anthony
Normally it does not matter. But in this case -type is a operator that could be used for input as well as output. And that can confuse IM in what you are meant for it to do.