Image to Image in Python

This page describes how to use the Pdfcrowd online API to convert between images formats in Python. The API is user-friendly and can be integrated into your application with just a few lines of code.

Installation

You can install the client library from PyPI
pip install pdfcrowd

Check out other installation options.

Quick Start

Here are Python examples for quickly getting started with the API. See more examples.

Authentication

The credentials to access the API are your Pdfcrowd username and the API key.

Error Handling

It is recommended that you implement error handling to catch errors that the API may return, see the example code below. A list of status codes and their description can be found here.

try: 
    # call the API 
except pdfcrowd.Error as why: 
    # print the error
    sys.stderr.write('Pdfcrowd Error: {}\n'.format(why))

    # print the error code
    sys.stderr.write('Pdfcrowd Error Code: {}\n'.format(why.getCode()))

    # print the error message
    sys.stderr.write('Pdfcrowd Error Message: {}\n'.format(why.getMessage()))

Troubleshooting

  • Refer to the API Status Codes page if the API returns an error.
  • You can use setDebugLog and getDebugLogUrl to get detailed info about the conversion, such as load errors, load times, browser console output, etc.
  • Check the FAQ.
  • Contact us if you need help or are missing a feature.

API Method Reference

Refer to the Image to Image Python Reference for a description of all API methods.