Stop gif Animation after all frames are shown

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Stop gif Animation after all frames are shown


      I have using Image_SetGif to display a gif but wanted to stop the Gif animation after last frame is displayed. Currently the Gif is displayed in a continuous loop.
      Animated sprites are one option but it seems sprites take up lot of memory so I wanted to use Image_SetGif only and stop the anination.
      Is there any way to do this?

    • Hi,

      animated sprites take up more memory while GIF files require less memory, but are heavier on performance because the file needs to be read and decompressed first.

      An easy way would be displaying an animated sprite using an animation that only runs a single time.

      If you prefer to use the GIF file, you can read the delay of a single frame using the routine GUI_GIF_GetImageInfo() or GUI_GIF_GetImageInfoEx(). You could hide the IMAGE widget when the total delay of all frames is over.

      Best regards,