ImageMagick screen shot of webpage

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
winracer

ImageMagick screen shot of webpage

Post 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.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: ImageMagick screen shot of webpage

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
winracer

Re: ImageMagick screen shot of webpage

Post by winracer »

thanks, but my hosting company will not let me run x-server.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: ImageMagick screen shot of webpage

Post 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);
?> 
winracer

Re: ImageMagick screen shot of webpage

Post 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
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: ImageMagick screen shot of webpage

Post by Bonzo »

Woops looks like its windows only - only tried it in my localhost.
winracer

Re: ImageMagick screen shot of webpage

Post 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
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: ImageMagick screen shot of webpage

Post by snibgo »

If you've got the html2ps delegate installed, this might work:

convert x.htm x.jpg
snibgo's IM pages: im.snibgo.com
winracer

Re: ImageMagick screen shot of webpage

Post 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
Post Reply