[Image-SIG] Color problems with larger images

Eric O'Donnell svvampy at gmail.com
Fri Jul 11 03:00:33 CEST 2008

I'm actually using PIL to create a DIB that I draw to a printer device
context to print an image.

I get the same colour distortion on the print.

I've had a further look at the palette. When I call the query_palette*
method on the ImageWindow dib, the return value is -1, indicating that
the image needs to be redrawn. My attempts to do this have not borne
w = ImageWin.ImageWindow(im)
print w.image.query_palette(w.hwnd)  # returns -1
print w.image.query_palette(w.hwnd) # still returns -1
#end code

Is there some way to force an adaptive color palette when I open the
image? Converting the image afterwards does not seem to change things.

*documented as dib.palette() in the latest(?) documentation,


2008/7/10 Florian Höch <lists+Image_SIG at hoech.org>:
> Yes, I can reproduce this using your example. Seems to happen only to images
> larger than real screen estate and looks like some kind of "palettization"
> (is that even a word?) error. But I think it's only a problem of ImageWin,
> not PIL in general. If you want to simply display the image, maybe im.show()
> is an option which will use the default image viewer of the OS?
> Regards,
> Florian Höch
> Eric O'Donnell schrieb:
>> Hi,
>> I'm getting some weird colour artifacts when I open larger images with
>> PIL. Can't seem to find anything relevant in the archives.
>> The code to replicate is pretty simple so I should just post that.
>> #begin code block
>> from PIL import Image, ImageWin
>> filename = "Sumida_river05s3200.jpg"
>> #http://upload.wikimedia.org/wikipedia/commons/c/c7/Sumida_river05s3200.jpg
>> im = Image.open(filename)
>> im.load()
>> print im.mode
>> w = ImageWin.ImageWindow(im)
>> w.mainloop()
>> #end code block
>> The image is about 1.7 megabytes.
>> I'm using PIL 1.1.6 with Python 2.5 on WindowsXP.
>> If I shrink the image to half size in the GIMP, the colour distortion
>> decreases. Shrink the original to a quarter size and the artifacts
>> disappear. I thought this might be associated with CMYK problems from
>> the archives, but none of the patches in the list changed the
>> behavior, although they did fix the CMYK images linked. The image
>> looks normal with other viewers.
>> Any advice would be greatly appreciated.
>> Thanks,
>> Eric.

More information about the Image-SIG mailing list