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&nbsp; with out saving it disk <br>PIL supports the use of StringIO objects being passed in place of file<br>
objects. &nbsp;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>&nbsp;file = StringIO()<br>&nbsp;image.save(file, &quot;JPEG&quot;)&nbsp;<br>
cached_image = file.getvalue()<br>but i&nbsp; can&#39;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(&#39;P&#39;,(128,128),cached_image,&#39;gif&#39;)<br><div id="1fpc" class="ArwC7c ckChnd">
<br>but the i got following error shown below&nbsp; 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>&nbsp; File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;<br>
&nbsp; File &quot;/usr/lib/python2.5/site-packages/PIL/Image.py&quot;, line 1744, in fromstring<br>
&nbsp;&nbsp;&nbsp; im.fromstring(data, decoder_name, args)<br>&nbsp; File &quot;/usr/lib/python2.5/site-packages/PIL/Image.py&quot;, line 577, in fromstring<br>&nbsp;&nbsp;&nbsp; raise ValueError(&quot;cannot decode image data&quot;)<br>ValueError: cannot decode image data</div>