TIFF is a popular format to store raster images. Unlike other image formats, TIFF supports multiple pages. It means, a multipage TIFF file can have more than one images in the form of pages. This feature makes TIFF a suitable option to render the Word documents. To perform this conversion programmatically, this article covers how to convert Word DOCX or DOC files to TIFF using Python.
- Python Library for Word to TIFF Conversion
- Convert a Word Document to TIFF
- Customize Word to TIFF Conversion
Python Library for Word to TIFF Conversion
In order to convert DOCX or DOC documents to TIFF format, we will use Aspose.Words for Python. It is a powerful Python library to create and manipulate Word documents seamlessly. Moreover, it provides a high fidelity conversion of Word files to other popular document and image formats. You can install the library from PyPI using the following pip command.
pip install aspose-words
Convert a Word Document to TIFF using Python
The following are the steps to convert a Word document to multipage TIFF using Python.
- Load the Word file using Document class.
- Save the document as TIFF file using Document.save(string) method.
The following code sample shows how to convert a Word document to TIFF format.
Customize Word to TIFF Conversion using Python
You can also customize the Word to TIFF conversion using different options. For example, you can set the image brightness, resolution, range of pages to convert, compression scheme, and so on. To set these options, ImageSaveOptions class is used. The following are the steps to set different options in Word to TIFF conversion.
- Load the Word file using Document class.
- Create an instance of ImageSaveOptions class.
- Pass the input image format in the constructor of ImageSaveOptions.
- Set the desired options for the converted TIFF.
- Convert Word to TIFF using Document.save(string, ImageSaveOptions) method.
The following code sample shows how to convert a Word document to TIFF with additional options.
Get a Free API License
Use Aspose.Words for Python without evaluation limitations using a free temporary license.
Conclusion
In this article, you have seen how to convert Word documents to TIFF format using Python. Also, you have learned how to use different options to customize Word to TIFF conversion dynamically. Besides, you can visit the documentation of Aspose.Words for Python to explore other features. You can also ask your questions via our forum.