Linux: Convert a PDF File To an Image

Linux: Convert a PDF File To an Image

There are several tools that you can use to convert a PDF file to an image on a Linux system. One option is to use the convert command from the imagemagick package.

  1. Install imagemagick if it is not already installed on your system:
sudo apt-get install imagemagick
‮S‬ource:www.lautturi.com
  1. To convert a PDF file to an image, use the convert command with the following syntax:
convert -density RESOLUTION -trim INPUT_FILE OUTPUT_FILE

For example, to convert a PDF file named input.pdf to a PNG image with a resolution of 300 DPI and trim the margins, you would run:

convert -density 300 -trim input.pdf output.png

This will create a new file named output.png that contains the converted image.

You can also specify the desired image format using the -format option. For example, to create a JPEG image, you would use the following command:

convert -density 300 -trim -format jpeg input.pdf output.jpeg
Created Time:2017-10-30 10:17:44  Author:lautturi