Skip to main content

Convert PDF file to image files ROBUSTLY.

Project description


Convert PDF file to image files ROBUSTLY.


$ pdf2images -h
usage: pdf2images [-h] [--max-size MAX_SIZE] pdf_file output_dir

positional arguments:

optional arguments:
  -h, --help           show this help message and exit
  --max-size MAX_SIZE  max size of either side of the image

Why another "pdf-to-image" package

Once in a while, I need to convert a pdf file (usually slides or academic paper) into image files (thumbnails) in order to get a fast glance to the readers without downloading the pdf file.

However, I found all the pdf2image solutions cannot robustly process all the pdf files, since many pdf files are in non-standard format or come up with extensions. They are always broken in some cases.

But to look them on the bright side, for any plausible case, there is almost one of them can process it successfully.

So I combined (a.k.a. ensemble) them together to make it work across most cases.


As mentioned above, we combined multiple pdf manipulation libraries. Here are the list of the libraries used:

where wand and preview-generator are python packages that can be automatically installed along with pdf2images. However, you have to install xpdf and qpdf manually.

On Ubuntu:

sudo apt install -y qpdf xpdf libimage-exiftool-perl

On Arch Linux:

sudo pacman -S --noconfirm qpdf xpdf perl-image-exiftool

On macOS:

brew install freetype imagemagick qpdf xpdf exiftool libmagic ghostscript

The installation of pdf2images is quite simple:

pip install pdf2images


This package has successfully processed hundreds of thousands of arxiv papers (for generating thumbnails).


The following images are converted from a slide from Deep Learning Book

page-0 page-1 page-2 page-3


pip3 install -r
pre-commit install

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pdf2images-0.0.6.tar.gz (6.0 kB view hashes)

Uploaded Source

Built Distribution

pdf2images-0.0.6-py3-none-any.whl (8.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page