-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

,--[ On Wed, Feb 13, 2008 at 07:42:44AM +0000, pj wrote:

[snipped]

| Within x I'd maybe mangle together xwd with -nobdrs,throwing in xwininfo
| (applied to firefox) to extract firefox's window id from it followed by 
convert

I'll be glad if you post how to figure out, Firefox's web UI's window
id using xwininfo, and obviously programatically :) .

How about using GNOME Epiphany (since both use Gecko :)). Following is a
`bash` script which does the desired, in a really dirty/ugly
way. To execute this script, you require bash, coreutils, Xvfb, GNOME
Epiphany, ImageMagick, sed, awk, xlsclients and perl :) . The script is under
GPLv2 or later :)

- ----8<----8<----
#!/bin/sh
# name: grab-web.sh
# author: Ashish Shukla
# released in public domain
# requires: perl epiphany xvfb xlsclients sed awk imagemagick coreutils bash
# tested on: ubuntu-gutsy

NEW_DISPLAY=1
GRAB_JPEG=grab.jpg
URL=http://www.gnu.org/

WIN_WIDTH=1024
WIN_DEPTH=24
WIN_HEIGHT=768

[ "x$XAUTHORITY" = "x" ] && XAUTHORITY=$HOME/.Xauthority

# remove last session information
rm -f ${HOME}/.gnome2/epiphany/session_crashed.xml

xvfb-run -s "-screen 0 ${WIN_WIDTH}x${WIN_HEIGHT}x${WIN_DEPTH}" -f 
${XAUTHORITY} -n ${NEW_DISPLAY} epiphany --display=:${NEW_DISPLAY}  ${URL} &

# wait for page to load completely in ugly way
# for gigabit internet, this could be 1 or 0 ;)
sleep 10s

#grab the window id of epiphany
xid_epiphany=$(xlsclients -display :${NEW_DISPLAY} -all |sed -e 's/://' |awk 
'/^Window / { print $2 }')

#a dirty hack :), the epiphany GUI has a window id of epiphany's original 
window id + 3
xid_epiphany_gui=`perl -e "print ${xid_epiphany}+3"`

import -display :${NEW_DISPLAY} -window ${xid_epiphany_gui} jpeg:${GRAB_JPEG} 
&& echo "Grabbed :-)"

# beware no other Epiphany instances are running
killall epiphany

exit 0
- ---->8---->8----

Output from the script is posted at following URL:
http://flickr.com/photos/wahjava/2263030638/

BtW, are you trying to compete with snap.com which also does similar
stuff, but uses Firefox and probably Xvfb too :) . Anyways its none of
my business.

HTH
- -- 
Ashish Shukla आशीष शुक्ल                      http://wahjava.wordpress.com/
·-- ·- ···· ·--- ·- ···- ·- ·--·-· --· -- ·- ·· ·-·· ·-·-·- -·-· --- --
freed.in | freedom in technology and software | 22-24 February 2008 | Delhi
         ··-· ·-· · · -·· ·-·-·- ·· -·   ··--- ----- ----- ---··
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFHswNiHy+EEHYuXnQRAkurAKCHsVLJIEivNxS1Ovi6VQzFTUlNbACgjoOJ
JyYSW1pLAOs27ItlyTUmib8=
=9nWa
-----END PGP SIGNATURE-----

_______________________________________________
ilugd mailinglist -- ilugd@lists.linux-delhi.org
http://frodo.hserus.net/mailman/listinfo/ilugd
Next Event: http://freed.in - February 22-24, 2008
Archives at: http://news.gmane.org/gmane.user-groups.linux.delhi 
http://www.mail-archive.com/ilugd@lists.linux-delhi.org/

Reply via email to