This article explains how to convert the pages of a PDF document to image files (PNG, JPEG, and others). For this task we'll be using (you can choose the one you prefer):
GIMP (GNU Image Manipulation Program): for those wanting to use use a graphical application for this task. Since by default GIMP can't export all PDF pages automatically (it requires exporting pages one by one), the article also includes a GIMP plugin that can export all layers as separate images.
pdftoppm: this command line tool is part of the poppler / poppler-utils package, and it can convert PDF documents to images (with each PDF page as a separate image) like PNG, JPEG and others. The tool can convert a single page of a PDF document, all the pages, or a page range, and it comes with multiple options like specifying the resolution, image cropping, and more.
Convert PDF to image (PNG, JPEG, etc.) using GIMP
GIMP, a free and open source image editor for Linux, Windows and macOS, can export pages of PDF documents to various image formats, including PDF, JPEG, TIFF, BMP, and many others.
When opening a PDF document with GIMP, each page is added as a separate layer, and only one PDF page at a time can be exported as an image. You can export all the PDF pages (GIMP layers) or a selected group of layers as separate images in one go by using a GIMP plugin.
Convert one or only a few PDF pages to PNG, JPEG and other image formats using GIMP.
Let's start with converting a single (or only a few) PDF page as PNG, JPEG, etc., using GIMP, which doesn't require installing any plugins. From the GIMP File menu click Open and choose the PDF file. An Import from PDF dialog should pop up - make sure the Open pages as option is set to Layers, and click Import:
GIMP Import from PDF dialog
In the GIMP layers dialog, scroll to the page you want to convert from PDF to PNG, JPEG and so on, and drag it with the mouse cursor to the top so it's the first layer:
Next, from the GIMP File menu click Export As.... In the export dialog you can either change the exported filename extension to the desired image format (in the Name field at the top), or you can click Select File Type (By Extension) at the bottom of the dialog to choose the format that will be used for the exported PDF page:
Now all you have to do is press the Export button to save the PDF page as a PNG, JPEG, TIFF or some other image format.
Depending on the image type you'll use for your exported PDF page, GIMP will show a dialog that lets you change some settings, like the image quality, compression level, and so on. Make any changes you want here, then click Export and the image file will be saved to your computer.
If you want to export other pages of the PDF document to an image, move the layer containing the page to the top of the layer list in GIMP, and repeat the process. For converting an entire PDF (or a large number of PDF pages in one go) to JPEG, PNG, and other image formats using GIMP, see the instructions below.
Using the GIMP Export Layers plugin to export all/select layers (PDF pages in this case) as separate images.
Export Layers is a GIMP plugin that can export layers as separate images. It can export layers in any file format supported by GIMP, and it comes with various options, like exporting all layers, only visible layers, exporting only selected layers, and more.
Download Export Layers plugin for GIMP.
You can easily install this plugin on Windows by using provided Windows installer. To install it on Linux or macOS, download the Export Layers ZIP archive, extract it, and copy the export_layers.py file and the export_layers folder to:
GIMP 2.8: ~/.gimp-2.8/plug-ins
GIMP 2.10 installed using your Linux distribution's package manager: ~/.config/GIMP/2.10/plug-ins
GIMP 2.10 installed from the Flathub Flatpak package: ~/.var/app/org.gimp.GIMP/config/GIMP/2.10/plug-ins
GIMP 2.10 installed using snap: ~/snap/gimp/current/.config/GIMP/2.10/plugins
GIMP 2.8: /Users/[your username]/Library/Application Support/GIMP/2.8/plug-ins
GIMP 2.10: /Users/[your username]/Library/Application Support/GIMP/2.10/plug-ins
Restart GIMP if it was running when you installed the plugin.
More about installing the Export Layers GIMP plugin can be found in its documentation.
Now open a PDF file with GIMP and make sure the Open pages as option is set to Layers in the import dialog, as already explained above.
You can now convert all the PDF pages or a select group of pages to image formats like PNG, JPEG, and any other format supported by GIMP, by clicking File -> Export Layers... from the GIMP menu. In case you want to export all the PDF pages as separate PNG images, all you have to do is choose the save location and press the Export button.
The Export Layers dialog lets you change the file extension, as well as perform other advanced operations. Click the png field at the bottom of the dialog to change the image format:
GIMP export all layers as PNG images
For advanced options, click Settings at the bottom of the Export Layers dialog, and then Show more settings.
For example, if you want to only export the layers you select in the preview dialog (shown on the right-hand side of the Export Layers dialog), click + Add Constraint..., and then Only layers selected in the preview:
GIMP export selected PDF layers to PNG
You can now click a layer in the right-hand side preview sidebar, then hold the Shift key and click another layer to select all layers in between. Or hold the Ctrl key and click on each layer you want to export.
All that remains to be done now is to click the Export button, and GIMP will start exporting the PDF pages you've selected (or all) to PNG, JPEG or whatever image format you chose:
GIMP Exporting layers as PNG images
For more about customizing the export using Export Layers, visit the plugin documentation page.
You might also be interested in: Configure GIMP 2.10 To Use Photoshop Keyboard Shortcuts (How-To)
Convert PDF to images (PNG, JPEG, more) from the command line using pdftoppm
pdftoppm can convert PDF document pages to image formats like PNG, JPEG, and others, from the command line. In can convert all the pages of a PDF document to separate PDF files, a single page or a page range, it supports specifying the image resolution, scale, crop the resulting images, and much more.
pdftoppm is part of the poppler / poppler-utils / poppler-tools package (depending on the Linux distribution you're using). Install this package as follows:
Debian, Ubuntu, Linux Mint, and other Debian/Ubuntu-based Linux distributions:
sudo apt install poppler-utils
sudo dnf install poppler-utils
sudo zypper install poppler-tools
sudo pacman -S poppler
In other Linux distributions use your package manager to install the poppler / poppler-utils package.
Now let's start by using pdftoppm to convert an entire PDF (we'll call it document.pdf in this example) to PNG, and name each page of the PDF converted to PNG as document-01.png, document-02.png and so on:
pdftoppm -png document.pdf document
Want to convert the PDF pages to JPEG instead of PNG? Use -jpeg instead. For TIFF, use -tiff. If you don't specify an image format, pdftoppm will convert the PDF pages to PPM image files by default.
To define a page range for the PDF to image conversion with pdftoppm, use -f N, where N in this case is the page number of the first page to print, and -l N, where N in this case is the last page to print.
For example to convert pages 5 to 15 from a PDF document (named document.pdf in the example) to PNG with pdftoppm, and have each resulting image named document-05.png, document-06.png and so on, you'd use:
pdftoppm -png -f 5 -l 15 document.pdf document
Want to increase the converted image DPI? By default pdftoppm converts PDF pages to images with a DPI of 150. To increase the DPI, add -rx and -ry to the command, with your custom values.
For example, to use a DPI of 300 for the resulted images, use:
pdftoppm -png -rx 300 -ry 300 document.pdf document
To see all the options supported by pdftoppm, run pdftoppm --help and man pdftoppm.
# pdftoppm -h
pdftoppm version 0.62.0
Copyright 2005-2017 The Poppler Developers - http://poppler.freedesktop.org
Copyright 1996-2011 Glyph & Cog, LLC
Usage: pdftoppm [options] [PDF-file [PPM-file-prefix]]
-f <int> : first page to print
-l <int> : last page to print
-o : print only odd pages
-e : print only even pages
-singlefile : write only the first page and do not add digits
-r <fp> : resolution, in DPI (default is 150)
-rx <fp> : X resolution, in DPI (default is 150)
-ry <fp> : Y resolution, in DPI (default is 150)
-scale-to <int> : scales each page to fit within scale-to*scale-to pixel box
-scale-to-x <int> : scales each page horizontally to fit in scale-to-x pixels
-scale-to-y <int> : scales each page vertically to fit in scale-to-y pixels
-x <int> : x-coordinate of the crop area top left corner
-y <int> : y-coordinate of the crop area top left corner
-W <int> : width of crop area in pixels (default is 0)
-H <int> : height of crop area in pixels (default is 0)
-sz <int> : size of crop square in pixels (sets W and H)
-cropbox : use the crop box rather than media box
-mono : generate a monochrome PBM file
-gray : generate a grayscale PGM file
-png : generate a PNG file
-jpeg : generate a JPEG file
-jpegopt <string> : jpeg options, with format <opt1>=<val1>[,<optN>=<valN>]*
-tiff : generate a TIFF file
-tiffcompression <string>: set TIFF compression: none, packbits, jpeg, lzw, deflate
-freetype <string> : enable FreeType font rasterizer: yes, no
-thinlinemode <string> : set thin line mode: none, solid, shape. Default: none
-aa <string> : enable font anti-aliasing: yes, no
-aaVector <string> : enable vector anti-aliasing: yes, no
-opw <string> : owner password (for encrypted files)
-upw <string> : user password (for encrypted files)
-q : don't print any messages or errors
-v : print copyright and version info
-h : print usage information
-help : print usage information
--help : print usage information
-? : print usage information