luma.core.image_composition

Composes scrollable, positionable images into another Image

New in version 1.1.0.

class luma.core.image_composition.ComposableImage(image, position=(0, 0), offset=(0, 0))[source]

Bases: object

This class encapsulates an image and its attributes that can be rendered onto an ImageComposition.

property height
Returns

The actual height of the image, regardless its position or offset within the image composition.

Return type

int

image(size)[source]
Parameters

size (tuple) – The width, height of the image composition.

Returns

An image, cropped to the boundaries specified by size.

Return type

PIL.Image.Image

property offset

Getter for offset.

Returns

A tuple containing the top,left position.

Return type

tuple

property position

Getter for position

Returns

A tuple containing the x,y position.

Return type

tuple

property width
Returns

The actual width of the image, regardless its position or offset within the image composition.

Return type

int

class luma.core.image_composition.ImageComposition(device)[source]

Bases: object

Manages a composition of ComposableImage instances that can be rendered onto a single PIL.Image.Image.

add_image(image)[source]

Adds an image to the composition.

Parameters

image (PIL.Image.Image) – The image to add.

refresh()[source]

Clears the composition and renders all the images taking into account their position and offset.

remove_image(image)[source]

Removes an image from the composition.

Parameters

image (PIL.Image.Image) – The image to be removed.