Embed an image in firmware as a C array

Microcontroller displays take pixels as byte arrays, not PNG files. Convert a splash image into a header you can #include.

Tools used in this guide

The job

An OLED or e-ink framebuffer wants raw bytes. The tool downscales any image to at most 512 px on the long edge, then emits either 8-bit grayscale (one byte per pixel) or a 1-bit-per-pixel bitmap packed MSB-first.

Image to header

Choose the image, pick 8bpp or 1bpp (with threshold and invert for the bitmap), name the array, and download the .h — it carries WIDTH/HEIGHT/BPP defines plus the byte array.

Worked example

A 2×1 image whose pixels are 0xAB and 0xCD becomes static const unsigned char icon[2] = { 0xab, 0xcd }; at 8bpp. At 1bpp each row pads to whole bytes, so a 9-pixel-wide bitmap uses 2 bytes per row.

Scope

PNG/JPG/WebP up to 25 MiB, decoded down to 512 px max dimension. Grayscale uses a Rec.601 luma mix. No RLE or palette output — plain bytes, ready for a memcpy into the framebuffer.