Hi,
I convert an Image to bye array in Java (web-services) and send it to a python client.
At the client side (python code) i receive the bytes, and then i need to transform them into
the image again.
Here is what I am doing:
#**
# fil
Hi Ziad,
Can you give us a bit mor4e detail.
> #**
> # fileName is the path of the file
> stream = service.getFile(fileName)
>
> file = open("pic.jpeg", 'w')
>
> img = Image.frombuffer("1", (128, 128), stream)
> img.save(file)
Which l
Hi Alan,
The Library I am using is the PIL. And I read the Docs, they say the following about "frombuffer" operation:
(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 to load it.)
So I gu
> (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*to
> load it.)
>
> So I guess "frombuffer" must not be used in my case.
Looks like it, but did you try what it suggested,
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 id
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: