Table of Contents

Method ExtractFramesFromGif

Namespace
Alternet.Drawing
Assembly
Alternet.UI.Common.dll

ExtractFramesFromGif(string?)

Extracts all frames from a GIF image file at the specified URL or path. In order to build file name into url, use PrepareFileUrl(string).

public static AnimatedImageFrameInfo[] ExtractFramesFromGif(string? url)

Parameters

url string

The resource URL or path to the GIF file to extract frames from. The file must exist and be accessible.

Returns

AnimatedImageFrameInfo[]

An array of AnimatedImageFrameInfo objects, each representing a frame extracted from the GIF image.

Remarks

This method opens the specified file for reading and extracts its frames. The file must be in a valid GIF format.

ExtractFramesFromGif(Stream)

Extracts all frames from a GIF image stream and returns an array containing information about each frame, including composited and original bitmaps, duration, and frame dependencies.

public static AnimatedImageFrameInfo[] ExtractFramesFromGif(Stream stream)

Parameters

stream Stream

The input stream containing GIF image data. The stream must support seeking and should be positioned at the beginning of the GIF data.

Returns

AnimatedImageFrameInfo[]

An array of AnimatedImageFrameInfo objects, each representing a frame extracted from the GIF, including both the original partial frame and the fully composited frame for playback.

Remarks

The method seeks to the beginning of the stream if it is seekable. Each AnimatedImageFrameInfo in the returned array contains both the original frame bitmap and the composited bitmap, which represents the full image as it should appear at that frame in the animation. The caller is responsible for disposing the bitmaps contained in the returned objects.

Exceptions

Exception

Thrown if the provided stream does not contain a valid or supported GIF image format.