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.


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

The code block(s) should be formatted like:

FIL File;
int NumBytesRead = 0;
f_open(&File, "S:\\Test.bin", FA_READ);
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);

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");