From: Carl T. Miller carl@carltm.com
To: CentOS centos@centos.org Sent: Wednesday, August 14, 2013 5:47 AM Subject: [CentOS] convert webpage to image
What is the easiest way to convert a webpage into a jpg or png file? I've seen several programs that can do various conversions, but nothing open source that can do it in a single conversion.
I wrote a few lines to do this, but it involves using firefox, and 'import' from ImageMagick.
The first script starts firefox in a virtual frame:
=== Xvfb :2 -screen 0 1280x1024x24 > /dev/null 2>&1 & export DISPLAY=localhost:2.0
firefox http://ip.of.your.page/page.html & ===
Then the second script captures/crops what I want:
=== export DISPLAY=localhost:2.0 import -crop '1024x512+54+235' -window root /path/to/result.png ==
You'll have to adjust the crop values to what you want.