Automatically Capturing Website Screenshots

I've recently had inspiration for a new web application that fits my needs as a web designer (it's a secret for now), but it's not a standard CRUD web app so it requires a fair amount of new programming/customization that I'm struggling with.

One thing the application requires that I'm not sure how to do is automatically capturing website screenshots. I'd like some sort of service where I feed in a URL and it spits out an screenshot of the website at that URL. Researching on Google, I've found many commercial types of software that can accomplish this but I'd like to use some type of open source plugin or web service.

Furthermore, I'm planning on using this for my own web application so I'm not sure what the legal implications are. I'd like to write my own software for this, but I'm not quite sure how to start or what this would entail.

So far, I've found some interesting links that are almost exactly what I'm looking for.

  • Binary Moon found a that Wordpress had their own service for doing automated screenshots (ex. for theme galleries) with dynamic URLs, but I'm not sure Wordpress would be too happy if I spammed their servers with something non-Wordpress related.
  • I've also found this website called Miwim (it's in French, but I've applied a Google Translate) that offers a similar service. The only downside is you have to link back to the service -- which I'm sure I'd do, anyway.
  • Paul Hammond has also written a command line tool called webkit2png that accomplishes the same thing, but I'm not sure how to run terminal commands from a web application.
  • Here's another forum that offers some alternatives, though some of the links are long dead. I'm still searching for other services/ways to do it myself..if you have any ideas I'd love to hear them!