rm-hull/luma.led_matrix

Two functions displaying an image

Closed this issue · 1 comments

Hi
In my script i have two functions displaying an image on the matrix and they are called at different time in differents loops, but when one is called, it erases the image of the previous one, i can't have images of the both functions at the same time on the matrix.
I wonder if there is a solution to add the two images, to display them at the same time.

(I'm sorry for my english it's not my mother tongue)

Type of Raspberry Pi

I'm using a Raspberry Pi 1 B

Create an empty image the same size as the device and paste the two images onto that, then call the device.display method, e.g.:

from PIL import Image

# assume you initialized this
device = ...

# Create a background image the same size as the device
bg = Image.new(device.mode, device.size)  

# assume your two images are called 'im1' and 'im2'
background.paste(im1, (0,0))
background.paste(im2, (4, 3))

device.display(background)

See https://pillow.readthedocs.io/en/4.0.x/reference/Image.html#PIL.Image.Image.paste