# lv_gif.h (/api/public/widgets/lv_gif_h)



<ApiSummary functions="13" variables="1" />

Functions [#functions]

<ApiTabs items="[&#x22;Setters (4)&#x22;,&#x22;Getters (4)&#x22;,&#x22;Other (5)&#x22;]">
  <ApiTab value="Setters (4)">
    <ApiMember kind="function" name="lv_gif_set_color_format" file="public/widgets/lv_gif.h" line="52" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/widgets/lv_gif.h#L52">
      lv_gif_set_color_format [#lv_gif_set_color_format]

      Set the color format of the internally allocated framebuffer that the gif will be decoded to. The default is LV\_COLOR\_FORMAT\_ARGB8888. Call this before `lv_gif_set_src` to avoid reallocating the framebuffer.

      ```c title=" " lineNumbers=1
      void lv_gif_set_color_format(lv_obj_t *obj, lv_color_format_t color_format)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name           | Type                                             | Description                             |
      | -------------- | ------------------------------------------------ | --------------------------------------- |
      | `obj`          | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to a gif object                 |
      | `color_format` | <ApiLink name="lv_color_format_t" />             | the color format of the gif framebuffer |
    </ApiMember>

    <ApiMember kind="function" name="lv_gif_set_src" file="public/widgets/lv_gif.h" line="61" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/widgets/lv_gif.h#L61">
      lv_gif_set_src [#lv_gif_set_src]

      Set the gif data to display on the object

      ```c title=" " lineNumbers=1
      void lv_gif_set_src(lv_obj_t *obj, const void *src)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name  | Type                                             | Description                                                                                                                                                                                              |
      | ----- | ------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
      | `obj` | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to a gif object                                                                                                                                                                                  |
      | `src` | `const void *`                                   | 1) pointer to an <ApiLink name="lv_image_dsc_t" /> descriptor (which contains gif raw data) or 2) path to a gif file (e.g. "S:/dir/anim.gif") **May** be `NULL`. When NULL the current source is closed. |
    </ApiMember>

    <ApiMember kind="function" name="lv_gif_set_loop_count" file="public/widgets/lv_gif.h" line="98" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/widgets/lv_gif.h#L98">
      lv_gif_set_loop_count [#lv_gif_set_loop_count]

      Set the loop count for the GIF.

      ```c title=" " lineNumbers=1
      void lv_gif_set_loop_count(lv_obj_t *obj, int32_t count)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name    | Type                                             | Description           |
      | ------- | ------------------------------------------------ | --------------------- |
      | `obj`   | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to a gif obj  |
      | `count` | `int32_t`                                        | the loop count to set |
    </ApiMember>

    <ApiMember kind="function" name="lv_gif_set_auto_pause_invisible" file="public/widgets/lv_gif.h" line="105" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/widgets/lv_gif.h#L105">
      lv_gif_set_auto_pause_invisible [#lv_gif_set_auto_pause_invisible]

      Set whether to decode invisible object.

      ```c title=" " lineNumbers=1
      void lv_gif_set_auto_pause_invisible(lv_obj_t *obj, bool auto_pause)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name         | Type                                             | Description                                              |
      | ------------ | ------------------------------------------------ | -------------------------------------------------------- |
      | `obj`        | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to a gif object                                  |
      | `auto_pause` | `bool`                                           | true: auto pause when invisible, false: don't auto pause |
    </ApiMember>
  </ApiTab>

  <ApiTab value="Getters (4)">
    <ApiMember kind="function" name="lv_gif_get_loop_count" file="public/widgets/lv_gif.h" line="91" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/widgets/lv_gif.h#L91">
      lv_gif_get_loop_count [#lv_gif_get_loop_count]

      Get the loop count for the GIF.

      ```c title=" " lineNumbers=1
      int32_t lv_gif_get_loop_count(lv_obj_t *obj)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name  | Type                                             | Description          |
      | ----- | ------------------------------------------------ | -------------------- |
      | `obj` | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to a gif obj |
    </ApiMember>

    <ApiMember kind="function" name="lv_gif_get_size" file="public/widgets/lv_gif.h" line="114" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/widgets/lv_gif.h#L114">
      lv_gif_get_size [#lv_gif_get_size]

      Get gif width & height

      ```c title=" " lineNumbers=1
      bool lv_gif_get_size(const char *src, uint16_t *w, uint16_t *h)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name  | Type           | Description             |
      | ----- | -------------- | ----------------------- |
      | `src` | `const char *` | pointer to a gif file   |
      | `w`   | `uint16_t *`   | pointer to store width  |
      | `h`   | `uint16_t *`   | pointer to store height |

      **Returns:** `bool` — true: success; false: failed
    </ApiMember>

    <ApiMember kind="function" name="lv_gif_get_frame_count" file="public/widgets/lv_gif.h" line="121" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/widgets/lv_gif.h#L121">
      lv_gif_get_frame_count [#lv_gif_get_frame_count]

      Get frame count of the GIF.

      ```c title=" " lineNumbers=1
      int32_t lv_gif_get_frame_count(lv_obj_t *obj)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name  | Type                                             | Description             |
      | ----- | ------------------------------------------------ | ----------------------- |
      | `obj` | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to a gif object |

      **Returns:** `int32_t` — frame count of the GIF
    </ApiMember>

    <ApiMember kind="function" name="lv_gif_get_current_frame_index" file="public/widgets/lv_gif.h" line="128" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/widgets/lv_gif.h#L128">
      lv_gif_get_current_frame_index [#lv_gif_get_current_frame_index]

      Get the current frame index of the GIF.

      ```c title=" " lineNumbers=1
      int32_t lv_gif_get_current_frame_index(lv_obj_t *obj)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name  | Type                                             | Description             |
      | ----- | ------------------------------------------------ | ----------------------- |
      | `obj` | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to a gif object |

      **Returns:** `int32_t` — current frame index of the GIF
    </ApiMember>
  </ApiTab>

  <ApiTab value="Other (5)">
    <ApiMember kind="function" name="lv_gif_create" file="public/widgets/lv_gif.h" line="43" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/widgets/lv_gif.h#L43">
      lv_gif_create [#lv_gif_create]

      Create a gif object

      ```c title=" " lineNumbers=1
      lv_obj_t * lv_gif_create(lv_obj_t *parent)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name     | Type                                             | Description                                                                                                         |
      | -------- | ------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------- |
      | `parent` | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to a parent widget **May** be `NULL`.. When NULL, the widget is created as a screen on the default display. |

      **Returns:** <ApiLink name="lv_obj_t" display="lv_obj_t *" /> — pointer to the gif obj
    </ApiMember>

    <ApiMember kind="function" name="lv_gif_restart" file="public/widgets/lv_gif.h" line="67" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/widgets/lv_gif.h#L67">
      lv_gif_restart [#lv_gif_restart]

      Restart a gif animation.

      ```c title=" " lineNumbers=1
      void lv_gif_restart(lv_obj_t *obj)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name  | Type                                             | Description          |
      | ----- | ------------------------------------------------ | -------------------- |
      | `obj` | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to a gif obj |
    </ApiMember>

    <ApiMember kind="function" name="lv_gif_pause" file="public/widgets/lv_gif.h" line="73" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/widgets/lv_gif.h#L73">
      lv_gif_pause [#lv_gif_pause]

      Pause a gif animation.

      ```c title=" " lineNumbers=1
      void lv_gif_pause(lv_obj_t *obj)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name  | Type                                             | Description          |
      | ----- | ------------------------------------------------ | -------------------- |
      | `obj` | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to a gif obj |
    </ApiMember>

    <ApiMember kind="function" name="lv_gif_resume" file="public/widgets/lv_gif.h" line="79" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/widgets/lv_gif.h#L79">
      lv_gif_resume [#lv_gif_resume]

      Resume a gif animation.

      ```c title=" " lineNumbers=1
      void lv_gif_resume(lv_obj_t *obj)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name  | Type                                             | Description          |
      | ----- | ------------------------------------------------ | -------------------- |
      | `obj` | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to a gif obj |
    </ApiMember>

    <ApiMember kind="function" name="lv_gif_is_loaded" file="public/widgets/lv_gif.h" line="85" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/widgets/lv_gif.h#L85">
      lv_gif_is_loaded [#lv_gif_is_loaded]

      Checks if the GIF was loaded correctly.

      ```c title=" " lineNumbers=1
      bool lv_gif_is_loaded(lv_obj_t *obj)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name  | Type                                             | Description          |
      | ----- | ------------------------------------------------ | -------------------- |
      | `obj` | <ApiLink name="lv_obj_t" display="lv_obj_t *" /> | pointer to a gif obj |
    </ApiMember>
  </ApiTab>
</ApiTabs>

Variables [#variables]

<ApiMember kind="variable" name="lv_gif_class" file="public/widgets/lv_gif.h" line="31" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/include/lvgl/widgets/lv_gif.h#L31">
  lv_gif_class [#lv_gif_class]

  ```c title=" " lineNumbers=1
  const lv_obj_class_t lv_gif_class
  ```
</ApiMember>

Dependencies [#dependencies]

<FileIncludes includes="[&#x22;lv_conf_internal.h&#x22;, &#x22;lv_color.h&#x22;]" includedBy="[&#x22;lvgl.h&#x22;]" transitiveIncludes="[&#x22;lv_assert.h&#x22;, &#x22;lv_color_op.h&#x22;, &#x22;lv_log.h&#x22;, &#x22;lv_math.h&#x22;, &#x22;lv_mem.h&#x22;, &#x22;lv_palette.h&#x22;, &#x22;lv_types.h&#x22;]" />
