GIFs using LVGL

Description

I am trying to show a GIF on a display using LVGL. but the screen is always white.

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

ESP32 and ESP32S3

What LVGL version are you using?

LVGL V8.0.2

What do you want to achieve?

show a GIF on a display

What have you tried so far?

  1. Made LVGL run on the ESP32 and displayed a widget without any issues
  2. Downloaded 2 GIFs. 1 from the LVGL example page for gifs and one from google
  3. converted both Gifs using the online LVGL image converter as well as cloning the image converter git repo. So i was with 4 C array files. 2 converted with online tool and other 2 with the git repo version. (I have selected the RAW format just like the example suggested)
  4. followed the instruction on the LVGL docs example and created an gif widget.
  5. Pushed the firmware with each C array. (So each firmware version had only 1 C array. So i have tried all 4 C arrays in 4 different times)
  6. But nothing on the screen.

Code to reproduce

Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.

The code block(s) should be formatted like:

    LV_IMG_DECLARE(compatible_gif);
    static lv_obj_t *img;
    img = lv_gif_create(lv_scr_act());
    lv_gif_set_src(img, &compatible_gif);
    lv_obj_align(img, LV_ALIGN_LEFT_MID, 20, 0);
1 Like

I’m experiencing the exact same issue with v8.3
Did you ever find the root cause?

Hi,
same here brother :frowning: i just dont understand the issue, it prbly is the software which makes the gifs , as when i tried to use the example gif which was rendered again through another software it did not display.
please pass along the solution if anyone found it.
thanks a lot

well apparently i got it working i can just see gifs with 60x80 res nothing more

edit: i got this working apparently the solution is to increase mem in conf file
i personally just did this

/*=========================
   MEMORY SETTINGS
 *=========================*/

/*1: use custom malloc/free, 0: use the built-in `lv_mem_alloc()` and `lv_mem_free()`*/
#define LV_MEM_CUSTOM 1  /* Enable custom memory allocation */
#if LV_MEM_CUSTOM == 0
    /* Size of the memory available for `lv_mem_alloc()` in bytes (>= 2kB) */
    #define LV_MEM_SIZE (128U * 1024U)  /* Increase memory to 128KB */

    /* Set an address for the memory pool instead of allocating it as a normal array. Can be in external SRAM too. */
    #define LV_MEM_ADR 0     /* 0: unused */
    /* Instead of an address, give a memory allocator that will be called to get a memory pool for LVGL. E.g., my_malloc */
    #if LV_MEM_ADR == 0
        #undef LV_MEM_POOL_INCLUDE
        #undef LV_MEM_POOL_ALLOC
    #endif

#else       /* LV_MEM_CUSTOM */
    #define LV_MEM_CUSTOM_INCLUDE <stdlib.h>   /* Header for dynamic memory functions */
    #define LV_MEM_CUSTOM_ALLOC   malloc       /* Use standard malloc */
    #define LV_MEM_CUSTOM_FREE    free         /* Use standard free */
    #define LV_MEM_CUSTOM_REALLOC realloc      /* Use standard realloc */
#endif     /* LV_MEM_CUSTOM */

/* Number of the intermediate memory buffers used during rendering and other internal processing mechanisms. */
/* Reduce from 16 to 8 to free up memory for GIF decoding */
#define LV_MEM_BUF_MAX_NUM 8

/* Use the standard `memcpy` and `memset` instead of LVGL's own functions. (Might or might not be faster). */
#define LV_MEMCPY_MEMSET_STD 1```


also i have been editing the header in c file for gif to this

const lv_img_dsc_t logo_gif = {
{
LV_IMG_CF_RAW,
0,
0,
0,
0,
},
80875,
logo_gif_map,
};