i need to do is modify the image in memory like resizing the image in memory etc ... with out saving it disk as i have to return back the image with out saving it disk <br>PIL supports the use of StringIO objects being passed in place of file<br>
objects. StringIO objects are binary strings of variable length that are kept<br>in memory so i saved the image in stringio objects the following code does that<br> file = StringIO()<br> image.save(file, "JPEG") <br>
cached_image = file.getvalue()<br>but i can't apply resize operation on cached_image as it a str object <br>
but i found out that Image.formstring(mode, size, data, decoder,
parameters) Creates an image memory from pixel data in a string so i
did the following<br><br>image=Image.fromstring('P',(128,128),cached_image,'gif')<br><div id="1fpc" class="ArwC7c ckChnd">
<br>but the i got following error shown below can any one tell me what was the error .. or tell me an alternative to modify the image in memory with out saving in disk ..<br><br>Traceback (most recent call last):<br> File "<stdin>", line 1, in <module><br>
File "/usr/lib/python2.5/site-packages/PIL/Image.py", line 1744, in fromstring<br>
im.fromstring(data, decoder_name, args)<br> File "/usr/lib/python2.5/site-packages/PIL/Image.py", line 577, in fromstring<br> raise ValueError("cannot decode image data")<br>ValueError: cannot decode image data</div>