[CentOS] CentOS 6 and screenshot of website
walter at doxlock.com
Thu Jan 5 15:37:40 UTC 2012
Am 05.01.2012 12:52, schrieb John Hodrien:
> So he wants to be able to capture an image of what a website looks like from
> the command line, and not really take a screenshot at all.
Indeed, as there is no screen...
This is diffcult, as websites need to be rendered
and one just has to google for ACID-3 to see that
this not that straightforward.
> I think that's a fair summary anyway...
Yes, thanks for the clarification!
As a workaround, I'd use a "virtual" screen, i.e.
automate the tasks that would have to be done for
a "real" screenshot. This can be scripted without
any user interaction:
* Run Xvnc in the desired resolution/depth
Sort of a headless X11, debug by connecting via VNC
* setup authentication using xauth (or even xhost if desperate)
* export $DISPLAY to access it
* open the URL to "screenshot" in firefox/chrome/opera, e.g.
firefox -height x -width y "$url"
(the -height and -width options still work, right?)
* run xwininfo and grep for the name of the browser window
to get the windows id
* Screenshot it:
xwd -id $browserid | xwdtopnm | pnmtojpeg > website.jpg
* kill firefox process
* kill Xvnc if no more screenshots are needed
All steps can also be done manually, therefore
debugging should be easily step by step.
More information about the CentOS