Whether you’re programming a game or an app with Python or Lua, you’re probably using PNG graphics for your game assets. An advantage of the PNG format, which is not available in a JPEG, is the ability to store an alpha channel. Alpha is, essentially, the “color” of invisibility or transparency. Alpha is the part of an image you don’t see. For example, if you were to draw a doughnut, the doughnut hole would be filled with alpha, and you could see whatever was behind it.

A common problem is how to find the alpha part of an image. Sometimes, your programming framework, whether it’s Python ArcadePygame, LÖVE, or anything else, detects the alpha channel and treats it (after the appropriate function calls) as transparency. That means it renders no new pixels where there’s alpha, leaving that doughnut hole empty. It’s 100% transparent or 0% opaque and functionally “invisible.”

Other times, your framework and your graphic asset don’t agree on where the alpha channel is located (or that an alpha channel exists at all), and you get pixels where you wanted transparency.

This article describes the most sure-fire way I know to work around that.

#machine-learning

Create transparency in your game graphics with GIMP
1.10 GEEK