C# TIFF Image Library
Basic SDK Concept for Tiff Imaging


How to Manipulate TIFF File by Using RasterEdge XDoc.Tiff for .NET Classes and APIs






Overview



RasterEdge.com provides various images and documents processing solutions that can be applied to streamline image & document processing for a wide variety of industries and document types. Variable image and document processing functions are divided into several categories, including document cleanup, medical image enhancement, color conversion and correction, image conversion, watermark & thumbnail creating, edge detection and more. Our supported image and document formats are: TIFF, JPEG, GIF, BMP, PNG, PDF, Word and DICOM.

RasterEdge XDoc.Tiff for .NET control is one of the mature solutions, which provides standard options to view, convert, process, compress, extract, and annotate TIFF images in C#.NET class and console applications. Our multiple TIFF manipulating APIs can fulfill different users' needs best, which include APIs for TIFF page adding, inserting, deleting, TIFF file page reordering, merging and splitting. RasterEdge XDoc.Tiff for .NET component still supports rotating, resizing, copying and pasting TIFF page and extracting page(s) from TIFF document by using the fully designed TIFF image editing classes and APIs, or C# developers are able to adopt our open source API methods to program more personalized TIFF document manipulating solutions & applications.

You can learn the basic concept of XDoc.Tiff for .NET SDK from two aspects.

  • Programming Classes

  • API References



XDoc.Tiff Programming Classes



In your C#.NET Tiff imaging application, four classes will be involved, which are TIFFDocument, TIFFPage, TIFFContext, TIFFMetadata.


Class: TIFFDocument


This class is an extension of BaseDocument. It represents a high-level model of the pages within a Tiff file. When a TIFFDocument object is created from an existing Tiff file, it contains a collection of TIFFPage objects for each page within the file. It is easy to use TIFFDocument to retrieving information from the files. You can also reorder or remove pages from Tiff files.


Class: TIFFPage


This class uses BasePage as prototype. It is a high-level abstraction of a page within a Tiff file. You obtain images from TIFFPage object individually.


Class: TIFFContext


This is a class similar to brush. It refers to the operators for Tiff page corresponding information.


Class: TIFFMetadata


This is a class is used to record Tiff image parameters and corresponding information, such as Tiff compression mode, color space, author, created time, and so on.






XDoc.Tiff API References




In the following parts, we will give detailed explanation for main APIs of XDoc.Tiff for .NET. You will see corresponding C# programming APIs for TIFFDocument, TIFFPage, and TIFFContext classes.



API References for TIFFDocument Class


public TIFFDocument(Stream stream)


public TIFFDocument(String fileName)


public TIFFDocument(byte[] fileData)


public TIFFDocument(FileIOMgr FileMgr)


public TIFFDocument(REImage[] images, TIFFCompression compression)


public TIFFDocument(Bitmap[] images)


public TIFFDocument(Bitmap[] images, ImageCompress imageCompression)


public TIFFDocument(int pageCount)


public override void Save(String filePath)


public override void SaveToStream(Stream stream)


public override byte[] SaveToBytes()


public override int GetPageCount()


public override BasePage GetPage(int pageIdx)


public override BasePage GetNewPage()


public TagCollection GetTagCollection(int pageIdx)



API: public TIFFDocument(Stream stream)


Argument

Type

Description

[stream]

Stream

Tiff document stream.


API: public TIFFDocument(String fileName)


Argument

Type

Description

[fileName]

String

File name of Tiff document.


API: public TIFFDocument(byte[] fileData)


Argument

Type

Description

[fileData]

Byte[]

Tiff file byte array data.


API: public TIFFDocument(FileIOMgr FileMgr)


Argument

Type

Description

[FileMgr]

FileIOMgr

Tiff FileIOMgr handle.


API: public TIFFDocument(REImage[] images, TIFFCompression compression)


Argument

Type

Description

[images]

REImage

REImage object array.

[compression]

TIFFCompression

The compression method of the tiff document.


API: public TIFFDocument(Bitmap[] images)


Argument

Type

Description

[images]

Bitmap

Bitmap object array.


API: public TIFFDocument(Bitmap[] images, ImageCompression imageCompression)


Argument

Type

Description

[images]

Bitmap

Bitmap object array.

[imageCompression]

ImageCompress

The compression method of the tiff document.


API: public TIFFDocument(int pageCount)


Argument

Type

Description

[pageCount]

int

TIFFDocument page count.


API: public override void Save(String filePath)


Argument

Type

Description

[filePath]

String

Save file path.


API: public override void SaveToStream(Stream stream)


Argument

Type

Description

[stream]

Stream

Save document to stream.


API: public override byte[] SaveToBytes()


Argument

Type

Description

None

Byte[]

Save document to byte array.


Return is TIFF file byte array.


API: public override int GetPageCount()


Argument

Type

Description

None

int

Tiff file page count.


Return is TIFFDocument page count.


API: public override BasePage GetPage(int pageIdx)


Argument

Type

Description

[pageIdx]

int

Tiff page id, from 0 start. 0<= pageIdx < PageCount.


Return is defined page of TIFFDocument.


API: public override BasePage GetNewPage()


Argument

Type

Description

None

-

Get a new empty Tiff page.


Return is an empty Tiff page. Size is 400x300 in pixel.


API: public TagCollection GetTagCollection(int pageIdx)


Argument

Type

Description

[pageIdx]

int

Get Tiff tags key and value. Tiff page id starts from 0.


Return is Tiff tags collection object.



API References for TIFFPage Class



public TIFFPage()


public TIFFPage(BaseImage img)


public TIFFPage(BaseImage img, TIFFCompression compression)


public void Rotate(RotateOder order)


public override Bitmap GetBitmap()


public override Bitmap GetBitmap(float zoomValue)


public override Bitmap GetBitmap(int resolution)


public override Bitmap GetBitmap(Rectangle sourceRectangle, Size targetSize)



API: public TIFFPage()


Argument

Type

Description

None

-

Create an empty TIFFPage.


API: public TIFFPage(BaseImage img)


Argument

Type

Description

[img]

BaseImage

Create a TIFFPage from an image.


API: public TIFFPage(BaseImage img, TIFFCompression compression)


Arguments

Type

Description

[img]

BaseImage


Create a TIFFPage from an image with specified compression mode.

[compression]

TIFFCompression


API: public void Rotate(RotateOder order)


Argument

Type

Description

[order]

RotateOder

TIFFPage rotation angle. Valid values are 90, 180, and 270.


API: public override Bitmap GetBitmap()


Argument

Type

Description

None

-

Convert TIFFPage to Bitmap.


Return is bitmap.


API: public override Bitmap GetBitmap(float zoomValue)


Argument

Type

Description

[zoomValue]

float

Convert TIFFPage to Bitmap with specified zoom value.


Return is bitmap.


API: public override Bitmap GetBitmap(int resolution)


Argument

Type

Description

[resolution]

int

Convert TIFFPage to Bitmap with specified resolution.


Return is bitmap.


API: public override Bitmap GetBitmap(Rectangle sourceRectangle, Size targetSize)


Arguments

Type

Description

[sourceRectangle]

Rectangle


Convert TIFFPage to Bitmap.

[targetSize]

Size



API References for TIFFContext Class



public TIFFContext()


public override int RenderToStream(BaseDocument srcDoc, Stream des)


public override int RenderToStream(BaseDocument srcDoc, float zoomValue, Stream des)


public override int RenderToStream(BaseDocument srcDoc, int resolution, Stream des)



API: public TIFFContext()


Argument

Type

Description

None

-

-


API: public override int RenderToStream(BaseDocument srcDoc, Stream des)


Arguments

Type

Description

[srcDoc]

BaseDocument


Save TIFFDocument to Stream.

Des

Stream


API: public override int RenderToStream(BaseDocument srcDoc, float zoomValue, Stream des)


Arguments

Type

Description

[srcDoc]

BaseDocument



Save TIFFContext to Stream according to defined zoom value for every page.

zoomValue

Float

Des

Stream


API: public override int RenderToStream(BaseDocument srcDoc, int resolution, Stream des)


Arguments

Type

Description

[srcDoc]

BaseDocument



Save TIFFContext to Stream according to defined resolution.

[resolution]

int

Des

Stream