new images from strings using PIL

Fredrik Lundh fredrik at pythonware.com
Sun Mar 3 17:32:20 EST 2002


"Max M" wrote:
> Your string would probably look a little like this:
>
> "GIF89aEURÿÿÿ!ù¤&(¤&(g(/&dg;"
>
> Well actually it wouldn't. But the general idea is that the string would
> be how an image file like a gif would look like if opened in a text editor.

not quite: the string should contain the *raster data* section
of that file, not the header information.  for a typical gif, that's
the entire file minus the first 792 bytes or so...

if you have read an entire file into a string, use

    im = Image.open(StringIO.StringIO(data))

</F>





More information about the Python-list mailing list