image Function

Defined in pyglet.resource

image(self, name, flip_x=False, flip_y=False, rotate=0, atlas=True)

Load an image with optional transformation.

This is similar to texture, except the resulting image will be packed into a TextureBin if it is an appropriate size for packing. This is more efficient than loading images into separate textures.

  • name (str) – Filename of the image source to load.
  • flip_x (bool) – If True, the returned image will be flipped horizontally.
  • flip_y (bool) – If True, the returned image will be flipped vertically.
  • rotate (int) – The returned image will be rotated clockwise by the given number of degrees (a multiple of 90).
  • atlas (bool) – If True, the image will be loaded into an atlas managed by pyglet. If atlas loading is not appropriate for specific texturing reasons (e.g. border control is required) then set this argument to False.
Return type:



A complete texture if the image is large or not in an atlas, otherwise a TextureRegion of a texture atlas.

Previous topic

html Function

Next topic

location Function