LVGL Image Converter — C Array or .bin for LVGL v9 & v8

Convert PNG, JPG or BMP into an LVGL lv_image_dsc_t C array or .bin — every LV_COLOR_FORMAT (RGB565, RGB565A8, ARGB8888, indexed, alpha), little/big-endian, dithering, live preview. Same output as the official LVGL converter, 100% in your browser.

1
Step 1

Upload Your Image(s)

PNG · JPG · BMP · GIF · several at once
📷

Click or drag & drop to upload

PNG with transparency works best for alpha formats

2
Step 2

Live LVGL Preview

🖼Upload an image to see the live preview
3
Step 3

Generate LVGL Descriptor

This LVGL image converter turns any PNG, JPG or BMP into a ready-to-compile lv_image_dsc_t (LVGL v9) or lv_img_dsc_t (LVGL v8) C array — or an LVGL .bin file — with every colour format the official converter offers: RGB565, RGB565A8, RGB888, ARGB8888, XRGB8888, L8, indexed I1–I8 with a palette, and alpha masks A1–A8. Pick little- or big-endian byte order, turn dithering on or off, and watch a live preview of the quantised result before you download. It is an online LVGL image converter that runs 100% in your browser, so confidential product UI art never leaves your machine.

LVGL v9 vs v8: what the converter generates

LVGL is the Light and Versatile Graphics Library behind most modern embedded GUIs on ESP32, STM32, RP2040 and NXP/Renesas MCUs. A static image is an image descriptor: a header plus a byte array. The two major versions disagree about the header, and pasting one into the other is the number-one source of a blank screen or an image header magic mismatch log line:

Choose the version in the first dropdown; the colour-format list changes to the enums that version actually has.

Which colour format to pick

FormatBytes / pxUse it for
RGB565 (v8: TRUE_COLOR, 16-bit)2Opaque photos and backgrounds on ILI9341, ST7789, ST7735 and most 16-bit TFTs. The default.
RGB565A8 (v9) / TRUE_COLOR_ALPHA (v8, 16-bit)3Sprites and icons with transparency on a 16-bit build. v9 stores a colour plane followed by an alpha plane; v8 interleaves the alpha byte.
ARGB8888 / XRGB8888 (v8: 32-bit TRUE_COLOR_ALPHA / TRUE_COLOR)4Builds with LV_COLOR_DEPTH 32, or when you need full 8-bit alpha. Stored B,G,R,A in memory.
RGB888 (v9)324-bit panels; no alpha.
I1 / I2 / I4 / I8 indexed⅛ – 1 (+ palette)Logos and flat UI art with few colours. A 2-, 4-, 16- or 256-entry ARGB8888 palette is generated by median-cut and the pixels become bit-packed indices — often a 4–16× flash saving over RGB565. Transparent pixels get a reserved palette entry.
A1 / A2 / A4 / A8 alpha⅛ – 1Single-colour icons you recolour at run time with lv_obj_set_style_image_recolor(). Take the alpha from the PNG's transparency, or from dark pixels for a black-on-white source.
L8 (v9)18-bit grayscale.

Byte order, dithering and size

Byte order. LVGL keeps RGB565 little-endian; if your display controller wants the two bytes swapped, pick Big-endian / swapped. On LVGL v8 that corresponds to LV_COLOR_16_SWAP 1 (the output checks it); on v9 the driver usually swaps in the flush callback with lv_draw_sw_rgb565_swap(), and LVGL 9.3+ has LV_COLOR_FORMAT_RGB565_SWAPPED.

Dithering. Quantising a smooth photo to 65K colours (or a 16-colour palette) produces banding. With Dither on, Floyd–Steinberg error diffusion spreads the rounding error to neighbouring pixels so gradients stay smooth — the same option the LVGL converter calls “dither images”. Switch it off for pixel art and flat icons.

Size. By default every image keeps its original pixel size, like the official tool. Choose Resize to the canvas to scale, letterbox or stretch into a preset such as 320×240 for an ILI9341 background. Drop several files at once and each becomes its own descriptor in the output (and its own .bin).

Show the image in LVGL

Generate the descriptor above (named my_img), save it as my_img.c next to your sources, then:

// LVGL v9
#include "lvgl.h"
LV_IMAGE_DECLARE(my_img);

void show_logo(void) {
  lv_obj_t * img = lv_image_create(lv_screen_active());
  lv_image_set_src(img, &my_img);
  lv_obj_center(img);
}

// LVGL v8 equivalent
LV_IMG_DECLARE(my_img);
lv_obj_t * img = lv_img_create(lv_scr_act());
lv_img_set_src(img, &my_img);

In ESP-IDF add the .c file to idf_component_register(SRCS ...); in PlatformIO or Arduino just drop it in src/. Because the array is const (and tagged LV_ATTRIBUTE_LARGE_CONST) it lives in flash and costs no RAM beyond LVGL's draw buffer.

Using the .bin file from a filesystem

The .bin download is the LVGL binary image format — the header (12 bytes on v9, 4 on v8) followed by exactly the bytes in the C array. Store it on SPIFFS, LittleFS or an SD card, enable a file-system driver in lv_conf.h (LV_USE_FS_STDIO, LV_USE_FS_POSIX, LV_USE_FS_FATFS …) and load it at run time:

lv_image_set_src(img, "S:/images/my_img.bin");

Binary images keep large artwork out of the firmware so you can update them over OTA without reflashing, at the cost of a small decode latency on first draw.

Keeping flash usage down

An RGB565 image costs width × height × 2 bytes: a 320×240 ILI9341 background is 153,600 bytes. The byte count is shown live under the preview, so you can compare formats on your actual image. Typical wins: switch flat-colour UI art to I4 (16 colours, 8× smaller than RGB565), icons you tint at run time to A4 or A2, and scale photos down to the size they are displayed at rather than letting LVGL scale a bigger source.

Driving a plain SSD1306 OLED instead of a colour GUI? Use the u8g2 converter or the classic image2cpp converter. For e-ink panels see the e-paper converter, and for text, the GFX font converter.

Frequently Asked Questions

What is an LVGL image converter? +
An LVGL image converter turns a PNG, JPG or BMP into the image descriptor LVGL draws: an lv_image_dsc_t (LVGL v9) or lv_img_dsc_t (LVGL v8) that wraps a pixel byte array with a header giving width, height, stride and colour format. You then show it with lv_image_set_src(img, &my_img). This converter produces the same C array and .bin output as the official LVGL converter at lvgl.io, but runs entirely in your browser.
Does it support LVGL v9 and LVGL v8? +
Yes, pick the version in the first dropdown. LVGL v9 output uses lv_image_dsc_t with .header.magic = LV_IMAGE_HEADER_MAGIC, .header.stride and LV_COLOR_FORMAT_* enums (RGB565, RGB565A8, RGB888, ARGB8888, XRGB8888, L8, I1–I8, A1–A8). LVGL v8 output uses lv_img_dsc_t with .header.always_zero and the LV_IMG_CF_* enums (TRUE_COLOR, TRUE_COLOR_ALPHA, TRUE_COLOR_CHROMA_KEYED, INDEXED_1/2/4/8BIT, ALPHA_1/2/4/8BIT), plus a compile-time check that your LV_COLOR_DEPTH matches.
Which LVGL color format should I choose? +
RGB565 for opaque images on a 16-bit TFT (ILI9341, ST7789, ST7735) — the default. RGB565A8 (v9) or TRUE_COLOR_ALPHA (v8) for sprites and icons with transparency on a 16-bit build. ARGB8888 when your build uses LV_COLOR_DEPTH 32. Indexed I1/I2/I4/I8 when the image has few colours (logos, UI icons) and you want to cut flash by 2–16x. A1–A8 alpha masks for single-colour icons you will tint with lv_image_set_recolor / lv_obj_set_style_image_recolor.
Can I download a .bin file instead of a C array? +
Yes. The .bin button writes the LVGL binary image format: a 12-byte header (magic, colour format, flags, width, height, stride) for v9 or a 4-byte packed header for v8, followed by exactly the same pixel bytes as the C array. Put it on SPIFFS/LittleFS/SD and load it with lv_image_set_src(img, "S:/logo.bin") via the LVGL file system driver.
Little-endian or big-endian (byte swap)? +
LVGL stores RGB565 little-endian by default, so keep Little-endian unless your display driver expects the two bytes swapped. In LVGL v8 that is LV_COLOR_16_SWAP 1 in lv_conf.h; in v9 most drivers swap in the flush callback (lv_draw_sw_rgb565_swap), or on LVGL 9.3+ you can use LV_COLOR_FORMAT_RGB565_SWAPPED. If red and blue look right but the image is a scrambled mess, byte order is the culprit.
Why does my LVGL image show wrong colors or "image header magic mismatch"? +
Wrong colours almost always mean the image colour depth does not match the build (LV_COLOR_DEPTH 16 vs 32) or the bytes need swapping — the v8 output here adds an #error guard for the first case. "image header magic mismatch" means a v8-style descriptor was fed to LVGL v9: re-generate with the LVGL v9 option so .header.magic = LV_IMAGE_HEADER_MAGIC is present.
Is the LVGL converter free, and is my image uploaded? +
It is free, has no size limit beyond your browser, and never uploads anything — conversion, dithering and palette quantisation run on a Canvas in your tab, so confidential product UI art stays on your machine. Multiple files can be dropped at once; each becomes its own descriptor.

More embedded converters

Image to C++ Converter
The classic image2cpp — SSD1306, ST7735, Adafruit GFX & u8g2 byte arrays.
u8g2 Bitmap Converter
Image to u8g2 XBM / drawXBMP byte array for monochrome OLEDs.
E-Paper Image Converter
Image to Waveshare e-paper byte array, incl. black/white/red 3-color.
Adafruit GFX Font Converter
Convert a font to an Adafruit GFX font header (.h) in your browser.
Developer Calculators ↗
Bit/byte, hex, base, color & sizing calculators for embedded work.
JSON & Dev Tools ↗
Format, validate & convert JSON, CSV, base64 and more — 15 tools.