Minimal Microcontroller GIF Decoder
David Johnson-Davies' GIF decoder requires only 16 KB of RAM and can be used for standalone image displays.
The GIF image format, according to David Johnson-Davies at Technoblogy, is ideal for storing images to be displayed on small TFT and OLED screens. It’s able to efficiently compress images of many types, and is well supported by image editors. What he found, however, was that there wasn’t a GIF decoder aimed at microcontrollers with a small amount of RAM, so he wrote one!
His resulting Minimal GIF Decoder runs on microcontrollers with at least 16 KB of RAM. He used AVR128DA28 for testing, with... 16 KB of SRAM, along with 128 KB of flash memory. An Adafruit 160x128 pixel, 1.8” TFT was used as the display, and other screens should work as well.
While 128 KB isn’t a ton of space by today’s computing standards, it’s enough to fit several compressed images with sufficient resolution for this type of screen. He provides several examples images in his code, ranging from just over 1 KB for monochrome playing cards, to roughly 8.6 KB for the Technoblogy logo. One drawback to this setup is that the refresh rate can be quite slow, taking roughly four seconds to load an image on the AVR128DA28, running at 24 MHz.
Code, background information, and instructions on how to use this decoder can be found in his Technoblogy post. Converted GIFs can be stored as arrays in the code itself, or an alternate version of the code can pull images from an SD card. In addition to the AVR128DA28, the decoder has been tested on the ATSAMD51-based PyBadge. It looks quite nice in the image below!