Saving a Document as a Multipage TIFF

When working with documents, you often need to convert your document to a raster image file(s). This is especially relevant if you have to present your document in a readable and printable, but not editable format. For example, you can use a raster image of the first page of your document as a preview. This article describes how to convert a document to a raster image using the example of the TIFF format – one of the more popular image formats.

Converting DOC to Multi-Page TIFF

In Aspose.Words, conversion from DOC to TIFF can be performed with one line of code, by simply passing the “save to” path and the relevant file extension to the Save method. The Save method automatically derives the SaveFormat from the file name extension specified in the path. The following example demonstrates how to convert a document to the TIFF format:

Specifying Additional Options When Rendering TIFF

You often need to specify additional options, which affect the rendering result. For this purpose, use the ImageSaveOptions class, which contains properties that determine how the document is displayed on the image. You can specify the following:

The following example shows how to convert DOC to TIFF with configured options:

Threshold for TIFF Binarization

A TIFF image can be saved in 1bpp b/w format by setting the PixelFormat property to Format1bppIndexed pixel format type, and the TiffCompression property to either Ccitt3 or Ccitt4.

For image segmentation, Aspose.Words uses the simplest method — thresholding. This method converts a gray-scale TIFF image into a binary image, using a threshold value. Therefore, when a document needs to be converted to the TIFF file format, it is possible to get or set the threshold for TIFF binarization via the ThresholdForFloydSteinbergDithering property. The default value for this property is set to 128, and the higher this value, the darker the image.

The following example shows how to perform TIFF binarization with a specified threshold:

Below you can compare images on which TIFF binarization was performed at various threshold values: