How to convert PDF to JPG on Linux

108

This tutorial will guide you to convert a PDF file to JPG images on Linux using a command-line tool named Poppler. Poppler is a free open-source library for rendering PDF files available in most Linux distros. From my experience, it’s one of the best PDF tools for converting every page in a PDF file to JPG image files, especially in terms of speed and quality.

Installing Poppler

Install the poppler-data and poppler-utils packages from the repository. If you aren’t using a Debian-based distro, make sure to have it installed correctly.

sudo apt-get update
sudo apt-get install poppler-data poppler-utils

Converting PDF to JPG

After finishing the installation, go to the directory the input PDF file is in, and create an output directory inside it where JPG image files will be placed in. I’ll name it output in this case.

mkdir output

Convert the input PDF file to JPG images using Poppler with the following command. Change the input PDF filename in the command to the proper one accordingly.

pdftoppm -jpeg input.pdf output

Wait until the conversion is complete. All the output JPG image files will be saved to the output directory as soon as it’s done.

Converting PDF to PNG

On the other hand, you can also convert PDF to PNG by changing the -jpeg option to -png in the command line above. Converting to PNG will take more time than JPG, but you will get higher-quality image files as a result.

pdftoppm -png input.pdf output