How to Convert PDF to JPG in Linux using command line

In this article you we learn How to Convert PDF to JPG in Linux using command line with example.

ImageMagick Suite

ImageMagick

We will use the ImageMagick package.

The convert program is a member of the ImageMagick suite of tools. Use it to convert between image formats as well as resize an image, blur, crop, and much more.

Install ImageMagick

Install ImageMagick on Ubuntu/Debian

To install ImageMagick package on Ubuntu execute next command:

$ sudo apt-get install imagemagick

Install ImageMagick on CentOS/RedHat

To install ImageMagick package on CentOS run command:

# yum install ImageMagick

or for CentOS 8:

# dnf install ImageMagick

Convert PDF to JPG

Now we can user convert utility for conversion.

Basically conversion command is:

$ convert input_file.pdf output_file.jpg

But we need use parameters for better quality PDF outputs

$ convert -density 300 -quality 95 in_file.pdf out_file.jpg

You can change density and quality parameters as you need.

Convert PDF to JPG in Linux

Note: Ubuntu users during conversion may have error: convert-im6.q16: unable to open image. Please read: How to Fix ImageMagick error: convert-im6.q16: unable to open image

Conclusion

We just learn how to install ImageMagick package on CentOS and Ubuntu. And using convert command.

How to Convert PDF to JPG in Linux Example:

$ convert -density 300 -quality 95 in_file.pdf out_file.jpg

   

If you like what you are reading, please:

Buy me a coffeeBuy me a coffee

arstech

Leave a Reply