Madhav Kobal's Blog

This blog will be dedicated to Linux, Open Source and Technology news, affairs, how-tos and virtually EVERYTHING in these domains.

Convert a PDF file into a single Image using ImageMagick

Posted by madhavkobal on 18/06/2010

Don’t know when you might feel the necessity to convert a pdf into a .jpg or a .png file, but in case you have to, then ImageMagick will make this job really easy for you. ImageMagick is a great opensource command line utility for image manipulation.

Since, we are dealing with image conversion we will use the “convert” script, provided by ImageMagick.

[shredder12]$ convert file.pdf image.png

If the pdf file(file.pdf) has only one page then a single image.png file will be formed. In case of multiple pages, same number of image-[n].png files will be produced. For example, a three page pdf will result into three image files – image-0.png, image-1.png and image-2.png.

If you want to combine/stitch all these images together to form a single one, something similar to taking a snapshot of the whole pdf, then just run the following command.

[shredder12]$ convert image-* -append single_image.png

This will result in a single image file.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: