Reputation: 183
I'm having some issues loading an image into pygame. I've searched through here and google and tried using os.path.join
and just the full path. Nothing is working. The error I'm getting is: libpng error: bad adaptive filter value
. Here is my code for trying to load in the image.
background = pygame.image.load("background/level1.png")
background_rect = background.get_rect()
Any idea what I'm doing wrong? I've also tried the following:
background = pygame.image.load(os.path.join("background","level1.png"))
background_rect = background.get_rect()
background = pygame.image.load("L:\\Spring 2014\\CSC177\\The End\\The End\\background\\level1.png")
background_rect = background.get_rect()
Upvotes: 0
Views: 443
Reputation: 1108
Ok so What I'm getting from this is you don't have the full PIL
installed completely so try converting the image to a .gif which I believe is your problem. It is getting to the .png file, but it can't load it because you don't have the full PIL support in your python. So like I said I would convert the png to a gif file and try it again.
Upvotes: 1
Reputation: 996
I don't think that the path is the issue here.. As long as the os command
os.path.exists(path)
evaluates to True when you supply the image's path, pygame should be able to find it. If I were you I would try to open an image with another format or in the worst case scenario reinstall pygame
Hope tha helped! Cheers, Alex
Upvotes: 1