[Image-SIG] PIL 1.0 palette

Jeff Blaine jblaine@shore.net
Thu, 30 Dec 1999 13:29:31 -0500 (EST)


Hi folks,

I've gotten up to speed so far to do everything I want (make pie charts)
with PIL.  Yay!

However, my charts are very drab from using the default palette for mode
"P" (I am writing GIFs).

I have read through the PIL 1.0 handbook and cannot figure out how to
change my palette properly.

If I do:

  im = Image.new("P", (ImageWidth, ImageHeight))
  im.palette = ImagePalette.ImagePalette("RGB")

I get:

    File "/jblaine/mylocal/lib/python15/Image.py", line 375, in load
      if self.im and self.palette and self.palette.rawmode:
  AttributeError: rawmode

and aside from that, I can't figure out how to just get a "simple"
"rainbow" palette (wow, I'm pretty imaging-lingo savvy, eh?).

Maybe I can kill 2 birds with one stone here and also mention that I
want "Black" to be transparent in my output images."

Anyone have any pointers or code I can look at?  PIL comes with no
demos that perform ImageDraw.* things that I can find.

Thanks for your time