Search code examples
c#.netanimated-gif

Getting the frame duration of an animated GIF?


In C#, I can get the individual frames from a gif and show the animation easily enough, but how do you go about getting the timing information for each frame?


Solution

  • PropertyItem item = img.GetPropertyItem (0x5100); // FrameDelay in libgdiplus
    // Time is in milliseconds
    delay = (item.Value [0] + item.Value [1] * 256) * 10;
    

    This article may be useful.