2021-10-04 14:34:11 +02:00
# GIF decoder
2022-01-17 14:10:23 +01:00
Allow using GIF images in LVGL. Based on https://github.com/lecram/gifdec
2021-10-04 14:34:11 +02:00
When enabled in `lv_conf.h` with `LV_USE_GIF` `lv_gif_create(parent)` can be used to create a gif widget.
2022-01-17 14:10:23 +01:00
`lv_gif_set_src(obj, src)` works very similarly to `lv_img_set_src` . As source, it also accepts images as variables (`lv_img_dsc_t` ) or files.
2021-10-04 14:34:11 +02:00
## Convert GIF files to C array
To convert a GIF file to byte values array use [LVGL's online converter ](https://lvgl.io/tools/imageconverter ). Select "Raw" color format and "C array" Output format.
2022-03-21 18:25:51 +08:00
2021-10-04 14:34:11 +02:00
## Use GIF images from file
For example:
```c
lv_gif_set_src(obj, "S:path/to/example.gif");
```
2022-03-21 18:25:51 +08:00
Note that, a file system driver needs to be registered to open images from files. Read more about it [here ](https://docs.lvgl.io/master/overview/file-system.html ) or just enable one in `lv_conf.h` with `LV_USE_FS_...`
2021-10-04 14:34:11 +02:00
## Memory requirements
To decode and display a GIF animation the following amount of RAM is required:
2022-03-21 18:25:51 +08:00
- `LV_COLOR_DEPTH 8` : 3 x image width x image height
- `LV_COLOR_DEPTH 16` : 4 x image width x image height
- `LV_COLOR_DEPTH 32` : 5 x image width x image height
2021-10-04 14:34:11 +02:00
## Example
```eval_rst
2021-10-04 15:03:49 +02:00
.. include:: ../../examples/libs/gif/index.rst
2021-10-04 14:34:11 +02:00
```
## API
```eval_rst
.. doxygenfile:: lv_gif.h
:project: lvgl
```