Discussion:
Posterize operation silently fails on compressed greyscales
Paul Furley
2010-12-15 11:14:55 UTC
Permalink
Good morning all,

Firstly, I'd like to say a huge thank you for your efforts in developing
ImageMagick which really is a fantastic tool.

I've been chasing a bug to do with posterize and compression which you will
hopefully be able to reproduce with the following commands. Basically, when
using -dither FloydSteinberg, on a greyscale TIF file, posterize behaves
differently depending if the input file is compressed or not. If the input
file has JPEG compression, posterize appears to be number crunching but the
output histogram reveals that there are still 256 colours.

convert rose: -channel Red -separate -compress None red_uncompressed.tif
convert red_uncompressed.tif -dither FloydSteinberg -posterize 8
red_uncompressed_8levels.tif
identify -verbose red_uncompressed_8levels.tif >
red_uncompressed_8levels.txt

convert rose: -channel Red -separate -compress JPEG red_compressed.tif
convert red_compressed.tif -dither FloydSteinberg -posterize 8
red_compressed_8levels.tif
identify -verbose red_compressed_8levels.tif > red_compressed_8levels.txt

I've attached the output of identify -verbose for both files. You can see
that the histogram for the compressed input file contains only 8 greyscales
whereas the uncompressed version contains the whole lot.

I originally found this because I am using 'convert RGB.jpg -profile
rgb-profile.icc -profile cmyk-profile.icc CMYK.tif' then 'convert -channel
Cyan -separate Cyan.tif' for each channel. The compression in RGB.jpg was
passed on by ImageMagick to the separation greyscale.

My version is ImageMagick 6.6.2-6 2010-12-02 Q16 running on Ubuntu 10.10.

Thanks in advance, and keep up the great work.

Paul M Furley

Loading...