[Image-SIG] BUG: convert to greyscale errors

Oliver Tonnhofer olt at bogosoft.com
Wed Mar 28 07:57:14 CEST 2012


Hi,

On 21.03.2012, at 01:33, David Austin wrote:
> I've found an incorrect dependency upon neighbouring pixels in conversion to 
> greyscale.  Running this simple script (against attached images):
> 
> import Image
> im1 = Image.open('a.png')
> im2 = Image.open('b.png')
> pt = (301, 72)
> print "Before", im1.getpixel(pt), im2.getpixel(pt)
> im1 = im1.convert("P")
> im2 = im2.convert("P")

This will convert the image to a paletted image.

> Before (63, 73, 50) (63, 73, 50)
> After 60 59

And this is not the gray-value but an index to the color palette. This palette will look different if the images differ.



More information about the Image-SIG mailing list