[Tutor] From byte[] to Image

Ziad Rahhal ziad.rahhal at gmail.com
Sat Sep 16 17:54:39 CEST 2006


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:

#**************************************************************
# 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)

file.close()
#**************************************************************

The Java method is: "public byte[] getFile(String path)"

This is not working. I am not able to get all the data of the image
and for sure not able to form the complete image.

Any solution for that?

Thank you in advance,

Ziad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20060916/096f1079/attachment.html 


More information about the Tutor mailing list