Is it possible to write a script in Perl that opens different URLs and saves a screenshot of each of them?
Inspect the element you wish to capture. Open the Command Menu with Cmd + Shift + P / Ctrl + Shift + P. Type in screenshot within the Command Menu. You can now capture the screenshot of only the specific element, a viewport screenshot, or a full-page screenshot.
Fireshot FireShot is an extension available on the Chrome Webstore that lets you capture full web page screenshots. You may even edit and annotate captures and save them as PDF/JPEG/GIF/PNG files.
You could use WWW::Mechanize::Firefox to control a Firefox instance and dump the rendered page with $mech->content_as_png
.
Be aware that setting it up can pose quite a challenge, though.
If all works as expected, you can simply use a script like this to dump images of the desired websites, but you should start Firefox and resize it to the desired width manually (height doesn't matter, WWW::Mechanize::Firefox always dumps the whole page).
use WWW::Mechanize::Firefox;
use Path::Class qw/file/;
my $mech = WWW::Mechanize::Firefox->new(
bufsize => 10_000_000, # PNGs might become huge
);
$mech->get('http://www.stackoverflow.com/');
my $fh = file( 'test.png' )->open( '> :raw' );
print $fh $mech->content_as_png();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With