---
title: "Read Animated Gif"
canonical: https://www.graphicsmill.com/samples/Codecs/Gif/ReadAnimatedGif_cs
product: "Graphics Mill"
source: "Codecs/Gif/ReadAnimatedGif.cs"
---

# Read Animated Gif

Reads frames of animated image in GIF format.

## Instruction

Read all frames of an animated GIF image and save each frame as a separate GIF file.

## Usings

```csharp
using Aurigma.GraphicsMill.Codecs;
```

## Code Snippet

```csharp
using (var reader = new GifReader("AnimatedGIF.gif"))
{
    for (int i = 0; i < reader.Frames.Count; i++)
    {
        using (var bitmap = reader.Frames[i].GetBitmap())
        {
            bitmap.Save("ReadAnimatedGif_" + i + ".gif");
        }
    }
}
```

## Explanation

Here is a C# program that loads an animated GIF and extracts each frame into its own separate file:

This code reads `AnimatedGIF.gif`, iterates through all frames, and saves each one as `ReadAnimatedGif_0.gif`, `ReadAnimatedGif_1.gif`, etc. It demonstrates how to access and export individual frames from an animated image without using the Pipeline API.

## Tags

- [Filesystem](<https://www.graphicsmill.com/samples/tags/filesystem_md>): Loading and saving images from files
- [GIF](<https://www.graphicsmill.com/samples/tags/gif_md>): Reading, writing and animating GIFs
- [Multiple frames](<https://www.graphicsmill.com/samples/tags/multi-frame_md>): Handling multi-frame image formats
- [Read](<https://www.graphicsmill.com/samples/tags/read_md>): Reading images with codecs
- [Write](<https://www.graphicsmill.com/samples/tags/write_md>): Writing images with codecs

## Input

- [AnimatedGIF.gif](<https://www.graphicsmill.com/samples/Codecs/compiled/Debug/AnimatedGIF_gif>) (preview)

## Output

- [ReadAnimatedGif\_0.gif](<https://www.graphicsmill.com/samples/Codecs/compiled/Debug/ReadAnimatedGif_0_gif>) (preview)
- [ReadAnimatedGif\_1.gif](<https://www.graphicsmill.com/samples/Codecs/compiled/Debug/ReadAnimatedGif_1_gif>) (preview)
- [ReadAnimatedGif\_2.gif](<https://www.graphicsmill.com/samples/Codecs/compiled/Debug/ReadAnimatedGif_2_gif>) (preview)
- [ReadAnimatedGif\_3.gif](<https://www.graphicsmill.com/samples/Codecs/compiled/Debug/ReadAnimatedGif_3_gif>) (preview)
- [ReadAnimatedGif\_4.gif](<https://www.graphicsmill.com/samples/Codecs/compiled/Debug/ReadAnimatedGif_4_gif>) (preview)
- [ReadAnimatedGif\_5.gif](<https://www.graphicsmill.com/samples/Codecs/compiled/Debug/ReadAnimatedGif_5_gif>) (preview)
- [ReadAnimatedGif\_6.gif](<https://www.graphicsmill.com/samples/Codecs/compiled/Debug/ReadAnimatedGif_6_gif>) (preview)
- [ReadAnimatedGif\_7.gif](<https://www.graphicsmill.com/samples/Codecs/compiled/Debug/ReadAnimatedGif_7_gif>) (preview)

## Used APIs

- [Aurigma.GraphicsMill.Codecs.Frame.GetBitmap](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Codecs_Frame_GetBitmap.htm.md>)
- [Aurigma.GraphicsMill.Codecs.FrameCollectionBase.Count](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Codecs_FrameCollectionBase_Count.htm.md>)
- [Aurigma.GraphicsMill.Codecs.GifReader](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Codecs_GifReader.htm.md>)
- [Aurigma.GraphicsMill.Codecs.GifReader.Frames](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Codecs_GifReader_Frames.htm.md>)
