PIL 1.0 and palettes with ImageDraw
Jeff Blaine
jblaine at shell2.shore.net
Tue Jan 4 13:16:51 EST 2000
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...please hold off on the PNG spiel).
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
More information about the Python-list
mailing list