GifImageAddPage Method
Adds page to the image.

Namespace: Aspose.Imaging.FileFormats.Gif
Assembly: Aspose.Imaging (in Aspose.Imaging.dll) Version: 21.05
Syntax
public void AddPage(
	RasterImage page
)

Parameters

page
Type: Aspose.ImagingRasterImage
The page to add.

Implements

IMultipageImageExtAddPage(RasterImage)
Exceptions
ExceptionCondition
ArgumentNullExceptionpage is null.
Examples
Create multipage GIF image using single page raster images.
[C#]

static void Main(string[] args)
{
    // Load frames
    var frames = LoadFrames("Animation frames").ToArray();

    // Create GIF image using the first frame
    using (var image = new GifImage(new GifFrameBlock(frames[0])))
    {
        // Add frames to the GIF image using the AddPage method
        for (var index = 1; index < frames.Length; index++)
        {
            image.AddPage(frames[index]);
        }

        // Save GIF image
        image.Save("Multipage.gif");
    }
}

private static IEnumerable<RasterImage> LoadFrames(string directory)
{
    foreach (var filePath in Directory.GetFiles(directory))
    {
        yield return (RasterImage)Image.Load(filePath);
    }
}
See Also