C# TIFF Image Compress Library
How to compress multipage tiff image to reduce file size using C# code in ASP.NET MVC, Windows application
C# .NET APIs and Sample Codes for How to Compress TIFF Document
In this C# tutorial, you learn how to compress multipage TIFF image document and reduce TIFF file size in the C# ASP.NET web and Windows application through the following settings:
- Compress a new created TIFF file
- Compress and reduce an existing Tiff file size
- Read an existing TIFF compression mode
How to compress multipage TIFF file using C#
Overview
RasterEdge XDoc.Tiff for .NET utilizes the most advanced and standard based Tiff image and document compression methods, which guarantee C# users with high quality loss and lossless Tiff document compression. vb.net add text to pdf, convert pdf to word c#, how to read specific text from pdf file in c#, convert pdf to tiff c#, generate pdf azure function, c# wpf preview pdf. This C#.NET Tiff compressing SDK provides several industry standards and alternative compression options & technologies to compress Tiff image file, including Fax, Group4, JPEG, RLE(CCITT modified Huffman RLE), Zip, LZW, and Deflate.
This page mainly talks about Tiff image compression and specifically speaking, we support following two kinds of interfaces for Tiff document compression no matter for C# Windows project or C# ASP.NET web program.
- When you create a TIFFPage with an image source, you can choose the type of image compression you want to use
- When you create a new TIFFDocument with a collection of image source, you can specify one compression mode for all images or different modes for each
Tiff Image Compression Options using C#
You can compress a multipage tiff image file through option in ImageCompress. The below content lists all options which are applicable on TIFF document compression in C# code.
- Uncompressed: No compression
- CCITT1D: CCITT modified Huffman RLE
- Group3Fax: CCITT Group 3 Fax encoding
- Group4Fax: CCITT Group 4 Fax encoding
- PackBits: PackBits compression (Macintosh RLE)
- LZW: LZW (Lempel-Ziv & Welch) compression
- JPEG: JPEG (Joint Photographic Experts Group) compression
How to compress a TIFF image file using C# code?
The text and C# source code below shows how to compress a multipage tiff image with PackBits compression using C# in your ASP.NET MVC, Windows application.
- Create a Bitmap object with an existing png image file loaded
- Create a new TIFFDocument object with the Bitmap object and image compression option ImageCompress.PackBits
- Save the Tiff object to a new file with PackBits image compression applied
String inputFilePath = "C:\\1.png";
String outputFilePath = "C:\\output.tif";
// Get a Bitmap object
Bitmap image = new Bitmap(inputFilePath);
// Create a single page TIFF document from the source image.
// Use PackBits compression.
TIFFDocument doc = new TIFFDocument(new Bitmap[1] { image }, ImageCompress.PackBits);
// Save TIFF document to a new file.
doc.Save(outputFilePath);