How to make my gif/animation display correctly?

I’m having trouble with displaying a gif correctly. Right after flashing, the box where the gif would be is completely white, then after a couple of minutes the first frame appears. The second one never appears though, and I’m not sure how to even try to debug it.

I tried also using the gif converted to a C array and that worked correctly, but that’s not something I want to do.

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

ESP32 on Sunton 8048S070-C

What LVGL version are you using?


  ui_Screen2 = lv_obj_create(NULL);
  img = lv_gif_create(lv_scr_act());
  lv_gif_set_src(img, "F:/littlefs/Untitled.gif");
  lv_obj_align(img, LV_ALIGN_RIGHT_MID, -20, 0);

The Untitled.gif is actually the light_bulb.gif from the docs.

The animimg aproach

The problem when using the animimg is that it consumes all the available RAM until there’s nothing left and then it reboots and starts the same thing again.

  ui_Screen2 = lv_obj_create(NULL);
  img = lv_animimg_create(lv_scr_act());
  lv_animimg_set_src(img, (const void **)anim, 35);
  lv_animimg_set_duration(img, 1000);
  lv_obj_align(img, LV_ALIGN_RIGHT_MID, -20, 0);
  ESP_LOGI(TAG, "Chart screen cleared");
  lv_animimg_set_repeat_count(img, LV_ANIM_REPEAT_INFINITE);

What I need

I just want the gif/animation to display correctly from file (series of png or gif), not from C array.

At least I’d like to know why is there a memory leak while using animimg?