How to C#: Tiff
Using Tiff SDK for C#.NET
Tiff Compress
  |  
Home ›› XDoc.Tiff ›› C# Tiff: Compress Tiff

C# TIFF - Compress TIFF Files in C#.NET


C# .NET APIs and Sample Codes for How to Compress TIFF Document




C#.NET: Compress TIFF Files 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. 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.


Related .net document control helps:
asp.net document viewer: EdgeDoc ASP.NET Document Viewer C# Control: Open, view, annotate, redact, convert documents online using ASP.NET Web Con...
asp.net text document viewer: C# HTML5 Viewer: Load, View, Convert, Annotate and Edit OpenOffice, CSV and Text file
asp.net dnn pdf editor: ASP.NET DNN PDF Editor Control: view, edit PDF files in Dotnetnuke application
view document asp.net: View multiple document formats in ASP.NET, MVC, Ajax, Azure using C# control
asp.net edit pdf page: ASP.NET PDF Pages Edit Control: add, remove, sort, replace PDF pages online using C#
asp.net open pdf password: ASP.NET PDF Password Edit Control: online add, remove, update PDF file open password using C#
asp.net create pdf: ASP.NET Create PDF Document Control: create, convert PDF file from Word, Excel, Tiff file formats in C# ASP.NET


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




C# Demo Code for TIFF File Compression



Add references;


  RasterEdge.Imaging.Basic.dll


  RasterEdge.Imaging.Basic.Codec.dll


  RasterEdge.Imaging.Drawing.dll


  RasterEdge.XDoc.Processing.dll


  RasterEdge.Imaging.Raster.dll


  RasterEdge.Imaging.Raster.Core.dll


  RasterEdge.Imaging.Font.dll


  RasterEdge.XDoc.TIFF.dll


Use corresponding namespaces;


  using RasterEdge.Imaging.Basic;


  using RasterEdge.XDoc.TIFF;


Note: When you get the error "Could not load file or assembly 'RasterEdge.Imaging.Basic' or any other assembly or one of its dependencies. An attempt to load a program with an incorrect format", please check your configure as follows:


If you are using x64 libraries/dlls, Right click the project -> Properties -> Build -> Platform target: x64.


If using x86, the platform target should be x86.


In this part, users can find a complete C# sample code for the second type of Tiff compression. All pages using the same compression mode RLE(CCITT modified Huffman RLE).




// Define Jpeg images list.
            string[] imagePaths = { @"C:\demo1.jpg", @"C:\demo2.jpg", @"C:\demo3.jpg" };

            // Construct List<REImage> object.
            List<Bitmap> images = new List<Bitmap>();

            // Step1: Load image to REImage object.
            foreach (string file in imagePaths)
            {
                Bitmap tmpBitmap = new Bitmap(file);
                if (null != tmpBitmap)
                    images.Add(tmpBitmap);
            }

            // Step2: Construct TIFFDocument object and set page compression.
            TIFFDocument doc = new TIFFDocument(images.ToArray(), ImageCompress.CCITT1D);
            if (null == doc)
                throw new Exception("Fail to construct TIFF Document");

            // Step3: Other operations, like saving it.
            doc.Save(@"C:\output.tif");



public TIFFDocument(Bitmap[] images, ImageCompress imageCompression)

Description:
Create TIFF file from images with specified compression.

Parameters:
public TIFFDocument(Bitmap[] images, ImageOutputOption options)

Description:
Create TIFF file from images with option setting.

Parameters:
ImageOutputOption: