pygame2.video.image - Image loaders

pygame2.video.image.get_image_formats() -> (str, str, ...)

Gets the formats supported by pygame2 in the default installation.

pygame2.video.image.load_image(fname : str[, renderer=None[, assurface=False[, enforce=None]]]) → SDL_Surface, Sprite or SoftSprite

Creates a pygame2.sdl.surface.SDL_Surface from an image file.

This function makes use of the Python Imaging Library, if it is available on the target execution environment. The function will try to load the file via pygame2.sdlimage first. If the file could not be loaded, it will try to load it via PIL.

You can force the function to use only one of them, by passing the enforce as either "PIL" or "SDL".

Note

This will call pygame2.sdlimage.init() implicitly with the default arguments, if the module is available.

Previous topic

pygame2.video.gui - user interface elements

Next topic

pygame2.video.pixelaccess - 2D and 3D direct pixel access

This Page