How to create a screenshot of a web page using the server side of the script?

I need a server-side script (PHP, Python) to capture a web page in PNG, JPG, Tiff, GIF image and resize them to a thumbnail.

What is the best way to do this?

See also:

  • Screenshots of a webpage with PHP?
  • How to take a screenshot from a site with PHP and GD?
  • How to get a snapshot or thumbnail of a webpage using PHP?
+18
python php screenshot server-side-scripting
Apr 03 '09 at 13:35
source share
4 answers

You can probably write something similar to webkit2png if Mac OS X is not already installed on your server.

UPDATE: I just saw a link to its Linux equivalent: khtml2png

See also:

+13
Apr 03 '09 at 13:46
source share

What should happen is a page rendering program, and then an image of the image. This is a very slow and difficult process, but can be done in PHP on Windows.

Also check the comments in the documentation.

For python, I would recommend reading this article . It highlights some of the solutions.

There are services that you can also call (through some API) that will return the image to you. But usually they cost ( WebShots , for example)

+7
Apr 03 '09 at 13:39
source share

You will need:

  • read the web page and all its multimedia content (images, flash, etc.).
  • Use a browser rendering engine to display a web page.
  • take a screenshot and save it as an image

the first and third steps are easy, the second step is more complicated;)

+1
Apr 3 '09 at 13:41
source share

If you use php, you can use imagegrabscreen (PHP 5> = 5.2.2). Imagegrabscreen: captures the entire screen.

+1
Nov 02 '09 at 0:10
source share



All Articles