IRONSOFTWAREHOME
Get Frame From AnyBitmap
using IronSoftware.Drawing;
using System.Collections.Generic;
using System.Linq;

//Load a GIF or TIFF as AnyBitmap (loads ALL frames)
AnyBitmap gifOrTiff = AnyBitmap.FromFile(@"FILE_PATH");

gifOrTiff.GetAllFrames.First().SaveAs("first.png"); // First frame
gifOrTiff.GetAllFrames.Last().SaveAs("last.png"); // Last frame
gifOrTiff.GetAllFrames.ElementAt(1).SaveAs("second.png"); // n'th frame

// Save every frame of a GIF or TIFF to images on disk
List<AnyBitmap> frames = (List<AnyBitmap>)gifOrTiff.GetAllFrames;
for (int i = 0 ; i < frames.Count ; i++)
{
    frames[i].SaveAs("frame_" + i + ".jpg");
}


NuGet Download
PM > Install-Package IronSoftware.System.Drawing
Get Frame From AnyBitmap

Get Frame From AnyBitmap

This feature enables users to extract or capture frames from a multipage GIF or TIFF file and save them locally in any image format. The saved frames can be further manipulated in IronDrawing or other Iron Software tools as users desire.

To use this feature, users must first convert the GIF or TIFF file into an AnyBitmap type by loading it from a file path using the AnyBitmap.FromFile(@"FILE_PATH") method. If users want to save an individual frame and know the index number of that frame, the .GetAllFrames().ElementAt(n).SaveAs("FRAME_FILE_NAME") method can be used. To get the first and last frames, simply use the .First() and .Last() methods accordingly. If users wish to save all frames according to the frame number, they can use a for loop on the frames saved in a list and use frames[i].SaveAs("frame_" + i + ".jpg").

View on GitHub

Ready to Get Started?

Nuget Downloads 20,033,450Version:2025.3just released

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

OR
bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried Iron Suite
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required