Skip to content Skip to sidebar Skip to footer

Pygame PNG Image Looks Corrupt

I'm following this guide to try and display a basic PNG image inside a Pygame window. My image is a simple 150x150 green ball with no transparency called ball.png, located in the s

Solution 1:

As @DJ McGoathem said, Pygame has known issues with El Capitan due to differing versions of the SDL_image library; Pygame needs version 1.2.10 but El Capitan has 1.2.12. This can be solved by downgrading this library, which I did like this (requires Brew):

  1. Copy this code into a file called sdl_image.rb
  2. Open a Terminal inside the directory where you saved that file
  3. Run brew remove sdl_image to uninstall the incompatible version of the library
  4. Run brew install -f sdl_image.rb to install the compatible version of the library

After this, my program was rendering the image correctly.


Post a Comment for "Pygame PNG Image Looks Corrupt"