Display PNG images shows ‘No data’ when image size is bigger than 50x50 pixels
What MCU/Processor/Board and compiler are you using?
ESP32 (WT32-SC01 board)
What LVGL version are you using?
8.3.9 (also tried 8.3.1, same results)
What do you want to achieve?
Display PNG images bigger than 50x50 pixels
What have you tried so far?
Changed PNG image size until found that limit is 50x50, bigger images are not displayed and only shows ‘No data’ in the screen. In the screenshot, both files are placed in SPIFFS and the both are valid PNG images. Looks like is something related to the image size.
Code to reproduce
lv_obj_t *mainIcon;
mainIcon = lv_img_create(mainInfo);
lv_obj_set_pos(mainIcon, 70, 100);
lv_img_set_src(mainIcon, "A:spiffs/10d.png"); // this image is displayed
mainIcon = lv_img_create(mainInfo);
lv_obj_set_pos(mainIcon, 200, 100);
lv_img_set_src(mainIcon, "A:spiffs/png_demo.png"); // this image shows 'No data'
Sadly I have no clue, however have you tried declaring a different lv_obj_t* and calling lv_img_create on that instead? I know you probably have but that is the only possible issueI can spot in the code you posted.
Also, have you converted the big images beforehand? From the docs: To use external files, you also need to convert the image files using the online converter tool but now you should select the binary output format. You also need to use LVGL's file system module and register a driver with some functions for the basic file operation. Go to the [File system](https://docs.lvgl.io/8.3/overview/file-system.html) to learn more. To set an image sourced from a file, uselv_img_set_src(img, “S:folder1/my_img.bin”).
Otherwise I do not know, documentation does not mention anything about big images.
I’m currently using a workaround, I have converted the images to .h files with the array on values for each pixel. It works fine.
I will try using the bin format, as you proposed, but it’s kind of weird the limit of 50x50px size, don’t you think?
You were right, setting LV_MEM_CUSTOM 1 solved the problem. Anyway, it’s weird because I changed the LV_MEM_SIZE to a size bigger than the images and didn’t work. The memory management when LV_MEM_CUSTOM is set to 1 made it worl.