# How to merge TIF images using C# Learn how to merge TIF image files, combine TIF image files into one file programmatically in C# language using GroupDocs.Merger for .NET library. ## TIF Merger .NET API [GroupDocs.Merger](https://products.groupdocs.com/merger/net) allows developers to combine multiple TIF documents in the preferred order and save them as a single file. ### About TIF File Format TIF (or TIFF) is an image format used for containing high quality graphics. It stands for “Tagged Image File Format” or “Tagged Image Format”. The format was created by Aldus Corporation, but Adobe acquired the format later and made subsequent update in this format. TIF file is capable of holding both lossy JPEG compression and lossless image data. It can also contain vector based graphics data. TIF file format is widely supported in image editing applications. For that it’s a very popular image format among Graphic artists, Photographers, and Publishing authorities. PaintShop Pro is one of the most popular applications available for handling TIF images. ### Download and Configure Use the [downloads section](https://downloads.groupdocs.com/merger/net) to download API DLLs or MSI installer or NuGet: ```csharp PM> Install-Package GroupDocs.Merger ``` ## How to merge TIF files The following example demonstrates how to merge TIF files with several lines of C# code: * Create an instance of [Merger](https://reference.groupdocs.com/merger/net/groupdocs.merger/merger) class and pass source TIF file path as a constructor parameter. You may specify absolute or relative file path as per your requirements. * Add another TIF file to merge with [Join](https://reference.groupdocs.com/merger/net/groupdocs.merger/merger/join) method. Repeat this step for other TIF documents you want to merge. * Call [Merger](https://reference.groupdocs.com/merger/net/groupdocs.merger/merger) class [Save](https://reference.groupdocs.com/merger/net/groupdocs.merger/merger/save) method and specify the filename for the merged TIF file as parameter. ```csharp // Load the source TIF file using (Merger merger = new Merger(@"c:\sample1.tif")) { // Add another TIF file to merge merger.Join(@"c:\sample2.tif"); // Merge TIF files and save result merger.Save(@"c:\merged.tif"); } ``` NOTE: You may merge other TIF formats like TIFF in the same way as shown above. For this provide files by specifying their names with extension. ### How to merge TIF files page by page A TIF file can contain several pages (frames). When you join TIF files without [ImageJoinOptions](https://reference.groupdocs.com/merger/net/groupdocs.merger.domain.options/imagejoinoptions), their pages are appended one after another into a multi-page TIF: ```csharp // Load the source TIF file using (Merger merger = new Merger(@"c:\sample1.tif")) { // Append all pages of another TIF file merger.Join(@"c:\sample2.tif"); // Save the multi-page result merger.Save(@"c:\merged.tif"); } ``` To choose which pages to keep and in which order, use [PageBuilder](https://reference.groupdocs.com/merger/net/groupdocs.merger.domain.builders/pagebuilder/). Pages can be taken from any of the files, including the first one. The document is identified by its index (starting from 0) and the page by its number (starting from 1): ```csharp using (Merger merger = new Merger(@"c:\sample1.tif")) { merger.Join(@"c:\sample2.tif"); PageBuilder pageBuilder = merger.CreatePageBuilder(); // Page 3 of the first file, page 2 of the second file, then page 1 of the first file pageBuilder.AddPage(pageBuilder.Documents[0].Index, 3); pageBuilder.AddPage(pageBuilder.Documents[1].Index, 2); pageBuilder.AddPage(pageBuilder.Documents[0].Index, 1); merger.ApplyPageBuilder(pageBuilder); merger.Save(@"c:\merged.tif"); } ``` {{< alert style="warning" >}} `PageBuilder` is not available after a join with `ImageJoinOptions`: the images are then composed into one layout rather than a page sequence, so `CreatePageBuilder` and `ApplyPageBuilder` throw `GroupDocsMergerException`. Join TIF files without `ImageJoinOptions` to compose them page by page. {{< /alert >}} ### Code Examples Please find more [use-cases and complete C# sources]({{< ref "merger/net/showcases.md" >}}) of our backend and frontend examples and try them for free! ### Merge TIF Live Demo GroupDocs.Merger for .NET provides an online [**TIF Merger App**](https://products.groupdocs.app/merger/tif), which allows you to try it for free and check its quality and accuracy.