Page 1 of 1

ImageMagick screen shot of webpage

Posted: 2010-06-18T06:27:18-07:00
by winracer
can ImageMagick be used to take a screen shot of a website and save as a gif, jpg or pnp file on the server?
I am looking for a php or perl script that will do this.

Re: ImageMagick screen shot of webpage

Posted: 2010-06-18T19:45:19-07:00
by anthony
IM can take a snapshot of a display. But not a web page.


However their is a script on the IM examples web site that was contributed.

It starts a browser in a virtual X server, gets it to show an page and takes a snap shot.
Its old, and I haven't looked at it in a long time. Probably need form fixing to get working.

http://www.imagemagick.org/Usage/script ... t_webpages

I make no guarantees, and make no warranty. I didn't even write this one, though I did test run it when it first appeared.

Re: ImageMagick screen shot of webpage

Posted: 2010-07-08T12:03:05-07:00
by winracer
thanks, but my hosting company will not let me run x-server.

Re: ImageMagick screen shot of webpage

Posted: 2010-07-08T12:12:19-07:00
by Bonzo
Not Imagemagick but try:

Code: Select all

<?php
$browser = new COM("InternetExplorer.Application");
$handle = $browser->HWND;
$browser->Visible = true;
$browser->Navigate("http://www.google.com");
/* Still working? */
while ($browser->Busy) {com_message_pump(4000);
}$im = imagegrabwindow($handle, 0);
$browser->Quit();
imagepng($im, "iesnap.png");
imagedestroy($im);
?> 

Re: ImageMagick screen shot of webpage

Posted: 2010-07-08T12:53:21-07:00
by winracer
Bonzo wrote:Not Imagemagick but try:

Code: Select all

<?php
$browser = new COM("InternetExplorer.Application");
$handle = $browser->HWND;
$browser->Visible = true;
$browser->Navigate("http://www.google.com");
/* Still working? */
while ($browser->Busy) {com_message_pump(4000);
}$im = imagegrabwindow($handle, 0);
$browser->Quit();
imagepng($im, "iesnap.png");
imagedestroy($im);
?> 


thanks!!!


I get this error

Fatal error: Class 'COM' not found in new.php on line 2

Re: ImageMagick screen shot of webpage

Posted: 2010-07-08T13:01:48-07:00
by Bonzo
Woops looks like its windows only - only tried it in my localhost.

Re: ImageMagick screen shot of webpage

Posted: 2010-07-08T13:08:09-07:00
by winracer
Bonzo wrote:Woops looks like its windows only - only tried it in my localhost.

find what I am looking far then
Just my luck it has to be a windows server...
thanks for your help

Re: ImageMagick screen shot of webpage

Posted: 2010-07-08T13:19:37-07:00
by snibgo
If you've got the html2ps delegate installed, this might work:

convert x.htm x.jpg

Re: ImageMagick screen shot of webpage

Posted: 2010-07-09T05:22:27-07:00
by winracer
snibgo wrote:If you've got the html2ps delegate installed, this might work:

convert x.htm x.jpg

thanks I will look into it. I am not sure if my hosting Company would have this installed