Image transparent

Hi everyone ,
I am trying to make the image transparent on lcd for which i have followd the following steps ,

To make the background orange.

static lv_style_t style;
style.body.main_color = LV_COLOR_ORANGE ;
style.body.grad_color = LV_COLOR_ORANGE;

lv_obj_set_style(lv_scr_act(), &style);

In the image creation function.
void f()
static lv_style_t style;
lv_style_copy(&style, &lv_style_transp);
  //style.image.intense = LV_OPA_70;
 style.image.intense = LV_OPA_TRANSP;
  style.image.opa = LV_OPA_TRANSP ;

img = lv_img_create(lv_scr_act(), NULL);
 lv_img_set_style(img, LV_IMG_STYLE_MAIN, &style);
lv_img_set_src(img, &img_src);

lv_obj_align(img, NULL,LV_ALIGN_IN_BOTTOM_LEFT, 0, 0);


I am creating the image on image convertor by selecting color format of True color chroma keyed for making tit transparent, But i am not getting the transparent image on orange back , the background of image is showing in different color not the orange one .

How to make it transparent on background ,please suggest ,



Please use the

your code

tags to format code snippets.

Can you include the converted image to test it?

If you are just at the beginning of your project, it might be worth to update to v7.

…Below is my code snippet …

void update_battery(void)
static lv_obj_t * img_battery;
img_battery = lv_img_create(lv_scr_act(), NULL);
lv_img_set_src(img_battery_left, &battery_100);
lv_obj_align(img_battery, NULL,LV_ALIGN_IN_BOTTOM_LEFT, 0, 0);


Below is my .c file of battery image .
battery_100.c (149.4 KB)
Given image is transparent but not displaying as transparent, i have selected the color format as true color ,is this enough for make the image transparent. Can you please test this battery_100.c file .


It works well for me. Except you forget to initialize the screen style with lv_style_copy(&style, &lv_style_scr);

If it doesn’t work for any reason you can use lv_obj_set_hidden(img, true/false) too.

I formatted your the code in your first comment, please update the code in the your secoud comment.

i want to generate event if specific area from image was touched by user, like if one image displayed on LCD with 1024600 resolution and if user touches on 1 1 area then background color changes. is it possible or any hint?!