3

I want to cache a webpage as an image upon a user request, but I don't know where to start with this.

I'm developing on App Engine with python.

3 Answers 3

2

Here's a good library for capturing a webpage as a png image:

http://github.com/AdamN/python-webkit2png

5
  • Can webkit2png be installed on App Engine?
    – ars
    Jul 19, 2010 at 23:11
  • I've never worked with App Engine, so I'm not sure of its limitations. Hopefully someone else will jump in here.
    – Zach
    Jul 19, 2010 at 23:32
  • 1
    I doubt it, I believe webkit2png requires the webkit headers and such which would (very) likely not be available on the app engine. A web service is probably the best choice.
    – kersny
    Jul 19, 2010 at 23:56
  • Does it use any c-libraries, app engine only supports native python.
    – tlow
    Jul 19, 2010 at 23:56
  • also, it requires a X server running.
    – Aif
    Aug 15, 2010 at 11:21
1

One way is to use a web service such as thumbalizr since a lot of the programs for this type of thing aren't always install-able on appengine (because they use C++, etc). Other options include girafa and browsershots.

1
  • Thumbalizr looks very interesting, though it is pretty slow.
    – tlow
    Jul 19, 2010 at 23:54
0

There are websites that to this for you. Google is your friend. If you build a script around them, you have what you need. As a demonstration, see http://webshots.velocitysc.com/sandbox/. There are also downloadable programs that do it, such as the one at http://download.cnet.com/Advanced-Website-to-Image-JPG-BMP-Converter-Free/3000-2094_4-10900902.html. These are just examples; google a while and you'll find better implementations.

If you want to do it yourself, you basically need to duplicate a web browser (the HTML rendering part, anyway), which is unrealistic, or use a preexisting rendering engine like webkit as Zach suggests. If I were you, I would forget about doing it myself and use a preexisting web service, unless this is going to be the core of your application.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.