Skip to content

Image to C Array

Turn a local image into an Adafruit GFX bitmap, SSD1306 framebuffer or RGB565 C array. Preview pixels and download a header file.

PNG, JPEG or WebP · up to 10 MB and 16 megapixels. Images stay in your browser.

Pixel preview

Choose an image or load the example to preview the exact output pixels.

Black preview pixels are 1. Each row starts a new byte; unused bits at the right edge are 0. Use Adafruit GFX drawBitmap.

C header

How to use

  1. Choose a local PNG, JPEG or WebP image, or load the sample.
  2. Set output dimensions and choose proportional fit or stretch. Adjust threshold and inversion for monochrome displays.
  3. Select the packing format required by your display library, inspect the pixel preview, then copy the code or download the .h file.

Example

A 128 × 64 monochrome image uses 1,024 bytes.
GFX rows: x=0 is bit 7 of the first row byte.
SSD1306 pages: y=0 is bit 0 of the first page byte.
RGB565: red = 0xF800, green = 0x07E0, blue = 0x001F.

Details and limitations

All image processing happens locally. Inputs are limited to 10 MB and 16 megapixels; output dimensions are 1–256 pixels on each side. No device is connected or flashed.

The first decoded frame is frozen and resized to at most 256 pixels on its longer side. Transparent pixels are composited on white; proportional fitting adds white padding.

For monochrome output, pixels darker than the threshold become 1 (shown black). A pixel exactly at the threshold becomes 0. Inversion swaps image bits but leaves padding bits outside the image at 0. OLED displays usually light pixels whose bits are 1.

GFX pads each row to a whole byte. SSD1306 pads the last vertical page to 8 pixels; partial pages need a driver that supports the selected dimensions. RGB565 output is an array of 16-bit values and does not specify a transmission byte order.

The header uses static const arrays and AVR PROGMEM storage when compiling for AVR. GFX can read its bitmap format directly; copying raw page data on AVR requires the appropriate program-memory read/copy function. No LVGL image descriptor, palette or alpha channel is generated.

FAQ

Are my images uploaded?

No. The image is decoded, resized and converted inside your browser.

Why does my OLED show a scrambled image?

Check dimensions and packing. Adafruit GFX drawBitmap expects horizontal rows with the left pixel in bit 7; the SSD1306 framebuffer stores vertical groups with the top pixel in bit 0.

Can I choose big-endian or little-endian RGB565?

This tool exports uint16_t values, so byte order is left to your compiler and display driver. It does not export a raw byte stream.

Format references

Tool page updated: