PDF to TIFF – Convert PDF to TIFF using Python

Convert PDF to TIFF

PDF files are quite popular for information sharing because they preserve document fidelity on the majority of platforms including desktop, mobile, or other handheld devices. Albeit all popular web browsers support PDF format but still, some devices may require PDF-specific applications to view these documents. So we may consider converting these files to raster image formats i.e. JPEG, PNG, BMP, TIFF, etc. Therefore, in this article, we are going to focus on converting PDF files to TIFF files. Though these are much larger than JPEGs but they are also lossless. That means you do not lose the quality after saving and editing the file, no matter how many times you do it. Therefore, it makes TIFF files perfect for images that require big editing jobs in Photoshop or other photo editing software. Furthermore, you can perform fast compression and decompression of such files with lossless quality.

PDF Processing API

The manipulation of PDF content through programming API can be really useful when we need to perform bulk operations. Similarly, if we need to convert a bulk of PDF files to TIFF format, a programming API can be a viable solution. So in order to facilitate our customers, Aspose.PDF Cloud has been developed enabling our customers to create, manipulate and render PDF files to raster image formats. Furthermore, as we are going to discuss the PDF to TIFF conversion using Python, so we are going to use Aspose.PDF Cloud SDK for Python which is a wrapper around Cloud API. No additional software download or installation is required and perform all the rendering operations in the cloud.

The first step in using the SDK is its installation which is freely available for download over PIP and GitHub repository. Simply execute the following command on the terminal/command prompt to install the latest version of SDK on the system.

pip install asposepdfcloud

Free Cloud Dashboard Account

Aspose Cloud dashboard enables our customers to manage their credentials as well as the files stored in their specific storage. So in order to use Cloud APIs, the next major step is a free subscription to our cloud services via Aspose.Cloud dashboard. The purpose of this subscription is to only allow authorized persons to access our file processing services. If you have GitHub or Google account, simply Sign Up or, click on the Create a new Account button and provide the required information. Now login to the dashboard using credentials and expand the Applications section from the dashboard and scroll down towards the Client Credentials section to see Client ID and Client Secret details.

Client credentials
Image 1:- Client Credentials on Aspose.Cloud Dashboard.

Convert PDF to TIFF using Python

When converting PDF files to TIFF format, we get the option to specify TIFF compression values such as LZW, CCITT4, CCITT3, RLE, None. We also get the control on ColorDepth where possible values can be Default, Format8bpp, Format4bpp, Format1bpp. We may also set the orientation of the resultant image as None, Landscape, Portrait. The API provides us following three mechanisms for converting PDF to TIFF and we can select either of them as per our requirement.

1 – PDF (located on storage) to TIFF and resultant file in response

2 – PDF (located on storage) to TIFF and upload resultant file to cloud storage

3 – PDF (in request content) to TIFF and upload resultant file to cloud storage

In the following section, we have loaded a PDF file already available in cloud storage and converted it to TIFF format, and the resultant file is also stored in cloud storage (2nd option as specified above)

  • First of all, we need to create an instance of ApiClient class which requires Client ID Client Secret as arguments
  • Secondly, create an instance of PdfApi class which requires ApiClient object as input argument
  • Thirdly, create variables defining input PDF and resultant TIFF names
  • Set the resolution, compression factor, color depth, margin, orientation, dimensions and resolution details
  • Finally, call put_pdf_in_storage_to_tiff(…) method to initiate the conversion operation
PDF converted to TIFF
Image2:- PDF to TIFF conversion preview.

For your reference, we have also uploaded the input marketing.pdf and resultant.tiff.

PDF to TIFF using cURL Command

The REST APIs can also be accessed via cURL commands, so we can also access Aspose.PDF Cloud through cURL commands. But first, we need to generate a JSON Web Token (JWT) based on your client credential details specified over Aspose.Cloud dashboard. This step is mandatory because our APIs are only accessible to registered users. Please execute the following command to generate the JWT token.

curl -v "https://api.aspose.cloud/connect/token" \
-d "grant_type=client_credentials&client_id=88d1cda8-b12c-4a80-b1ad-c85ac483c5c5&client_secret=406b404b2df649611e508bbcfcd2a77f" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"

Once the JWT Token has been generated, please execute the following command to render the PDF document to TIFF image and save the resultant output Cloud storage.

curl -X PUT "https://api.aspose.cloud/v3.0/pdf/marketing.pdf/convert/tiff?outPath=Resultant.tiff&brightness=100&compression=LZW&colorDepth=Format8bpp&leftMargin=10&rightMargin=10&topMargin=10&bottomMargin=10&orientation=None&skipBlankPages=true&width=1024&height=800&xResolution=300&yResolution=300&pageIndex=1&pageCount=1" \
-H  "accept: application/json" \
-H  "authorization: Bearer <JWT Token>" \


The article has explained the details regarding the conversion of PDF to TIFF using Python as well as cURL commands. We have also learned about the flexibility and convenience the API provides for conversion operation. Apart from free conversion operations, we have also uploaded the complete source code of Aspose.PDF Cloud SDK for Python over GitHub. You can download it and modify it as per your requirements. In case you encounter any issues or you have any further queries, you may also contact us via the free customer support forum.

Related Articles

We recommend visiting the following articles to learn about: