LinuxTutorials

How To Convert PDF File To Image on Linux

Convert PDF File To Image on Linux

In this tutorial, we will show you how to convert PDF files to image on Linux. Sometimes we need quickly convert a PDF file into images or save a set of images as a PDF file. To do this, we can use a couple of command-line tools such as poppler-utils and ImageMagick.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you through the step-by-step convert PDF files to images on Linux.

Prerequisites

  • A server running one of the following operating systems: Ubuntu Linux.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Convert Pdf File To Image on Linux

Method 1. Convert PDF file via ImageMagick.

First, install ImageMagick on the Linux system. The installation of ImageMagick on the Ubuntu system is a rather simple process. From your terminal window execute the following command:

sudo apt install imagemagick

Use the command given below to convert all the images into a pdf file:

convert my-file.pdf output_image.png

Note: if you’re facing that PDF file conversions are not authorized by policy. You can fix it by executing the following command:

sed -i '/disable ghostscript format types/,+6d' /etc/ImageMagick-6/policy.xml

Method 2. Convert PDF file via Pdftoppm.

First, install Pdftoppm on your Linux system. To install poppler-utils, we need to execute the following command below:

sudo apt install poppler-utils

Following is the basic syntax of the pdftoppm command:

pdftoppm -jpeg sample.pdf output_file

For example:

pdftoppm convert-PDF-to-images.pdf convert-PDF-to-images-png

To see all the choices available and supported in pdftoppm, run the commands:

pdftoppm --help

Congratulations! You have successfully converted the PDF file to an image. For more information about the convert PDF file to an image in Linux. For additional help or useful information, we recommend you check the official Pdftoppm website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is a dedicated and highly skilled Linux Systems Administrator with over a decade of progressive experience in designing, deploying, and maintaining enterprise-grade Linux infrastructure. His professional journey began in the telecommunications industry, where early exposure to Unix-based operating systems ignited a deep and enduring passion for open-source technologies and server administration.​ Throughout his career, r00t has demonstrated exceptional proficiency in managing large-scale Linux environments, overseeing more than 300 servers across development, staging, and production platforms while consistently achieving 99.9% system uptime. He holds advanced competencies in Red Hat Enterprise Linux (RHEL), Debian, and Ubuntu distributions, complemented by hands-on expertise in automation tools such as Ansible, Terraform, Bash scripting, and Python.
Back to top button