EN
My tools

Image to C Array Converter (Arduino Bitmap)

Convert images to C arrays for Arduino and embedded displays: 1-bit bitmaps (Adafruit GFX, SSD1306, XBM), RGB565, RGB888 or grayscale, with dithering.

0 keeps the original width (or follows the height).
0 keeps the aspect ratio.
Pixels at least this bright become 1 (lit).
My tools →
Advertisement

Small displays on Arduino, ESP32 and other microcontrollers draw images from arrays in the program, not from files. This converter turns PNG, JPG, SVG or GIF images into C arrays in the layout your graphics library expects: 1-bit monochrome bitmaps for OLEDs (Adafruit GFX drawBitmap, the SSD1306 page layout, u8g2 XBM) or colour data for TFT screens (RGB565, RGB888, 8-bit grayscale). Resize, choose a threshold or dithering, invert, preview exactly what the display will show, and download a .h file. Images never leave your device.

How to use this tool

  1. Choose one or more images.
  2. Pick the output format your library uses (drawBitmap, SSD1306 buffer, drawXBM, RGB565…).
  3. Set the display size, for example 128 × 64, and how to fit the image.
  4. For 1-bit output adjust the threshold or pick dithering, and tick Invert for dark drawings on white.
  5. Check the preview, then copy the code or download the .h file.

Formula

1-bit: bit = (0.299 R + 0.587 G + 0.114 B ≥ threshold) · RGB565 = (R & 0xF8) << 8 | (G & 0xFC) << 3 | B >> 3

Horizontal 1-bit rows are padded to whole bytes (MSB = leftmost pixel for Adafruit GFX, LSB for XBM). Vertical pages store 8 pixels of one column per byte, bit 0 at the top, as the SSD1306 does. Floyd–Steinberg spreads each pixel's error 7/16, 3/16, 5/16, 1/16 to its neighbours; Atkinson spreads 6/8 of it in eighths; Bayer compares each pixel with a 4 × 4 threshold matrix. Transparent areas are filled with the chosen background first.

Example

A 120 × 80 image with a blue background (#2563EB) and a yellow circle becomes, in RGB565, 9,600 values starting 0x231D — (32 << 8) | (96 << 3) | (235 >> 3) — or 19,200 bytes. As a 1-bit horizontal bitmap it is 15 bytes per row × 80 rows = 1,200 bytes: the blue (brightness 96) stays 0 and the circle (brightness 191) lights up, about 1,960 pixels.

Frequently asked questions

Which format does my display need?

Monochrome OLEDs with Adafruit GFX use the horizontal 1-bit format with drawBitmap; code that writes straight into an SSD1306 or SH1106 buffer needs vertical pages; u8g2 uses XBM with drawXBM/drawXBMP. Colour TFTs (ILI9341, ST7735, ST7789) take RGB565.

Why is my image upside-down or garbled?

The layout does not match the library. Try the other 1-bit layout, check that width and height in the draw call match the array, and for RGB565 try swapping bytes — some libraries expect the high byte first.

What does PROGMEM do?

On AVR boards such as the Uno, PROGMEM keeps the array in flash instead of copying it into the 2 KB of RAM. ESP32 and ARM boards keep const data in flash anyway, so it is harmless there.

Is my image uploaded?

No. Conversion happens in your browser.

Sources

Last updated:

Cite or embed this tool
APA

kakaoCalc. (2026, November 8). Image to C Array Converter (Arduino Bitmap). https://kakao.mobile/tools/image-to-c-array-converter/

MLA

“Image to C Array Converter (Arduino Bitmap).” kakaoCalc, 8 Nov. 2026, kakao.mobile/tools/image-to-c-array-converter/.

Advertisement