using System.Drawing; using System.Drawing.Imaging; // Load image from file Image image = Image.FromFile("example.gif"); // Get the number of frames in the image int frameCount = image.GetFrameCount(FrameDimension.Time); Console.WriteLine("Number of frames: " + frameCount);
using System.Drawing; using System.Drawing.Imaging; // Load image from file Image image = Image.FromFile("example.tif"); // Get the number of frames in the image int frameCount = image.GetFrameCount(FrameDimension.Page); for (int i = 0; i < frameCount; i++) { // Select the ith frame image.SelectActiveFrame(FrameDimension.Page, i); // Do something with the frame // ... }This example loads a multi-page tiff image from a file and uses the GetFrameCount method to determine the number of pages (frames) in the image. It then loops through each page and selects it using the SelectActiveFrame method. This allows you to work with each page (frame) individually. The package library used in these examples is System.Drawing.