[Image-SIG] problems with simple task.

Gregory Haley ghaley@venaca.com
Mon, 19 Jun 2000 16:56:34 -0400


hi folks,

i am having a problem running the simplest, and most
introductory script.  i am trying the generate a simple
rectange.  i've copied the scripts that have been posted to
this sig, and the one that is included in the PIL tutorial. 
it does not matter if i do this as a script or in the python
interpreter.  i was wondering if i am missing something
REALLY obvious, or if there is some sort of component to PIL
that i am missing:

a copy of the script:

import PIL
from PIL import _imaging, Image, ImageDraw
import re, os, string, sys
import cStringIO

size = 100
im = Image.new('RGB", (size, size))
draw = ImageDraw.ImageDraw(im)
bgcolor = (255, 0, 0)  #should be red background
fgcolor = (0, 0, 0)    #should be black border

im = draw.rectangle( [0,0, size, size], fill=bgcolor,
outline=fgcolor )

del draw

outFile = cStringIO.StringIO()
im.save(outFile, 'GIF')

the error i get is:

Traceback (innermost last):
  File './image1.py", line 25, in ? 
     im.save(outFile, 'GIF')
AttributeError: 'None' object has no attribute 'save'

i've tried to rewrite this using a file handle to open the
outfile, but the error is basically the same, which has to
do with the im.save call.  

any advice will be deeply appreciated.

ciao!
greg.

Gregory Haley
Venaca.com