Trouble displaying GIFs from SD Card in V8.1.1

Description

Trying to display GIFs. Just get white rectangle but can see it is sending repeated SPI data so almost there!

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

Teensy 4.1

What LVGL version are you using?

Master 8.1.1

What do you want to achieve?

Display GIFs!

What have you tried so far?

Installed “lv_lib_gif/lv_gif.h” and the examples and the example.gif file on SD Card

I’ve also tried using the compiled version of the gif also in the example not using SD Card.

Some aspects of the documentation seem incompatible with 8.1.1?

Code to reproduce

I’m using the supplied example.gif in the lv_lib_gif library which is on the SD Card. I have this set:

/*GIF decoder library*/
#define LV_USE_GIF 1

The example from the MASTER documentation says use:

   lv_obj_t *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 */
    lv_gif_set_src(img, "S:example.gif");
   lv_obj_align(img, LV_ALIGN_RIGHT_MID, -20, 0);

But lv_gif_create() and lv_gif_set_src() are not in the lv_lib_gif/lv_gif.c library??

All that has is:

lv_obj_t * lv_gif_create_from_file(lv_obj_t * parent, const char * path)

So, I have tried:

  lv_obj_t *img = lv_img_create(lv_disp_get_scr_act(NULL));
  lv_gif_create_from_file(img, "S:example.gif");
  lv_obj_center(img);

That compiles, runs, finds the file and draws a rectangle on the screen at 33fps and 10% CPU load with lots of continuous SPI activity, so I can see it is trying, but it is just a white rectangle.

I’m assuming this is because the img type is wrong? But lv_obj_t *img = lv_gif_create(lv_scr_act()); will not compile.

What am I missing? Have I loaded the wrong gif library from LVGL Github?

https://github.com/lvgl/lv_lib_gif

Thank you very much for your help.

Screenshot and/or video

As far as I know gif decoder merged to master branch in lvgl_v8. Try to use it.

I can see what is happening. It is not linking to the “extra” directory and all the libs in there. It is enabled in config but not working. I’ll check.

OK, I’ve got it loading the right version and all the libs, lv_gif_create() and lv_gif_set_src() now load and the example compiles and runs, but the screen looks exactly the same - just a white rectangle. I’ll get some logs next. Thanks.

Fixed it. Two issues, #define LV_BUILD_EXAMPLES 1 must be set to load the gif and other decoders and I had not fully implemented my seek callback.

I’ve updated my post where you helped me with SD Card integration earlier to correct the seek call back so as to not mislead others.

Thanks for pointing me in the right direction with the merged decoder.