htm to jpeg setup?
htm to jpeg setup?
I am trying to understand the way to get html2ps set up to convert an htm page to jpeg. I have downloaded and installed a Perl package, and I have the html2ps folder unzipped. It seems like the instruction just say, open the html2ps.html file in a browser. Could someone explain more how to set this up, so ImageMagick has what it needs to do this type of conversion. Thanks
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: htm to jpeg setup?
I do not know how this works, since I do not use that feature. But you can search Google for "html2ps imagemagick" and get some hits, such as:
viewtopic.php?t=16009
http://stackoverflow.com/questions/3010 ... g-together
http://stackoverflow.com/questions/1108 ... magemagick
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=59066
http://forums.fedoraforum.org/showthread.php?t=104238
viewtopic.php?t=16009
http://stackoverflow.com/questions/3010 ... g-together
http://stackoverflow.com/questions/1108 ... magemagick
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=59066
http://forums.fedoraforum.org/showthread.php?t=104238
Re: htm to jpeg setup?
Hi, I got it working. I think... what is produced in the ps file is only text based. I know a little about post script from my printing days and this makes sense. I am only going to see that type of output?... correct? I was misleading myself thinking that I would see an screenshot of the html page. Is there anyway to produce more of a screenshot? Thanks
Re: htm to jpeg setup?
I have not tried this lately but it used to work for me:
The result depends on what the site is like. In my code I do a crop but some sites have side bars and the page may go below the "fold". From memory animations gave some problems as well.
Code: Select all
<?php
// Need to modify the crop width to remove a vertical scroll bar if its in the image !
$url = array( 'site1.info', 'site2.com', 'site3.com', 'site4.co.uk', 'site5.info');
foreach( $url as $value ){
$site = "http://www.".$value;
$browser = new COM("InternetExplorer.Application");
$handle = $browser->HWND;
$browser->Visible = true;
$browser->Navigate("$site");
// Still working?
while ($browser->Busy) {com_message_pump(4000);
}$im = imagegrabwindow($handle, 0);
$browser->Quit();
imagepng($im, "temp.png");
imagedestroy($im);
// Crop browser window, resize and save image
$width = '1180';
$height = '872';
$x_offset = '10';
$y_offset = '157';
$qulity = '100';
exec("convert temp.png -crop {$width}x{$height}+{$x_offset}+{$y_offset} -resize x200 $qulity $value.jpg");
echo "<img src=\"$value.jpg\">";
}
?>
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: htm to jpeg setup?
To get a raster image of a web page (local or URL), http://wkhtmltopdf.org/downloads.html seems to do the job without fuss.Is there anyway to produce more of a screenshot?
You can specify the height you want (to get just the top "screenfull") or no height to get the entire page.
You can make a delegate.xml entry to use it from within IM. This works fine when the web page is local, but I haven't figured how to make it work from the internet. We can just wget the page first, of course.
snibgo's IM pages: im.snibgo.com
Re: htm to jpeg setup?
Thanks guys really great and considerate. I hope I can make good contributions to this great forum once I learn more about ImageMagick. @Bonzo Thank you, what is good is that PHP is a language I am very proficient with. @snibgo I am checking out it looks really cool. Your advice is super helpful. @fmw42 thank you as well. Thanks