[PYTHON IMAGE-SIG] Basic PIL problems
Fredrik Lundh
fredrik_lundh@ivab.se
Wed, 5 Mar 1997 15:57:25 +0100
> 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).
> In Image.py I found the methods 'tostring' and 'fromstring' which
> are not documented (at least not in my 0.2B3 docu). Does the format
> of the returned/accepted string depend on the image format, or is it
> an independent internal format?
They process data in an internal format that depends on the mode, not
the original fileformat. Basically, "1", "L", "P" are returned with
one byte per pixel, while "RGB", "RGBA" and "CMYK" are returned as
4-byte per pixel (using a filler byte in the "RGB" case). I will
probably change this so that you can request other formats.
If you have data in an array, you could also try "putdata". It also
allows you to provide a scale and offset used to fit your data into
the 0..255 range used by PIL. But I think you have to use the source
to find out exactly how that one works...
Cheers /F (http://hem1.passagen.se/eff)
_______________
IMAGE-SIG - SIG on Image Processing with Python
send messages to: image-sig@python.org
administrivia to: image-sig-request@python.org
_______________