Sometimes you may need to convert PDF to image or jpg files in Ubuntu. We will use ImageMagick utility to for this purpose. It is very useful and supports conversion of PDF to multiple image formats, not just JPG. Here are the steps to turn a PDF document to an image.
How to Convert PDF to Image/JPG in Ubuntu
Here are the steps to convert PDF to image/jpg in Ubuntu.
1. Install Imagemagick
Open terminal and run the following command to install imagemagick utility.
$ sudo apt-get install imagemagick
2. Convert PDF to JPG
Let us say you want to convert test.pdf file to test.jpg image. In this case, run the following command.
$ sudo convert test.pdf test.jpg
If you want to cusomize the quality of image, you can pass additional parameters as shown below.
$ sudo convert -density 300 -quality 100 test.pdf test.jpg
If you want to convert pdf document to other image formats such as png, just change the extension of output filename.
$ sudo convert test.pdf test.png
As you can see it is very easy to convert pdf documents to images/jpg.
Also read:
How to Redirect with Query String in Apache
How to Check Cookie is Set in Apache
How to Convert DocX to PDF in Ubuntu
How to Setup SSH Passwordless Login
How to Change NGINX User
sudo convert test.pdf test.png
convert-im6.q16: attempt to perform an operation not allowed by the security policy `PDF’ @ error/constitute.c/IsCoderAuthorized/421.
convert-im6.q16: no images defined `test.png’ @ error/convert.c/ConvertImageCommand/3229.
What did I wrong? The system is Kubuntu 22.04 on an old computer (AMD64)
The security policy of ImageMagick seems to be blocking your operation. Please refer to this link for solution:
https://stackoverflow.com/questions/52998331/imagemagick-security-policy-pdf-blocking-conversion