[Image-SIG] Converting from 24-bit RGB to Black&White

Alexander Belchenko bialix at ukr.net
Thu Mar 2 23:03:20 CET 2006

Fredrik Lundh пишет:
> Alexander Belchenko wrote:
>>PIL-Handbook.pdf (for version PIL 1.1.3) description of method
>>"im.convert(mode) => image" claims:
>>"When translating a greyscale image into a bilevel image (mode "1"), all
>>non-zero values are set to 255 (white). To use other thresholds, use the
>>point method."
> the 1.1.3 handbook is incorrect.  here's the corresponding text from the
> draft docs:
>     "When converting to a bilevel image (mode "1"), the source image is
>     first converted to black and white. Resulting values larger than 127
>     are then set to white, and the image is dithered. To use other
>     thresholds, use the point method."
>     (from http://www.effbot.org/imagingbook/image.htm )

I don't understand why solid green color (#00FF00) converted as mix of 
black and white dots (you can see this in my out1.bmp). Is this result 
of dithering? And why paletted image works as described in 1.1.3 manual?

At the ned, I need behaviour that obtains with paletted image, so I 
simply convert 'RGB' first to 'P' then to '1'. This behaviour will not 
breaking in future releases?


More information about the Image-SIG mailing list