[PYTHON IMAGE-SIG] Basic PIL problems

Ralph Heinkel Ralph.Heinkel@embl-heidelberg.de
Thu, 6 Mar 1997 09:54:07 GMT


Fredrik Lundh writes:
> 
> > hobbes:/struct/fuller1/heinkel/src/Python-1.4/Extensions/Imaging$ python pilfile.py Images/lena.gif
> > Image: failed to import ArgImagePlugin : cannot import name ChunkStream
> > Traceback (innermost last):
> 
> Check your installation; it seems to me that you have a mix of 0.2b4
> files and older versions (the ppmtogif complaint, for example; 0.2b4
> includes its own GIF writer).

Ok, that indeed was a problem. Sorry for that, but when I copied files
from Imaging/Lib to my python lib directory, I got some errors which I
haven't seen.  Now, pilfile.py works fine, pilconvert.py seems to work
fine at a first glance, but:

hobbes:$ python pilfile.py lena.gif
hobbes:$ python pilconvert.py lena.gif lena.tif

looks ok, but xv cannot display it (tif directory is missing required
"colormap" field) and:

hobbes:$ python pilfile.py lena.tif
lena.tif failed: cannot identify image file
hobbes:$ python pilconvert.py lena.gif lena.ppm
cannot convert image (IOError:cannot write mode P as PPM)
hobbes:$


Also the 'tostring'/'fromstring' combination still gives
error messages:

>>> import Image
>>> im=Image.open('lena.gif')
>>> im.size
(128, 128)
>>> im2=Image.new(im.mode,im.size)
>>> im2.fromstring(im.tostring())
>>> im2.save('lena2.gif')
Traceback (innermost last):
  File "<stdin>", line 1, in ?
  File "/usr/local/lib/python1.4/Image.py", line 356, in save
    SAVE[string.upper(format)](self, fp, filename)
  File "/usr/local/lib/python1.4/GifImagePlugin.py", line 194, in _save
    for s in getheader(im):
  File "/usr/local/lib/python1.4/GifImagePlugin.py", line 254, in getheader
    s.append(im.im.getpalette("RGB"))
ValueError: 
>>> 

I double-checked this on a different machine with a python/PIL
installation from scratch (just to make sure ...) and it gave
me the same results.

Ralph

_______________
IMAGE-SIG - SIG on Image Processing with Python

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