How to load image


Perhaps this was discussed and I missed how I can upload a picture of the format png or jpg
the picture weighs a lot, more than 4MB, but in principle I can compress it …

What MCU/Processor/Board and compiler are you using?


What LVGL version are you using?


What do you want to achieve?

What have you tried so far?

Code to reproduce

    lv_obj_t * img= lv_img_create(lv_scr_act(), NULL);
    lv_img_set_src(img, "test.png");

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.

For a png file,
you will need a additional library !
like loadpng …
nav_destination contains the png…

During setup
  //init decoder

    nav_dest_png.header.always_zero = 0;
    nav_dest_png.header.w = 95;
    nav_dest_png.header.h = 95; = LV_IMG_CF_RAW_ALPHA;
    nav_dest_png.data_size = size; = nav_destination_src;
    lv_obj_align(imgMaps, NULL, LV_ALIGN_IN_TOP_LEFT, 15, 20);

    Serial.print("redraw image!");
    lv_img_set_src(imgMaps, &nav_dest_png);

could you provide a link to the file?

To which file ?
To loadpng or lv_lib_png is here…

“Just” pull repo, into libraries folder,
include the .h file, and do the init…
1 Like

now there will be stupid questions on my part
i`m init decoder

and that’s what he says to me Clion
can you help me?

Hmm, this has something to do with your Project/include setup.
The example image, png_decoder_test.c should be available… Maybe you need to copy the .c file into your project…

the problem was in my settings cLion, thanks for your assist)))