Create thumbnails of PDF’s with Node JS and GraphicsMagick

1. Install GraphicsMagick

On Ubuntu (14.04):

sudo apt-get install graphicsmagick


2. Install the Node library in your project

npm install gm


3. Write  a script

Below I show two ways of creating a thumbnail. The first way creates a JPG using various GraphicsMagick functions, I prefer this way because it gives me fine grained control over the thumbnail. The second uses a built in function for thumbnails, which is easy to use but isn’t as flexible.
Continue reading