Image from SD does not load

Description

I am trying to load images from the SD Card, but the “No data” icon appears when rendering

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

STM32F407

What LVGL version are you using?

LVGL: 8.0
lv_fs_if: commit 2cad463d99244822730171243f2646686b4cd14a (on Jun 3, 2021)

What do you want to achieve?

need to draw image from SDCard

What have you tried so far?

I connected FAT FS, checked the file reading by example. Reading works. When I try to read the image, I get “No data”. I convert the image with the parameters:

  • Color format: True Color with Alpha
  • Output format: Binary (tried every)
    When calling a function lv_img_set_src under the debug, you can see that the width and height are determined correctly. I also tried different images in jpg, png formats

Code to reproduce

Example of reading a file (FATFS check)
The code block(s) should be formatted like:

    //Example of reading a file (FATFS check)
    lv_fs_file_t f;
    lv_fs_res_t res;
    res = lv_fs_open(&f, "1:res/test.txt", LV_FS_MODE_RD);

    uint32_t read_num;
    uint8_t buf[8] = {0,};
    res = lv_fs_read(&f, buf, 8, &read_num);
    lv_fs_close(&f);

    //doesn't work like that
    lv_img_set_src(target, "1:res/bleu_img3.bin");
    //this is how it works (C array)
    lv_img_set_src(target, &new_img);

Screenshot and/or video

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

Does anyone even have an image output from * .bin read from SD via FATfs? Could you attach your working image and conversion format?

Tried using without FATfs. Made on lv_lib_split_jpg Tried to open an example The result is the same “No data” on the object draws with the correct dimensions. Below is an example


    lv_obj_t * img1;
    lv_split_jpeg_init();
    img1 = lv_img_create(parent);
    LV_IMG_DECLARE( wallpaper_sjpg );
    lv_img_set_src( img1,  &wallpaper_sjpg);

Maybe someone came across?
WLfTTpZnqqo

what is target here?

This happens if you dont have enough RAM and malloc returns nullptr. Using custom malloc that allocates memory on external memory will solve the problem. For me, I set the custom malloc to be heap_caps_malloc (im using esp32 with external psram) and that solves the problem