[IMAGE-SIG] Palettes and current version

David Walton david@alphagene.com
Tue, 04 Nov 1997 08:33:22 -0500


I'm a bit of a newbie to imaging, and have a couple of questions
regarding PIL.  First off, I'm curious what the current version
for Unix is.  0.2b4 is the version I found on the Image-sig
page, but that version seems quite out dated (February?), and
I've seen mention in the Image-sig archive of versions .3b1 and

My second question is in regards to palettes.

I'm trying to draw an image based on data that we've collected.
It's been requested that I produce a tiff image of the data
using false colors, because someone wants an image with raw
data and a broad spectrum of color to work with.

With that said, I've created an instance of the Image object.
Initially I tried creating the image as 

However, when I attempted to draw rectangles of various colors onto
this image, I got an error:
    self.im.draw_rectangle(xy, self.ink, self.fill)
ValueError: PIL: images do not match

After looking into the documentation, I realized that I needed
to define my image with a palette to use the rectangle method.
I redefined my image using 'P' instead of 'RGB', and then attempted
to create image.palette using ImagePalette.ImagePalette('RGB').

When I try to now create an instance of the ImageDraw class, I
get an error:
    self.im.putpalette(self.palette.rawmode, self.palette.data)
AttributeError: rawmode

After looking at the ImagePalette.py library, I discovered there
is no rawmode attribute.  Interestingly enough, there is a raw
class in that same library which has a rawmode attribute.

I can't find anything in the documentation, in the script examples
or in the Image-sig mailing list archive that addresses this.

Any help anyone can provide me would be very much appreciated.

Thank you,

Dave Walton
Scientific Software Engineer
AlphaGene, Inc.

IMAGE-SIG - SIG on Image Processing with Python

send messages to: image-sig@python.org
administrivia to: image-sig-request@python.org