Hi Radomir, Thanks for the response. ok. This is what i want to do i want to try to convert images into a string format and store them on disk. Better if they are unprintable characters. then when i want to see them i will run them thrugh a decryption python script and viola they will be displayed in pygame when i close the program again i will have only the encoded 'imageds' on the hd. I did this using
get_screen = SCREEN.subsurface(0, 0, SCREENW, SCREENH) with open(image_filename, "rb") as imageFile: imagestr = base64.b64encode(imageFile.read()) ## create the text file name to save to disk text_filename = newpath + "s" + str(va.page) + ".dat" ## save imagestr(image as a textfle) to disk with open(text_filename, "wb") as f: f.write(imagestr) I wanted a better way and hence the question. stringio or cstringio is fine. i can save the string to disk but how can i convert it back to an image file? Thank you for your help. On Tue, Aug 12, 2014 at 11:12 AM, Radomir Dopieralski <pyg...@sheep.art.pl> wrote: > On 08/11/2014 09:53 PM, diliup gabadamudalige wrote: > > type(f) gives <type 'instance'> > > yourimage = f.getvalue() > > with open('myscrambledimage.dat', 'w') as f: > > f.write(yourimage) > > so i coukld write this file to disk > > > > now how can i convert this back to an image? > > Thanks in advance > > What are you actually tryig to do? > I'm sure there is a simpler way. > > -- > The Sheep > -- Diliup Gabadamudalige http://www.diliupg.com http://soft.diliupg.com/ ********************************************************************************************** This e-mail is confidential. It may also be legally privileged. If you are not the intended recipient or have received it in error, please delete it and all copies from your system and notify the sender immediately by return e-mail. Any unauthorized reading, reproducing, printing or further dissemination of this e-mail or its contents is strictly prohibited and may be unlawful. Internet communications cannot be guaranteed to be timely, secure, error or virus-free. The sender does not accept liability for any errors or omissions. **********************************************************************************************