LVGL GIF and PNG example not working


///=================================================================
///@brief Init_SD()
///=================================================================
void Init_SD()
{
if (!SD.begin(SD_CS))
{
  Serial.println("SD Card Init : Error");
  return;
}
else
Serial.println("SD Card Init : Success");
load_image_from_sd("/icon50/storm-night.jpg", 20,40, 50, 50);
load_image_from_sd("/icon50/Storm.jpg", 20,100, 50, 50);
load_image_from_sd("/gif/Eintracht.gif", 50,20, 100, 100);

lv_example_png_1("/PNG/wink.png", 100, 100);
lv_example_png_1("/PNG/Test.png", 10, 100);
lv_example_gif_1("/gif/Love.gif", 200, 10);
lv_example_gif_1("/gif/Eintracht.gif", 200, 110);

}



void lv_example_png_1(const char filename[],const int x, const int y )
{
    LV_IMG_DECLARE(img_wink_png);
    lv_obj_t * img;
/*
    img = lv_img_create(lv_scr_act());
    lv_img_set_src(img, &img_wink_png);
    lv_obj_align(img, LV_ALIGN_TOP_LEFT, 20, 10);
*/
    img = lv_img_create(lv_scr_act());
    /* Assuming a File system is attached to letter 'A'
     * E.g. set LV_USE_FS_STDIO 'A' in lv_conf.h */
    if (SD.exists(filename))
    Serial.printf("File : %s Success\n", filename);
    else
    Serial.printf("File : %s Error\n", filename);
    lv_img_set_src(img, filename);
    lv_obj_align(img, LV_ALIGN_TOP_LEFT, x, y);
}


void lv_example_gif_1(const char filename[],const int x, const int y )
{
    LV_IMG_DECLARE(img_bulb_gif);
    lv_obj_t * img;
/*
    img = lv_gif_create(lv_scr_act());
    lv_gif_set_src(img, &img_bulb_gif);
    lv_obj_align(img, LV_ALIGN_LEFT_MID, 20, 0);
*/
    img = lv_gif_create(lv_scr_act());
    /* Assuming a File system is attached to letter 'A'
     * E.g. set LV_USE_FS_STDIO 'A' in lv_conf.h */
        if (SD.exists(filename))
    Serial.printf("File : %s Success\n", filename);
    else
    Serial.printf("File : %s Error\n", filename);
    lv_gif_set_src(img, filename);
    lv_obj_align(img, LV_ALIGN_TOP_LEFT, x, y);
}

In this Code the JPG are working well because I removed Progressiv and Baseline with Gimp but No Success with Loading the PNG and GIF from LVGL Example. What I’m doing wrong ?

How to Use It

  1. Enable the STDIO File System Driver:
  • In your lv_conf.h file, ensure that LV_USE_FS_STDIO is defined as 1: C#define LV_USE_FS_STDIO 1

Verwende den Code mit Vorsicht.
2. Set the Drive Letter:

  • Define the LV_FS_STDIO_LETTER macro to the desired letter. This letter will be used as a prefix for file paths when accessing files using the stdio driver. For example: C#define LV_FS_STDIO_LETTER 'S'

Verwende den Code mit Vorsicht.

This means that to access a file named my_file.txt on your system, you would use the path S:/my_file.txt in your LVGL code.

Example Usage:

`Clv_fs_file_t file;
lv_fs_res_t res;

res = lv_fs_open(&file, “S:/my_file.txt”, LV_FS_MODE_RD);
if (res == LV_FS_RES_OK) {
// File opened successfully
// …
lv_fs_close(&file);
} else {
LV_LOG_ERROR(“Failed to open file: %d”, res);
}`

This was helping me !