[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[pygame] Segfault in pygame.image.tostring()?
I'm trying to save screen shots as .png's using PIL, but I'm getting
a segfault in a pygame when I try to convert the screen image into
a string:
def saveScreen( self, fileName = "screenshot.tga" ):
screen = pygame.display.get_surface()
imageStr = pygame.image.tostring( screen, "RGBA", 0 ) #!!! Segfault!?
image = PIL.Image.fromstring( "RGBA", screen.get_size(), imageStr )
image.save( fileName )
What's odd is that if I save the image directly in pygame, it works fine.
I can also load the image from a file into PIL, and then save it:
def saveScreen( self, fileName = "screenshot.tga" ):
pygame.image.save( pygame.display.get_surface(), fileName )
#!!! Kludge to save .png
image = PIL.Image.open( fileName )
image.save( "screenshot.png" )
Here's the error message:
<File and line number pointing to tostring line>
Fatal Python error: (pygame parachute) Segmentation Fault
This application has requested the Runtime to terminate it in an unusual way.
Plesae contact the application's support team for more information.
shell returned 3
Has anyone else seen anything like this, or have any ideas what could
cause this?
-Jasper
____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org