Using Images

The simplest way to use an image in LVGL is to display it with an Image (lv_image) Widget:

Edit on GitHub

The simplest way to use an image in LVGL is to display it with an Image (lv_image) Widget:

 
lv_obj_t * icon = lv_image_create(lv_screen_active());

/* From variable */
lv_image_set_src(icon, &my_img_dsc);

/* From file */
lv_image_set_src(icon, "S:my_icon.bin");

/* From Unicode string */
lv_image_set_src(icon, LV_SYMBOL_BATTERY_FULL);

If the image was converted to a variable with the online or offline converter, you should use LV_IMAGE_DECLARE(my_img_dsc) to declare the image in the file where you want to use it.

Examples

Image from variable and symbol

Image recoloring

Rotate and zoom

Image offset and styling

Open a BMP image from file

Open a PNG image from file and variable

How is this guide?

Last updated on

On this page