A Simple PhantomJS Screenshot Server

This is a simple screenshot server running over http. You append a url (a urlencoded url) to the server and it returns a PNG image of the screenshot. It’s a simple implementation and not very scalable because of threading limits in phantomjs. But it could be modified to be much more robust and is a great starting point if you’re interested in improving.

Here are some example urls how it works.

http://yourserver:8001/http%3A%2F%2Fphantomjs.org%2Fapi%2Fwebpage%2Fproperty%2Fclip-rect.html
http://yourserver:8001/https%3A%2F%2Fbitbook.io%2F

First step is to install

Install NodeJS and PhantomJS on Ubuntu

Save the code out to a file named server.js, then you can run it with

The Code