[Image-SIG] BUG: convert to greyscale errors

David Austin david at d-austin.net
Wed Mar 21 01:33:48 CET 2012


Hi all,

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")
print "After", im1.getpixel(pt), im2.getpixel(pt)

Gives:

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

i.e. before conversion the RGB values are identical, after the greyscale
values are not.

Regards,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/image-sig/attachments/20120321/58a8841f/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: a.png
Type: image/png
Size: 198097 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/image-sig/attachments/20120321/58a8841f/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: b.png
Type: image/png
Size: 198078 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/image-sig/attachments/20120321/58a8841f/attachment-0003.png>


More information about the Image-SIG mailing list