LVGL image converter
Files are processed locally in your browser. No image data is uploaded to the server.
Convert PNG, JPG, and WebP images into LVGL v8 lv_img_dsc_t C arrays for embedded GUI projects, with True Color, True Color Alpha, and LV_COLOR_16_SWAP options.
Files are processed locally in your browser. No image data is uploaded to the server.
LVGL represents an image as an lv_img_dsc_t struct: a header with width, height, and color format, plus a pointer to the raw pixel data. This tool generates the pixel data array and a matching lv_img_dsc_t descriptor for LVGL v8, ready to compile into your firmware.
LV_IMG_CF_TRUE_COLOR stores 2 bytes (RGB565) per pixel and is fully opaque - transparent source pixels are flattened onto the alpha background color you choose. LV_IMG_CF_TRUE_COLOR_ALPHA stores 3 bytes per pixel (RGB565 plus a raw alpha byte), which keeps real transparency and is the common choice for icons drawn over existing backgrounds.
Add the generated code to a .c file in your project, then declare it in a header with LV_IMG_DECLARE(name) and assign it to any image widget with lv_img_set_src(). The array name below becomes both the C variable and the pixel data array name.
LV_IMG_DECLARE(my_icon); lv_obj_t * img = lv_img_create(lv_scr_act()); lv_img_set_src(img, &my_icon); lv_obj_center(img);
LVGL stores each RGB565 pixel as a 16-bit value in the processor's native byte order (little-endian on virtually all MCUs). Some SPI display drivers expect the two bytes swapped on the wire. If your image looks scrambled or color channels seem swapped, enable LV_COLOR_16_SWAP here to match your lv_conf.h setting.
This tool targets the LVGL v8 lv_img_dsc_t format, which is still the format used by the large majority of deployed LVGL projects and tutorials. LVGL v9 replaced it with a different lv_image_dsc_t header (new field layout and color format enum), so v9 projects need to adapt the generated header fields manually; the pixel data itself (RGB565 bytes) can still be reused.
lv_img_dsc_t is the LVGL v8 struct that describes an image: a header with width, height and color format bitfields, a data size, and a pointer to the raw pixel bytes.
Not directly. LVGL v9 uses a different lv_image_dsc_t header format. This tool generates the LVGL v8 lv_img_dsc_t struct, which remains widely used; v9 users can reuse the pixel data but need to adjust the header fields.
This is usually a byte-order mismatch. Try enabling or disabling Swap 16-bit bytes (LV_COLOR_16_SWAP) to match your lv_conf.h configuration and display driver.
True Color stores opaque RGB565 pixels only, flattening any transparency onto a background color. True Color Alpha adds a per-pixel alpha byte so the image can stay transparent when drawn over other content, which is common for icons.
Copy the output into a .c file, add LV_IMG_DECLARE(name) to a header, and call lv_img_set_src() with a pointer to the descriptor on any image widget.