Skip to main content

Converting PDF to PNG/JPG using ImageMagick in Linux

Being an undergrad student a lot of the lecture notes and study related material i have is in PDF format now a lot of times i have felt the need of carrying this material around, however carrying laptop around all the time is just not feasible.I have a Video Ipod that could store images and one could view them on the go however it cannot display pdf files so my search began for a tool that could actually convert PDF files into PNG that could be later loaded on to the ipod and viewed at one's convenience .

Note : The installation instruction below are for Ubuntu however they should work perfectly well on any other distro as long as you have ImageMagik and Ghost Script installed.

Installing ImageMagick
ImageMagick is a powerful command line image processing package with a number of features you could install it using the following command :

sudo apt-get install imagemagick
After installation is over to convert say sample.pdf to sample.png issue the following command

convert sample.pdf sample.png
or

convert sample.pdf sample.jpg

Now if sample.pdf has multiple pages ImageMagick would convert each individual page into a separate file for example : 1st page as sample-0.png , 2nd page as sample-1.png and so on .

However ImageMagick internally uses Ghostscript to convert the file to graphics image so resolution might be bit less and if you want to convert document into higher resolution image you could do so by using Ghostscript directly.

There are number of options available in convert which you could inquire by issuing convert -? command.

Article Written by : Ambuj Varshney (blogambuj@gmail.com)
For Desktop on Linux Blog , http://linuxondesktop.blogspot.com
(C) 2008 , Ambuj Varshney

Comments

  1. Hi there,
    I have 32 pages of pdf file and I want to convert it into png format with 4 images per page. Please show me how to do it. Thanks.

    ReplyDelete
  2. Anonymous5:50 PM

    Print those 32 pages as another PDF with 4 pages per page, first. Then use imagemagick.

    ReplyDelete
  3. For the quality, just play around with the -density switch
    $ convert -density 300 sample.pdf sample.png

    ReplyDelete
  4. Anonymous1:35 PM

    hmmm...

    ReplyDelete
  5. Anonymous3:00 AM

    Thanks! The density switch is exactly what I needed!

    ReplyDelete
  6. > I have 32 pages of pdf file and I want to convert it into png format with 4 images per page.

    convert sample.pdf _.jpg
    montage *.jpg -mode Concatenate -tile 4x1 line.jpg

    ReplyDelete

Post a Comment

Popular posts from this blog

13 Things to do immediately after installing Ubuntu

In this article i describe some of the things to do immediately after installing ubuntu on your machine . Since most of the people reading this would be shifting from Windows to Linux with a system dual booting so i would focus more on making transition easy from Windows to Linux.

Creating Your ultimate Ubuntu 7.10 Desktop

Ubuntu 7.10 Codenamed Gusty Gibbon was released few weeks back with much fanfare ,now Ubuntu for past couple of years has been one of the most popular Desktop Linux distributions . Ubuntu 7.10 includes a number of features , applets and Wizards to simplify desktop Linux experience however because of many licensing restrictions it does not include out of the box support for popular audio/video codecs and many commercial but good applications . Also because of the limitation of trying to accommodate all kind of applications on single CD Ubuntu comes with a limited set of applications .

Now , i often have arguments with my friends who are new to computers that windows is…

Over 16 Small Games For Ubuntu Linux

Over 16 Small Games For Ubuntu Linux

Ubuntu Linux is one of the most popular Linux distribution , it is especially popular among Linux newbies and windows refuges . Now Ubuntu Linux does come with a descent set of applications , still there is a scope for including some more quality applications and especially games . Now in this tutorial i will show you how to install a large number of small , easy and less resource hungry games on Ubuntu Linux with screen-shots of games .


1. Rocks 'n' Diamonds

Rocks 'n' Diamonds is a Boulderd*sh game for X11 with more than just the falling rocks and diamonds of its namesake. The object is still to collect all the diamonds (and emeralds), then get to the exit before time runs out. But your character must make use of bombs, spaceships, and many other elements in order to fill his quota of jewels.

Installation : -

Type the following command in the terminal window

wget http://www.artsoft.org/RELEASES/unix/rocksndiamonds/rocksndiamonds-3.2…

Making Music(Beats) on Linux/Ubuntu with Hydrogen

I am going to review a couple of Music Making Softwares for Linux and am starting with the simplest and one of the best!HYDROGEN. Hydrogen basically is a pattern based drum programming software which in layman terms means, it allows you to make your own beats.And in case you aren't much into music, you might be wondering “what the hell will i do with this piece of software”...well here is a word from my friends who've tried this: “Its pretty fun playing with this software, n even without knowing much, you could actually MAKE SUM MUSIC!!!”

There was this software called Acoustica Beatcraft(for windows) which actually introduced me to this beat making stuff and I was quite interested, but sadly it was too costly for me to buy it. So i was stuck using the trial version of the software and sadly as soon as i got the grip of the software the trial expired, and so my search began for software which would do the stuff for me and luckily i found this amazing piece of software HY…