Play Gif from memory in Teensy


Hi Guys…

Is it possible to play back a gif from the internal memory on the Teensy?

I have some Bitmaps running from memory but would like to get a GIF running…



It’s not possible at the moment, but it’s something I’d like to support in the future. There’s 256k of Flash in the Teensy 3.1/3.2 which could store the Arduino sketch and a GIF as well. How big is the GIF you want to play?


Gday Louis’

I cant exactly remember the size as at work rite now but from memory it was around 30k maybe a bit bigger…

Its a shame as i have more than enough flash memory left to play with…


Hi Dann, it actually wouldn’t be that hard to modify the AnimatedGIFs sketch to use internal flash. In the latest version of the sketch (more recent than what’s included in the SmartMatrix Library Examples), I made the file functions generic so you can use a different FAT library. You could adjust that code to read from internal flash instead. The code you need to change is mostly in FilenameFunctions.c:

e.g. fileReadBlockCallback() would need to load bytes from internal flash into the buffer instead of calling a function in a FAT library.

I’m not sure the best way to load a GIF into internal flash. You could probably just do what you did for a bitmap. The Teensy Audio Library I believe has some utilities that load .wav and other files into internal flash and you could look at that as well for another example.

If you want to take this on, please post back if you need more help or get something working.


I do want to get this working thanks… Hopefully i dont bug you too much for help… I’ll have to read up on what to do to get the gifs into memory though…

Thanks Louis