How to convert HTML to JPEG/PNG

perl

Solution

You could us the Wight module, which allows usage of phantomjs from Perl. An example which renders a page to a .png file would look like:

use strict;
use Wight;

my $wight = Wight->new;

$wight->visit('http://www.google.com/');
$wight->render('google.png');

Another possibility would be to use the Perl selenium API in combination with phantomjs, as described in this blog article.

Problem

Is there a way in Perl to get the contents of an URL in IMAGE format? I can `use LWP::Simple` to get HTML, but still can't figure out how to get it in JPEG

Original source