Its possible show gif in a part of matrix without clear screen?

im noob in python, sorry.
I can show images in a part of screen with for example:
“im = Image.new(mode=“RGB”, size=(128,26))” define size
“matrix.SetImage(im.convert(‘RGB’), 0,45)” define position

but when i show a animated gif with

def animacion():
# Preprocess the gifs frames into canvases to improve playback performance

print("Preprocessing gif, this may take a moment depending on the size of the gif...")
for frame_index in range(0, num_frames):
    gif.seek(frame_index)
    # must copy the frame out of the gif, since thumbnail() modifies the image in-place
    frame = gif.copy()
    frame.thumbnail((matrix.width, matrix.height), Image.ANTIALIAS)
    canvas = matrix.CreateFrameCanvas()
    canvas.SetImage(frame.convert("RGB"))
    canvases.append(canvas)
# Close the gif file to save memory now that we have copied out all of the frames
gif.close()
print("Completed Preprocessing, displaying gif")

def mostrar_animacion():
cur_frame = 0
while(cur_frame < num_frames - 1):
matrix.SwapOnVSync(canvases[cur_frame], framerate_fraction=10)
if cur_frame == num_frames - 1:
cur_frame = 0
else:
cur_frame += 1

this clear the screen and cant show in a position. Its possible show a litle animated gif in a litle part of the matrix without clear screen?

sorry for my English. Ty for help

I just solved with chatgpt

then maybe you can share the answer with everyone :slight_smile:

1 Like