khtml2png - Take Command Line Web Screenshots on Linux

7 views
Skip to first unread message

Dhaval Soni

unread,
Jul 27, 2009, 1:33:22 PM7/27/09
to vglug
Dear All,

khtml2png is a helpful tool for capturing an image of a webpage with ease. It's nice to use because it will get the entire length of the site, no matter whether it is fully visible in the browser. And, it sure beats shell scripting Firefox to open on a different display and capturing an image with Imagemagick, which is a royal pain in the butt. I embed this application in PHP scripts to create web design roundups over at my other blog. I was able to capture 75 minimal web designs without much hassle.

This application is a little harder to install because it's not in the Ubuntu repositories. I couldn't find a Deb file, so you'll have to compile it from scratch. Scratch that! I found one at Sourgeforge. Install that, or compile with the directions below. That being said, if someone wants to post a link to a Deb file or a repository, I would love you forever. You need to have a few packages compiled to use khtml2png, including g++, KDE 3.x, kdelibs for KDE 3.x (kdelibs4-dev), zlib (zlib1g-dev), and cmake. This command should work:

sudo apt-get install g++ kdelibs zlib1g-dev cmake

You may need more packages than that. It's hard for me to tell because I have so many already installed ;-) Post in the comments if you need help. After that, compile it!

./configure
make
make install

You can use it to take a screenshot with a command like the following:

/usr/bin/khtml2png2 --display --width 1024 --height 768 http://thedailyubuntu.blogspot.com/ /home/you/webshot.png

Link to Article: http://linuxon-line.blogspot.com/2009/07/khtml2png-take-command-line-web.html

--
Kind regards,
Dhaval Soni

Cell: +91-966.202.9620
***************************
According to Mahatma Gandhi: "First they ignore you, then they laugh at you, then they fight you, then you win." So by that reckoning, it must be pretty much 'job done' for free software...!

"Computers are like air conditioners: They stop working when you open WindowZ."

Wiki: https://fedoraproject.org/wiki/User:Sonidhaval
Blog: http://linuxon-line.blogspot.com/
Reply all
Reply to author
Forward
0 new messages