Smartmatrix - gif - position on the display

Hello,

the library is great, but I found no answer to my question.

The example “AnimatedGifs” works great with 32x32 pixel gifs. I have two 64x64 panels.
Can i specify, where the gif should be played on the display? By default, the gif is always played in the top left corner.

Thank you so much for help. :slight_smile:

Best regards
Thomas

Looking at the AnimatedGIFs example, It looks like you can modify drawPixelCallback to add offsets to x and y. You could use global variables for the offsets if you wanted to change the position dynamically. Haven’t tried it but it should work…

1 Like

Thank you very much. It works. :slight_smile:

You only have to adjust the coordinates in this line in the function.

void drawPixelCallback(int16_t x, int16_t y, uint8_t red, uint8_t green, uint8_t blue) {
   #if (USE_SMARTMATRIX == 1)
       backgroundLayer.drawPixel(x+64, y, {red, green, blue});
   #endif
}

My fork of the lib supports offsets and shrinking/zooming into gifs (for instance to display a 32x32 on a 24x32 display)

Same lib, just with a few improvements like this one