Quick answer: Pygame image losing its transparency after calling .convert()? convert() drops alpha by default - use .convert_alpha() to keep the 32-bit channel.

Loaded a PNG with transparency. Blitting it shows a hard rectangle background. Removed the convert call - works. Added it back - broken.

Use convert_alpha

img = pygame.image.load("sprite.png").convert_alpha()

convert() matches the display format and is faster but discards alpha. convert_alpha() preserves per-pixel alpha.

Set display mode first

Calling convert before pygame.display.set_mode throws because there's no display format yet. Order matters: init video, set mode, load images.

Profile if performance matters

convert_alpha is 3-4x slower per blit than convert. For sprites with hard-edge transparency, use set_colorkey + convert instead.

“Pygame asks you to choose: speed or alpha. Both are right, depending.”

If your game is sprite-heavy on a low-end target, the colorkey path is a meaningful framerate win. UI elements with soft edges still want per-pixel alpha.