Q. A friend showed me how to extract images from a pdf file using pdfimages utility. But I'd like to convert my PDF file to image file. How do I convert a PDF to an image file using a command line option?
A. You need to use convert command from imagemagick - image manipulation set of programs.
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, despeckle, dither, draw on, flip, join, re-sample, and much more. This is also useful if you do not have PDF reader installed (Gnome and KDE does have in built PDF reader) or required for your webbased project.
Type the following command to convert foo.pdf to foo.png (foo1.png, foo2.png.. etc if you have multiple pages in a pdf file):
$ convert foo.pdf foo.png
You can specify a different file type by changing the file extension of the second file, type:
$ convert foo.pdf foo.jpg
Featured Articles:
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- My 10 UNIX Command Line Mistakes
- Linux: 20 Iptables Examples For New SysAdmins

- 25 PHP Security Best Practices For Sys Admins
- The Novice Guide To Buying A Linux Laptop
- 10 Greatest Open Source Software Of 2009
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- Top 20 OpenSSH Server Best Security Practices
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Linux Video Editor Software
Facebook it - Tweet it - Print it -


{ 15 comments… read them below or add one }
on debian/etch you need ghostscript (package: gs) for this operation.
hm, life saving command ^_^
Doesn’t the Gimp open PDF files?
Use “-density ” option for setting precision in points per inch, example:
$ convert -density 300 file.pdf image.png
By default the dpi is 72, which could be too low. Make sure the option is _before_ the filenames though.
thank you very much!
I second that.. especially the part about “_before_ the filenames”
buenisimo…! =D Gracias
Thank you so much. I had no idea that putting the arguments in a different order would make a difference.
Thanks Laurent, that density option was the command I was looking for. Now I can have image output at appropriate quality.
on debian/lenny you need imagemagick(package: imagemagick) for this operation
Sometimes life is so easy :)
Convert pdf to png and back again with such ease.
Very nice :))
i dont know why but this isnt working for me .
i have 2 Gb of free space and what this command does is reduce it to 4 KB .
No output file or anything is generated ..
Thanks!! It was exactly what I was looking for!
Love ImageMagick for it’s neat feature to handle PDF (more or less as-is). Also, big thanks to Laurent for explaining the “-density” switch; which (until now) was the missing point in my latest workflow. Cheers!
i dolwnoad eagle strike audio book and it came up as file so renamed it .mp3 still no work