On 08/13/2014 04:35 PM, diliup gabadamudalige wrote:> buff.name <http://buff.name> = '88keykbd.png'
> This is the complete and correct code. Can anyone say what;s wrong?
> Thanks in advance.
>
>
> import pygame
> import StringIO
>
> putimage = pygame.image.load("88keykbd.png")
> buff = StringIO.StringIO()
>Open both files in binary mode, with 'wb' and 'rb' respectively.
> pygame.image.save(putimage, buff)
>
> putimage = buff.getvalue()
> print "buff:", type(buff), "myimage:", type(putimage), "getimage:",
> type(putimage)
>
> print len(putimage)
> with open('myscrambledimage.dat', 'w') as newfile:
> Â Â newfile.write(putimage)
>
> with open('myscrambledimage.dat', 'r') as newfile:
> Â Â getimage= newfile.read()
> print len(getimage)
Especially if you are on some funny operating system, like Windows.
Have you considered just putting all your images in a zip file, instead
of encoding them in strange ways?
--
The Sheep