Frequent use of animated GIF files dates back to Netscape Navigator in the 1990's (remember twirling "under construction" signs for web sites?). These days, animated GIF files are most often used for meme display or in short video clips where a video file might not be playable.

The resources needed to play animated GIFs are lower than videos, but have often been more than what a microcontroller could provide.

Playing animated GIF image files using a microcontroller is a tough proposition. Here are the factors which need to be considered for a good experience:

  • Microcontroller speed
  • Microcontroller memory available
  • A speedy interface between microcontroller memory and a display
  • Animated GIF file size

Some more modern microcontrollers with a larger amount of memory and fast access to a local display can meet the requirements for animated GIF playback, as long as the file size and frame rate (the time between frames in the changing image) is not too small.

This guide will demonstrate displaying animated GIF files on two microcontroller boards with integrated displays. The Espressif ESP32-S2 and Microchip SAMD51 are modern processors capable of displaying GIF files at reasonable rates.

The CircuitPython gifio module is an addition to CircuitPython 8.1.0 and later versions providing GIF playback capability.

Parts

This guide will use an Adafruit ESP32-S2 TFT Feather and an Adafruit PyPortal to demonstrate animated GIF playback. Only one of the boards is needed to try this process. The USB cable shown works with both USB micro B and USB C. Be sure you use a known good data+power cable.

You can choose another board - note the code may be slightly different from the code for these two boards in this guide. And also, if the other board does not have a modern, capable processor, GIF playback will be impaired or unacceptable.

Front view of a Adafruit PyPortal - CircuitPython Powered Internet Display with a pyportal logo image on the display.
PyPortal, our easy-to-use IoT device that allows you to create all the things for the “Internet of Things” in minutes. Make custom touch screen interface...
$54.95
In Stock
Adafruit ESP32-S2 TFT Feather powered on by a USB- C power source displaying the product tittle in a red, yellow, green, white and blue.
We've got a new machine here at Adafruit, it can uncover your deepest desires. Don't believe me? I'll turn it on right now to prove it to you! What, you want unlimited...
$24.95
In Stock

This guide was first published on Apr 12, 2023. It was last updated on Apr 19, 2024.

This page (Overview) was last updated on Mar 08, 2024.

Text editor powered by tinymce.