Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
What is this page about?
This page explains how to save a document as a multi-page TIFF image.
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.
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:
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:
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:
Q: How do I convert a Word document to a multi‑page TIFF using C#?
A: Load the document with Document, create an ImageSaveOptions instance, set SaveFormat to Tiff, and call Save with the desired file name. Aspose.Words automatically creates one TIFF page per document page.
Document doc = new Document("input.docx");
ImageSaveOptions options = new ImageSaveOptions(SaveFormat.Tiff);
doc.Save("output.tiff", options);
Q: How can I control the resolution of the generated TIFF images?
A: Set the Resolution property (or HorizontalResolution / VerticalResolution) on ImageSaveOptions. The value is in dots per inch (DPI). Higher DPI yields sharper images but larger file size.
ImageSaveOptions options = new ImageSaveOptions(SaveFormat.Tiff);
options.Resolution = 300; // 300 DPI
doc.Save("highres.tiff", options);
Q: I only need pages 2‑4 of the document in the TIFF file. How can I export a page range?
A: Use the PageIndex and PageCount properties of ImageSaveOptions to specify the first page (zero‑based) and the number of pages to render.
ImageSaveOptions options = new ImageSaveOptions(SaveFormat.Tiff);
options.PageIndex = 1; // start from page 2
options.PageCount = 3; // pages 2,3,4
doc.Save("range.tiff", options);
Q: How do I create a black‑and‑white (1 bpp) TIFF with binarization?
A: Set PixelFormat to Format1bppIndexed, choose a suitable TiffCompression (e.g., Ccitt4), and optionally adjust ThresholdForFloydSteinbergDithering to control the binarization threshold.
ImageSaveOptions options = new ImageSaveOptions(SaveFormat.Tiff);
options.PixelFormat = PixelFormat.Format1bppIndexed;
options.TiffCompression = TiffCompression.Ccitt4;
options.ThresholdForFloydSteinbergDithering = 150; // 0‑255
doc.Save("bw.tiff", options);
Q: Which compression methods are available for TIFF, and how do I choose one?
A: ImageSaveOptions.TiffCompression supports None, Lzw, Ccitt3, Ccitt4, and Rle. Use Ccitt3 or Ccitt4 for black‑and‑white images, Lzw for loss‑less color images, and Rle for simple run‑length encoding. Select the method that best balances file size and image quality for your scenario.
ImageSaveOptions options = new ImageSaveOptions(SaveFormat.Tiff);
options.TiffCompression = TiffCompression.Lzw; // loss‑less color compression
doc.Save("compressed.tiff", options);
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.