How to load image from file into memory and display from memory?

Important: unclear posts may not receive useful answers.

Before posting

  • Get familiar with Markdown to format and structure your post
  • Be sure to update lvgl from the latest version from the master branch.
  • Be sure you have checked the FAQ and read the relevant part of the documentation.
  • If applicable use the Simulator to eliminate hardware related issues.

Delete this section if you read and applied the mentioned points.

Description

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

PIC32MZ

What LVGL version are you using?

V8.20

What do you want to achieve?

What have you tried so far?

Code to reproduce

The code block(s) should be formatted like:

FIL File;
FILINFO FileInf;
int NumBytesRead = 0;
f_open(&File, "S:\\Test.bin", FA_READ);
f_stat(patch,&FileInf);
char *pic = (char *)malloc_DDR2(FileInf.fsize);
f_read(&File, pic, FileInf.fsize, &NumBytesRead);

lv_obj_t *Logo = lv_img_create(WinStartMenu); 	
lv_img_set_src(Logo, pic);
lv_obj_set_x(Logo, 0);
lv_obj_set_y(Logo, 0);
lv_disp_load_scr(WinStartMenu);

Screenshot and/or video

I do as described above, but the image does not appear
if i do like this lv_img_set_src(Logo, “S:\Test.bin”);
That image appears.

If you are using the standard f_open you should use normal file path too. E.g. f_open(&File, "Test.bin", FA_READ);

If you are using FATFS and want to display images directly from file you should enable LV_USE_FS_FATFS in lv_conf.h. After that you can do

lv_img_set_src(Logo, "S:/Test.bin");