[Image-SIG] Cannot Load Pixel Information From PNG Image

Karol Krizka kkrizka at gmail.com
Thu Jan 6 06:06:27 CET 2011


Hi there,

I have a PNG file for which PIL 1.1.7 cannot seem to load the pixel
values. It returns an integer for all of them instead of a touple. The
script that I use to test this is very simple:

import Image
im=Image.open('house.png')
print im
data=im.load()
print data
print data[149,136]

The output of it is:
<PngImagePlugin.PngImageFile image mode=L size=300x200 at 0x800DD0>
<PixelAccess object at 0x641150>
97

I should note that the point (149,136) contains a pixel of colour
(97,97,97). However when I change the colour at that point to
(128,0,1), I get a value of 160.

The PNG image was created by converting a PPM file (which PIL has no
trouble reading) using ImageMagick's convert utility. PIL has no
trouble reading other images created using the same method. My image
viewing programs (xv, gwenview) have no trouble opening this
problematic PNG file. I've attached the image to this email.

The PIL version that I used is 1.1.7. It is the one in Gentoo Linux
repositories. I also tried it with PIL that comes with Ubuntu Maverick
10.10 with the same results.


-- 
Cheers,
Karol Krizka
http://www.krizka.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: house.png
Type: image/png
Size: 2489 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/image-sig/attachments/20110105/9ce1047a/attachment.png>


More information about the Image-SIG mailing list