Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alternating between Images and GIFS - glitching at regular intervals #1695

Open
SitrucL opened this issue Aug 4, 2024 · 0 comments
Open

Comments

@SitrucL
Copy link

SitrucL commented Aug 4, 2024

I'm attempting to make an image & GIF viewer using the python bindings for this library. Independently, I'm able to display images perfectly fine, same with GIFs. However when attempting to do one after another (specfically displaying a GIF after an Image), an issue occurs whereby the GIF plays for 1-2 cycles then momentarily show's the previous image. I suspect it maybe due to my implementation or a clash of matrix.SwapOnVSync and matrix.SetImage but even if I call matrix.Clear before displaying a GIF, it still glitches (momentarily shows a blank display).

here is the snippet used for displaying images

image = Image.open(BytesIO(response.content))
image.thumbnail((matrix.width, matrix.height), Image.ANTIALIAS)
matrix.SetImage(image.convert("RGB"))

and here is the snippet used for displaying GIFs (taken from the example in this repo)

def display_gif():
    cur_frame = 0
    print('GIF ✅')
    while not gif_stop_event.is_set():
        matrix.SwapOnVSync(canvases[cur_frame], framerate_fraction=5)
        cur_frame = (cur_frame + 1) % num_frames
        time.sleep(0.1)  # Adjust the delay to match your desired frame rate

Thanks in advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant