Learn Before
Code
Saving an Image From a Surface in Pygame
You can save an image from a Surface with the save() function. Save() can save your Surface as a BMP, TGA, PNG, or JPEG image. The function will take in the Surface you want to save the image from and the filename you'd like to generate. If the extension for the filename is not recognize, save() will default to TGA.
Surface = pygame.Surface(100, 100) filename = 'surface.png' pygame.image.save(Surface, filename)
0
1
Updated 2021-06-21
Tags
Python Programming Language
Data Science