---
title: "Image File Helper"
source: https://github.com/obs-rust/obs-studio/blob/524486a44c81ef30b039f10ab955bc778f39e225/docs/sphinx/reference-libobs-graphics-image-file.rst
commit: 524486a44c81ef30b039f10ab955bc778f39e225
tier: reference
tokens_est: 414
---
.. _image_file_helper:

# Image File Helper

Helper functions/type for easily loading/managing image files, including
animated gif files.

.. code:: cpp

   #include <graphics/image-file.h>


`gs_image_file_ex`

   Image file structure


`gs_texture_t *gs_image_file_ex.texture`

   Texture


`struct gs_image_file_ex gs_image_file_ex_t`

   Image file type



`void gs_image_file_ex_init(gs_image_file_ex_t *image, const char *file, enum gs_image_alpha_mode alpha_mode)`

   Loads an initializes an image file helper.  Does not initialize the
   texture; call `gs_image_file_ex_init_texture()` to initialize
   the texture.

   :param image: Image file helper to initialize
   :param file:  Path to the image file to load



`void gs_image_file_ex_free(gs_image_file_ex_t *image)`

   Frees an image file helper

   :param image: Image file helper



`void gs_image_file_ex_init_texture(gs_image_file_ex_t *image)`

   Initializes the texture of an image file helper.  This is separate
   from `gs_image_file_ex_init()` because it allows deferring the
   graphics initialization if needed.

   :param image: Image file helper



`bool gs_image_file_ex_tick(gs_image_file_ex_t *image, uint64_t elapsed_time_ns)`

   Performs a tick operation on the image file helper (used primarily
   for animated file).  Does not update the texture until
   `gs_image_file_ex_update_texture()` is called.

   :param image:           Image file helper
   :param elapsed_time_ns: Elapsed time in nanoseconds



`void gs_image_file_ex_update_texture(gs_image_file_ex_t *image)`

   Updates the texture (used primarily for animated files)

   :param image: Image file helper
