Convert Pdf to Image

Converting pdf files to image using convert command line tool provided by imagemagick.

On apt systems , install imagemagick using following command

# apt install imagemagick

Converting pdf file to image,

convert -background white -alpha remove -density 250 -quality 90  input.pdf output.png

Above command generates image file for each page in pdf file like output-0.png , output-1.png,...

For converting first page of pdf to image,

convert -background white -alpha remove -density 250 -quality 90 inut.pdf[0] firstpage.png

Appending images

Appending image files into single image file in top-bottom,

convert -append out-0.png out-1.jpg page_0-1.png

Appending image files into single image file in left to right sequence ,

convert +append out-0.png out-1.jpg page_0-1.png
Tags: