Convert GIF to Bitmap animation (for Arduino / OLED)
About GIF to Bitmap Animation (byte array) Converter
This tool converts animated images (GIF, WebP, APNG, AVIF, MNG, JXL) into C/C++ byte arrays and PROGMEM header files (.h) ready for compilation with Arduino, ESP8266, ESP32, Raspberry Pi Pico, and STM32 microcontrollers.
Whether you are driving an SSD1306 / SH1106 monochrome OLED (128x64 or 128x32), a Nokia 5110 LCD, or an ST7789 / ST7735 / ILI9341 color TFT, this tool automates the entire conversion workflow: frame extraction, dimension scaling, contrast adjustment, dithering, and byte-packing.
Supported Display Libraries & Byte Formats
- Adafruit GFX / Adafruit SSD1306 (Horizontal MSB-first): The most widely used format in the Arduino ecosystem. Bytes are packed horizontally (8 pixels per byte, leftmost pixel in bit 7). Directly compatible with
display.drawBitmap(x, y, bitmap, w, h, WHITE). - SSD1306 Native RAM / U8g2 (Vertical / Page-based): Packaged in 8-pixel tall vertical pages matching the internal GDRAM layout of SSD1306 and SH1106 controller chips. Used with
u8g2.drawBitmap(). - XBM Format (Horizontal LSB-first): The standard X11 bitmap format, compatible with
u8g2.drawXBM()and standard C compilers. - 16-bit RGB565: 2 bytes per pixel (5 bits red, 6 bits green, 5 bits blue) for full-color TFT screens using TFT_eSPI or Adafruit GFX.
Dithering & Image Binarization
Converting rich 24-bit color animations into 1-bit monochrome requires dithering to simulate shading and gradients:
- Floyd-Steinberg: Error diffusion algorithm that spreads quantization error to neighboring pixels. Best for realistic animations, faces, and continuous tone images.
- Atkinson: Popularized on the original Apple Macintosh, Atkinson retains strong contrast while providing gentle halftoning.
- Bayer Ordered Dithering (4×4 / 8×8): Creates vintage, crosshatch halftone patterns typical of retro LCD handheld games.
- Threshold (No Dither): High-contrast pure binary cutoff. Ideal for sharp pixel art, icons, text, and retro game sprites.
Managing Microcontroller Flash Memory
Traditional 8-bit AVR microcontrollers like the Arduino Uno / Nano (ATmega328P) have only 32 KB of Flash program memory. A single 128×64 monochrome frame requires 1,024 bytes (1 KB). A 20-frame animation requires 20 KB, consuming over 60% of the Uno's available flash storage.
To keep animations within your microcontroller's flash capacity:
- Use the Max frames limit to cap the total animation length.
- Use Frame subsampling (e.g. skip every 2nd frame) to cut storage consumption in half while maintaining good visual motion.
- Consider faster microcontrollers with generous flash memory like the ESP8266 (1–4 MB), ESP32 (4 MB), or Raspberry Pi Pico (2 MB) if you need longer high-resolution animations.
If you need to split animations into individual image files, see our GIF frame splitter or GIF to sprite sheet converter.