[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[pygame] Re: Bad Civil Image



this original post was bounced from the list, i'm just
forwarding it through here as i reply...


> Problem summary:  civil (http://civil.sourceforge.net/) dies with a
> segfault when run on windows, thusly:
> 
> Fatal Python Error: Segmentation Fault
> 
> abnormal program termination
> 
> I've narrowed it down to this:
> 
> import pygame.display
> import pygame.image
> pygame.display.init()
> gfx = "c:/kalle/civil/civil/gfx/"
> surface=pygame.image.load(gfx+"butt-new-game-moff.png").convert()
> 
> Ideas?  butt-new-game-moff.png can be found on
> 
> http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/~checkout~/civil/gfx/
> butt-new-game-moff.png?rev=3D1.1&content-type=3Dimage/png&cvsroot=3Dcivil
> 
> On one line, of course.


this is definitely a strange one. i've gone and done some testing with
this, and the crash is definitely happening inside of the SDL_image
library. just to make sure i went and recompiled my libpng and SDL_image,
but ended up with the same problem.

my solution was this. i opened the image in a simple image viewing
program. i then saved it out as a new PNG file. i was able to load
the new PNG into pygame just fine.

this makes me think there something wrong between the communication
with libpng and SDL_image. i went to try downloading some prebuilt
libpng binaries, but www.libpng.org seems down at the moment.

perhaps there are some PNG options in your graphic utility that
would save the images a little differently (and thus, work) :/

sorry it is not the best solution, but i will be looking into it
further.

/me looks further...

due to the magic of google's page caching, i found and downloaded
a precompiled win32 library of libpng. i rebuilt my SDL_image with
this new libpng. the result was actually worse. the precompiled lib
used a different C runtime library (my guess) and this even the
converted PNG couldn't load correctly. (ugh)

this might be a tough problem to find. i'll forward the bad PNG
on to the sdl newsgroup and see if anyone turns up a solution.


also, btw. your original code will raise an exception if the
image load did work. trying to convert the image to the display
format before setting the display format. :]


____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org