For many reasons, you often need to convert PDF documents to different image formats. You can find many online sites that easily convert PDF to images, but there is no guarantee your file will be secure always. You can easily do it in your own Linux system.
This article is going to show you to convert pdf to other image formats (jpg, png, gif, tif) using the following two popular methods.
1. Convert Command
Using the convert command is the easiest way to convert PDF to jpg, png, gif format. Not only limiting to convert, but you can also use it to resize, blur, crop, flip and many more.
Installation of convert
Convert comes from ImageMagick which is a popular free open-source cross-platform software for displaying, converting, editing, and modifying images. Depending upon your distribution, you can install as follows:
$ sudo apt install imagemagick
$ pacman -s imagemagick
$ dnf install ImageMagick
Now, you can convert pdf to image format. We are going to show you some examples by converting pdf to jpeg, png gif, and tif format.
$ convert document.pdf output_image.png
You can also define the quality of the image like,
$ convert -density 300 document.pdf -quality 100 output_image.jpeg
- density 300 is dpi that the PDF is rendered at
- quality 100 is the highest JPEG compression quality
You can find more convert command by referring its help and man pages
$ convert --help $ man convert
The GIMP (The GNU Image Manipulation Program) is free image manipulating software. We can convert PDF to image format easily with this software.
Installation of GIMP
To install GIMP depending upon your OS, you can simply install.
$ sudo apt update $ sudo apt install snapd $ sudo snap install gimp
Centos 8 /RHEL 8
$ sudo dnf update $ sudo dnf install gimp
On Arch Linux also, you need to install snap repository and install GIMP from there. To do this, just clone the git repository of the snap package and build it using makepakg command as follows.
$ git clone https://aur.archlinux.org/snapd.git $ cd snapd $ makepkg -si
Now enable snap communication socket and create a symbolic link to /snap directory.
$ sudo systemctl enable --now snapd.socket $ ln -s /var/lib/snapd/snap /snap
At this point, your snap package is installed and now you can install GIMP using the following command.
$ sudo snap install gimp
Now you can use GIMP to convert PDF documents to images. To open GIMP open your terminal and type just type gimp
When it open go to file and click on open and browse PDF file.
Here you can make changes by applying different edits. To convert it into image format just go to the File menu and select Export as.. and change the extension to image format (jpg, png, gif) you want and click on export.
Your PDF document will be converted to the image format you specified.
We show you the tools and processes involved to convert PDF documents to image format by the use of two popular methods. You can comment to us for any queries.