I do the following:

file = StringIO.StringIO(buffer)
img = Image.open(file)
img.save(file, 'JPEG')

I get this error:
img = Image.open(file)
  File "/home/rahhal/python/lib/python2.4/site-packages/PIL/Image.py", line 1745, in open
    raise IOError("cannot identify image file")
IOError: cannot identify image file

Yes I printed the contents of Buffer but how can I make sure if it is all there since the type I am receiving is
different (temporarly, until I form the Image) from the original content of the Image itself. I will attach the buffer
I am receiving and the original Image I am sending.


On 9/17/06, Alan Gauld <[EMAIL PROTECTED] > wrote:
> (Note that this function decodes pixel data only, not entire images.
> If you
> have an entire image file in a string, wrap it in a *StringIO*
> object, and
> use
> *open*< file:///home/rahhal/Imaging-1.1.5/Docs/pythondoc-PIL.Image.html#PIL.Image.open-function>to
> load it.)
>
> So I guess "frombuffer" must not be used in my case.

Looks like it, but did you try what it suggested, namely using
a StringIO object and the open method?

What happened?

> The java method is working correctly but I am not able to form the
> picture
> in the right way at the client side using the PIL library.

> I receive it at the client side in python:
> buffer = service.getFile(fileName)

I assume you tried printing buffer (or at least its len) to check that
it was all there?

Alan G.


Attachment: buffer
Description: Binary data

<<attachment: out.jpg>>

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to