R
R
Redzonetree2022-03-04 05:05:56
pygame
Redzonetree, 2022-03-04 05:05:56

How to save transparent image in pygame?

wrote a small code (something like Paint'a at minimum), and tried to save surfaceusing while maintaining transparency, but nothing came of it. What I tried to do: Replace the image with a transparent PNG image (it is completely empty, I even used ) Set as A-channel Make it transparent itselfpygame.image.save(surface, 'picture.png')

surfaceconvert.alpa()
colorkey
surface

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor Markin, 2022-03-04
@Redzonetree

Color depth should be 32

image = pygame.Surface([640,480], pygame.SRCALPHA, 32)
image = image.convert_alpha()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question