load Function

Defined in pyglet.image

load(filename, file=None, decoder=None)

Load an image from a file.

Note:

You can make no assumptions about the return type; usually it will be ImageData or CompressedImageData, but decoders are free to return any subclass of AbstractImage.

Parameters:
  • filename (str) – Used to guess the image format, and to load the file if file is unspecified.
  • file (file-like object or None) – Source of image data in any supported format.
  • decoder (ImageDecoder or None) – If unspecified, all decoders that are registered for the filename extension are tried. If none succeed, the exception from the first decoder is raised.
Return type:

AbstractImage

Previous topic

get_buffer_manager Function

Next topic

load_animation Function