Skip to main content

pdf2images

Convert PDF file to image files ROBUSTLY.

Example

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

positional arguments:
  pdf_file
  output_dir

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.

Installation

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

Robustness

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

Gallary

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

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

Development

pip3 install -r requirements.dev.txt
pre-commit install

Metadata

Release files for pdf2images 0.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pdf2images 0.0.6
File Size Uploaded
pdf2images-0.0.6.tar.gz 6.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pdf2images 0.0.6
File Interpreter ABI Platform
pdf2images-0.0.6-py3-none-any.whl Python 3 none any Details

Total release size: 14.0 kB

Release files / pdf2images-0.0.6.tar.gz

Download URL pdf2images-0.0.6.tar.gz
Size 6.0 kB
Tags Source
SHA-256 checksum
How to use checksums
33786e248a2fd87981ed8c81757feda3da006d47cc51d51690b47a963b1ef779
BLAKE2b-256 checksum
How to use checksums
d1310204b0f79e0da04ffb2b415feef9d3222fdee3e34d50be71a8bca8c4b461
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.7

Release files / pdf2images-0.0.6-py3-none-any.whl

Download URL pdf2images-0.0.6-py3-none-any.whl
Size 8.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
52c71bb0e5ccc4b46a50bb6c9528984bd5c8301320302d3883e1465efbcb4fba
BLAKE2b-256 checksum
How to use checksums
6bcc4687f2d82557408431d047adf5488a06e244f120295ab791392ac56a80f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.7

Release history Release notifications | RSS feed

This release

0.0.6 This release

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page