Cute. Doesn't have to be fullscreen though. import will import from a selected window if you want.
![[User Picture]](https://l-userpic.livejournal.com/54541970/2) | From: brad 2004-05-13 11:51 am (UTC)
| (Link)
|
yeah, but then i have to figure out how to get the window-id, and I'm lazy
![[User Picture]](https://l-userpic.livejournal.com/265901/210712) | From: gaal 2004-05-13 12:48 pm (UTC)
| (Link)
|
Open the browser with -name screenshot and call import with the same option. (Not actually tested.)
![[User Picture]](https://l-userpic.livejournal.com/54541970/2) | From: brad 2004-05-13 01:10 pm (UTC)
| (Link)
|
I was actually reading your raise.c code and playing with for a while, thinking that might provide a route to resize windows. (before I remembered -remote loadURL(javascript:....)
![[User Picture]](https://l-userpic.livejournal.com/265901/210712) | From: gaal 2004-05-13 03:12 pm (UTC)
| (Link)
|
Heh, I only wrote four lines there. The rest was lifted from random x client code. Happily, this practice is common, so lots of things work with both -id and -name :)
(Now I'm beginning to wonder if there's an X shell, like say perl is a libc shell.)
![[User Picture]](https://l-userpic.livejournal.com/92611566/3171) | From: mart 2004-05-13 11:48 am (UTC)
| (Link)
|
I wonder how hard it'd be just to get Gecko to render to an offscreen bitmap and save that, rather than all this (admittedly rather cool) jiggery-pokery.
What's eog, anyway?
![[User Picture]](https://l-userpic.livejournal.com/92611566/3171) | From: mart 2004-05-13 11:49 am (UTC)
| (Link)
|
After posting that I realised it was just a matter of doing apt-cache show eog… duh.
I'd do:
$ DISPLAY=:1 import -window root lj-shot.jpg $ convert -resize 200x200 lj-shot.png lj-shot-small.png
But I like having a big version and a little version on my screenshots.
From: (Anonymous) 2004-05-13 04:07 pm (UTC)
| (Link)
|
I live with the borders and use xwd and imagemagik: sleep 5 && xwd | display - -resize 80%
To improve on your method, use Xnest instead of vncserver.
![[User Picture]](https://l-userpic.livejournal.com/54541970/2) | From: brad 2004-05-13 05:05 pm (UTC)
| (Link)
|
Good info. Thanks!
![[User Picture]](https://l-userpic.livejournal.com/54541970/2) | From: brad 2004-05-13 05:09 pm (UTC)
| (Link)
|
Ugh.... the window has to be in the foreground for that to work? That makes it a lot harder to automate. I think we'll keep using vncserver.
From: (Anonymous) 2004-05-14 03:40 pm (UTC)
| (Link)
|
Actually, xwd takes a -name (WM_NAME aka the window title) or -id attribute. The WM_NAME for mozilla is usually just the html title + ' - Mozilla'.
![[User Picture]](https://l-userpic.livejournal.com/54541970/2) | From: brad 2004-05-14 03:53 pm (UTC)
| (Link)
|
Regardless, using Xnest means we can't automate it. We'll just keep using vncserver. I see no drawbacks to it.
From: (Anonymous) 2006-01-04 12:26 am (UTC)
| (Link)
|
I run firefox in Xvfb so I can do offscreen screendumps of it for printing. Its important that its offscreen as some of the images are much higher or wider than my hardware display. It would be nice if you could somehow get konqueror or firefox to render a web page to a bitmap without all this flakey stuff though.
From: (Anonymous) 2004-05-13 06:01 pm (UTC)
Clarifications | (Link)
|
Could you translate that? How does this work? What is "eog"? Thx Dumky
![[User Picture]](https://l-userpic.livejournal.com/54541970/2) | From: brad 2004-05-13 06:14 pm (UTC)
Re: Clarifications | (Link)
|
eog is just an image viewer. That command isn't necessary.
Score. Ages ago I saw sippey's blogsnaps and wanted to automate them, and, well, see this or this or this. Thanks for the kick to get it done. The script to grab the whole thing is right here. If anyone else can do the bit that uses xwininfo more gracefully I'd be a happy mendel.
![[User Picture]](https://l-userpic.livejournal.com/54541970/2) | From: brad 2004-05-13 06:26 pm (UTC)
| (Link)
|
Why use xwininfo at all? Just import the whole window, as long as you're making a new X display. (Which is why I did -window root)
Because the height of the whole root window has to be >= the height of the longest webpage you might want to capture. If you import the root window when a client window on it goes off the bottom of the screen, then you only get the visible part of the client window, so you have to make the X display big enough to fit the window (which you haven't measured yet), and then resize the browser to the height of the page.
At that point you've got a worst-case-height root window and an exact-size browser window, so you import the browser window.
![[User Picture]](https://l-userpic.livejournal.com/54541970/2) | From: brad 2004-05-13 07:18 pm (UTC)
| (Link)
|
Oh, duh. I forgot you were doing the tall thing. (Was thinking of the script's applicability towards our need....)
How about this?
xwininfo -root -children -display $XDISPLAY \
| sed '1,/children:/d; s/^ *\(0x[0-9a-f]\+\).*/\1/; T; q'
Despite defining $XDISPLAY there are hardwired :1 all over, btw.
That's pretty cool. A few problems:
- Error checking would be nice- There was already a vncserver running on :1 so the new vncserver launch failed but it went ahead and tried to launch windows on the existing :1. Note the echo message is wrong; always says :1 even if I change it to something else in the script. - Tried it on a redhat 8 machine with mozilla 1.0, and it fails. (Says "No running window found"). Don't know why. - Wouldn't defaulting to PNG make more sense than JPEG? Given that web pages tend to have lots of hard-edged figures that artifact badly in jpeg.
Installed firefox 0.8, same error. Any idea what this would be?
$ ./webshot http://www.slashdot.org slashdot.png
starting X on :27
New 'X' desktop is spike.xxxxxx.com:27
Starting applications specified in /home/me/.vnc/xstartup
Log file is /home/me/.vnc/spike.xxxxxx.com:27.log
launching browser
Xlib: extension "RENDER" missing on display ":27.0".
opening http://www.slashdot.org
No running window found.
resizing
No running window found.
importing
import: Unable to read X window image (0x4001f3).
import: Missing an image file name.
killing X server
Killing Xvnc process ID 12402
The application 'Gecko' lost its connection to the display :27.0;
most likely the X server was shut down or you killed/destroyed
the application.
Tricks to make it go fast:
- hack vncserver script that doesn't run xstartup stuff, window managers, etc. (wish there was a vncserver option to do this).
- run browser "about:blank" so it doesn't bother rendering a home page first.
For the mozilla commandline challenged, -P "Screenshot" selects a profile named "Screenshot" so you better have one pre-made or it'll hang on the profile selection screen. $BROWSER -CreateProfile Screenshot will take care of this.
![[User Picture]](https://l-userpic.livejournal.com/54541970/2) | From: brad 2004-05-20 04:08 pm (UTC)
| (Link)
|
My setup was already doing that, so I didn't really document it.
I'm sure there's a vncserver option to specify your xinit settings, but mine happen to be blank anyway.
Actually, I've been staring at the vncserver script, and I don't see an option to skip xinit-like stuff.
Only things I can think of are (a) modifying vncserver or (b) hacking up an xinit script that detects that it's being run in the screenshot script (environment variable?)
I wanted to preserve an existing working VNC setup that does have a window manager.
Hi Brad Found your post via Google and thought you possibly could help me. Following your example I experienced the next problems: 1. $ DISPLAY=:1 mozilla-firefox -P "Screenshot" -remote "openurl(javascript:window.open(' http://www.livejournal.com/','','fullscreen=yes,toolbar=no,width=800,height=800'))" This hangs. I mean it does not return shell. Is it ok? Suspect not. 2. Not sure whther it makes sense to do this after the previous step failed but still: $ DISPLAY=:1 import -window root -resize 200x200 lj-shot.jpg This displays "import" help and does nothing. May be you can clear out these things. Thank you. PS Sorry if you do not encourage such comments. |