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

Can't open GIFs wider than 319x16 #9

Open
TymonZ opened this issue May 10, 2022 · 2 comments
Open

Can't open GIFs wider than 319x16 #9

TymonZ opened this issue May 10, 2022 · 2 comments

Comments

@TymonZ
Copy link

TymonZ commented May 10, 2022

I'm trying to load a GIF file from an SD card on a Teensy 4.1 and display it on a SMARTMATRIX_HUB75_16ROW_MOD8SCAN 448x16 matrix.
I'm using an AnimatedGifsTest example. I tried two configurations:

kRefreshDepth = 36;
kDmaBufferRows = 4;
matrix.setRefreshRate(90);

and

kRefreshDepth = 12;
kDmaBufferRows = 2;
matrix.setRefreshRate(30);

Both produced the same results. Here's the serial output:

Starting AnimatedGIFs Sketch
1:1.gif    size:2105
2:1.2.gif    size:2137
3:1.1.gif    size:2126
4:2.gif    size:2139
Pathname: /gifs/1.gif
Successfully opened GIF; Canvas size = 319 x 16
Pathname: /gifs/1.2.gif
open failed: 2
Pathname: /gifs/1.2.gif
open failed: 2

1.gif has a size of 319x16
1.2.gif has a size of 320x16
Is there anything i could do to load a larger GIF?

@TymonZ TymonZ changed the title Can't open GIFs larger than 319x16 Can't open GIFs wider than 319x16 May 10, 2022
@TymonZ
Copy link
Author

TymonZ commented May 10, 2022

I've found out that the library supports gifs with the maximum size of 480x320. Is there any simple hack to swap the maximum width and height of supported gifs?

@embedded-creations
Copy link
Contributor

embedded-creations commented May 17, 2022

GifDecoder uses the AnimatedGIF library, which sets the maximum width. You may be able to change this constant in the library to increase the width, at the cost of more memory used:

https://github.com/bitbank2/AnimatedGIF/blob/master/src/AnimatedGIF.h#L42

You could try rotating the GIF so you get a 16x448 GIF using a tool like ezgif.com, and then inside your sketch, swap the dimensions:

https://github.com/pixelmatix/GifDecoder/blob/master/examples/SmartMatrixGifPlayer/SmartMatrixGifPlayer.ino#L159

Change backgroundLayer.drawPixel(x, y, {red, green, blue}); to backgroundLayer.drawPixel(y, x, {red, green, blue});

Hopefully one of these ideas works

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

2 participants