To split a multipage TIFF in C#, load it with OneImage, loop over Frames and save each page with Frames[i].ToImage().Save(...). Each page is a frame with its own size, and it can be saved as a TIFF, PNG, JPEG or WebP, resized or converted first. It’s pure .NET code with no native libraries, so it runs the same on Windows, Linux, macOS and in containers. This page shows how to count pages, split, convert, open fax TIFFs and recompress a whole file. Every sample was run against OneImage 1.10.2 on .NET 10.
dotnet add package RecursiveAI.OneImageThe examples use document.tif, a three-page LZW-compressed TIFF written by another library, with a gray 850×1100 page, a color 1275×1650 page and a 1200×800 photo, and fax.tif, a two-page 1-bit TIFF with CCITT Group 4 compression.
What a multipage TIFF is
A TIFF file is a chain of image directories, each describing one image. A multipage or multi-frame TIFF is simply a file with more than one, which is why scanners, fax software and document archives use it to keep a whole document in one file. Each page has its own size, color type and compression. There is no separate “multi-TIFF” format: it’s the same file type with the same .tif or .tiff extension.
Count the pages of a TIFF
using OneImage; // Reads only the headers: no page is decoded. ImageInfo info = Image.Identify("document.tif"); Console.WriteLine($"{info.Frames.Count} pages"); for (int i = 0; i < info.Frames.Count; i++) { FrameInfo page = info.Frames[i]; Console.WriteLine($"page {i + 1}: {page.Width}x{page.Height}, {page.Format}"); }
3 pages page 1: 850x1100, Gray/U8/None page 2: 1275x1650, Rgb/U8/None page 3: 1200x800, Rgb/U8/None
Image.Identify reads only the directories, not the pixel data, so it’s cheap even on large files. Pages can differ in size and color, as here. Image.Load gives the same count as FrameCount, and its Width and Height are those of the first page.
Split a multipage TIFF into single pages
using OneImage; Image tiff = Image.Load("document.tif"); // One single-page TIFF per page: page-1.tif, page-2.tif, ... for (int i = 0; i < tiff.FrameCount; i++) { tiff.Frames[i].ToImage().Save($"page-{i + 1}.tif"); }
This wrote three single-page TIFFs of 850×1100, 1275×1650 and 1200×800, LZW compressed, which is the TIFF encoder’s default. Frames[i].ToImage() turns one page into an ordinary single-frame image. Loading reads only the headers, and each page is decoded when it’s saved.
Convert TIFF pages to PNG or JPG
using OneImage; Image tiff = Image.Load("document.tif"); // Every page to PNG, and a 300 px wide JPEG preview of each. for (int i = 0; i < tiff.FrameCount; i++) { Image page = tiff.Frames[i].ToImage(); page.Save($"page-{i + 1}.png"); page.Resize(width: 300).Save($"page-{i + 1}-preview.jpg"); }
The output format follows the file extension. This wrote three PNGs at full size and three JPEG previews 300 pixels wide. A gray page stays gray in both formats. Save to .webp for smaller web previews. Our page on compressing images in C# covers quality settings.
Saving the whole image to .jpg or .bmp writes the first page only, because those formats hold one image. For a file per page, loop over Frames as above.
Get one page from a TIFF
using OneImage; // Only the second page is decoded. Image second = Image.Load("document.tif").Frames[1].ToImage(); second.Save("page-2.jpg"); Console.WriteLine($"{second.Width}x{second.Height}");
Only the second page is decoded. This printed 1275x1650 and wrote that page as a JPEG.
Open fax and scanner TIFFs
using OneImage; // A two-page fax TIFF, 1-bit and CCITT Group 4 compressed. Image fax = Image.Load("fax.tif"); Console.WriteLine($"{fax.FrameCount} pages, {fax.Frames[0].Format}"); for (int i = 0; i < fax.FrameCount; i++) { fax.Frames[i].ToImage().Save($"fax-{i + 1}.png"); }
Fax machines and many document scanners write 1-bit pages with CCITT Group 3 or Group 4 compression. They load like any other TIFF, as 8-bit gray, and our two Group 4 pages came out pixel for pixel equal to an independent decoder’s output. The reader also handles strips and tiles, BigTIFF, LZW, Deflate, PackBits and JPEG compression, predictors, 1- to 16-bit and 32-bit float samples, and gray, RGB, palette and CMYK pages.
Recompress or convert every page
using OneImage; Image tiff = Image.Load("document.tif"); // Saving the whole image writes every page. Choose the compression here. tiff.Save("document-deflate.tif", new SaveOptions { EncoderOptions = new TiffEncoderOptions { Compression = TiffCompression.Deflate, DeflateLevel = 9 }, }); // Operations apply to every page: here, a grayscale copy of the whole document. tiff.Grayscale(toGrayFormat: true).Save("document-gray.tif"); foreach (string file in new[] { "document.tif", "document-deflate.tif", "document-gray.tif" }) { Console.WriteLine($"{file}: {Image.Identify(file).Frames.Count} pages, {new FileInfo(file).Length / 1024:N0} KB"); }
document.tif: 3 pages, 4,062 KB document-deflate.tif: 3 pages, 2,475 KB document-gray.tif: 3 pages, 1,434 KB
Saving the loaded image writes all pages again. With Deflate at level 9 the file shrank from 4,062 KB to 2,475 KB, and every page decoded to the same pixels as before. Operations apply to every page, so a Grayscale, Resize or Rotate before Save changes the whole document. The grayscale copy here is 1,434 KB. The TIFF encoder writes no compression, LZW, Deflate or PackBits at 8, 16 or 32-bit float, and BigTIFF (BigTiff = true) for files over 4 GiB.
Large and untrusted TIFF files
TIFF is a complex format, and uploaded files can be damaged or deliberately malformed. OneImage parses TIFF in bounds-checked managed code and checks every size from the headers against limits before it allocates: by default at most 1,000 pages, 65,535 pixels per side and 228 pixels per page. Adjust them with LoadOptions.Limits when you accept uploads, and a file over a limit fails with an ImageLimitException before its pixels are read.
To turn a PDF into a multipage TIFF, see converting PDF to TIFF in C#. For other formats and operations, start at the OneImage overview.