Search code examples
pythonpygamegeometry-surfacepixelformat

Do new pygame surfaces have to be .convert()ed?


When you create a new Pygame surface:

pygame.Surface((width, height), flags=0, depth=0, masks=None)

Do you have to call .convert() on it to change its pixel format, or is that already done for you when you create it?


Solution

  • convert is only used when changing pixel formats (for example, going from indexed to rgb). The surface will be created with RGB by default and you should only need to convert it if that isn't what you need (it almost always is).