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 an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button