frisco
May 13th, 2004, 00:42
Couldn't think of a short title to describe what i'm looking for...
I want a method to generate an image of what a website looks like rendered in a graphics-enabled browser, so that i could run 'command http://www.screamingelectron.org/ > se.jpg' and se.jpg would be an image of what the se site looks like when rendered in, say, mozilla. I want to be able to do this from cron or from other scripts, so the method needs to be cmdline based. I thought i might be able to get links to do this, but if it's possible via links then i haven't figured out how. About the only other way i could think of was to run moz offscreen somewhere, either in a different X server or in a non-visible desktop/screen, and do xwd's of that window, but that requires X to be running (which i would rather not have to do) and just seems clunky.
Anyone got a solution for me?
elmore
May 13th, 2004, 00:55
I'm interested in seeing what you're doing with all this...
I found a commandline screen capture util. called scrot. It's not in the ports but the homepage is here:
http://www.linuxbrit.co.uk/scrot/
I'm compiling or attempting to compile now. Don;t know if you'll be able to achieve your desired results with this though -f.
I'll continue to look around.
frisco
May 13th, 2004, 01:36
For screen capture i generally use xwd, part of XFree86, or import, part of ImageMagick. Both work ok from cmdline.
Generating an image of what a website would look like when rendered is something that i've had various kooky reasons for wanting to do. Imagine mailing someone a jpeg of the last webpage they looked at (coupled with some packet interception, this would be quite feasible), or cycling through jpeg's of cnn.com's current frontpage as your screensaver (not just an rss feed, which may not be available for the info you want).
My current reason:
I have a few monitors around my office that display various stats and images, including two that rotate between various images (webcam photos, weather maps, charts of data), displaying 4 of them on a monitor at any given time. We also have various equipment that displays stats nicely on a webpage. While i could simply run mozilla in fullscreen mode, this doesn't fit in nicely with my 4 rotating images - i'd rather have the equipment's webpages show as one of the rotating images.
soup4you2
May 13th, 2004, 07:20
any chance we could see one of these rotating images?
i'm just currious because for the past couple weeks i've been setting up a whole MRTG, SNMP system.. twords websites i'm time'ing how long it takes to download a site though wget and plot those into MRTG.. along w/ aroung 15 more graphs of various things.. i'm looking for ways to spice it up a bit...
Strog
May 13th, 2004, 09:39
It's in FreeBSD ports (/usr/ports/graphics/scrot/) and NetBSD's pkgsrc (/usr/pkgsrc/graphics/scrot/). There were some unofficial OpenBSD ports pages that had it but apparently those are no longer maintained. I did find another page with a few unofficial OpenBSD ports (http://inphobia.net/openbsd/) including one for scrot (http://inphobia.net/openbsd/ports/scrot-0.6.tar.gz). I use it for my screenshots and it works great. It can scale the images for the size you are looking for.
The mozilla site has a page with command line options (http://www.mozilla.org/docs/command-line-args.html) that would allow you to open it with your site or even remotely do this. I think you are going to need X or some sort of frambuffer on whatever machine will be taking the shots. Perhaps you could start another X session on :1 and do it all out of sight on a box that is already running X.
frisco
May 13th, 2004, 10:32
any chance we could see one of these rotating images?
Here is my office (http://www.blackant.net/tmp/office-messy.jpg) (very messy, i've been tearing open hd's for the past week).
The upper left tv is the view down the hallway, so i can see when my boss is coming. Below that, the leftmost monitor displays stuff grep'd from all our servers' syslog messages. The middle two monitors are my desktop. On the rightmost monitors, the left one shows webcam captures from around campus (nice to see how long the lunch line is, or who is in the server room) plus a weather map (i bike to work and like to know when the rain will hit, what direction the wind is blowing), and the right one show graphs. These two monitors plus the one furthest left are all the same machine, here's a screen capture of that machine (http://www.blackant.net/tmp/beauty-sc.jpg).
I use wget to dl the webcam images, montage (part of ImageMagick) to put 4 images together, a shell script to decide which 4 images go together, and a perl script w/ GD to generate the weather map (it's a composite of two weather maps, plus a weird addition).
soup4you2
May 13th, 2004, 18:59
pretty cool.... i like...
cod3fr3ak
June 7th, 2004, 13:58
Very cool!
frisco
June 8th, 2004, 16:24
I installed tightvnc and dillo, created a separate user to run vnc, and changed that user's $HOME/.vnc/xstartup to the following:
#!/bin/sh
while [ 1 ]; do
dillo -f http://news.google.com &
sleep 60
import -window root -display `hostname`:1 -crop 640x550+0+0 \
/tmp/image.jpg
sleep 540
kill `ps ux | grep [d]illo | cut -c10-15`
done
Finally, i set up vnc to run at reboot via cron:
@reboot vncserver -depth 8 -geometry 800x600 -viewonly
Now /tmp/image.jpg is a rendered http://news.google.com/ and i can include that image in one of the rotating montages i have.
Caveats:
- I couldn't figure out how to get dillo to reload (it doesn't like the http equiv's), so i'm killing it off after 9 minutes. I could use mozilla, but even with the killing and respawning, dillo will be more lightweight.
- If running more than one vncserver, may need to specify a different '-display' option.
- The crop option was chosen through experimentation. I should be able to use a specific '-window' option, but couldn't figure out how to reliably determine the right window name, even using xlsclients.
Georg
June 14th, 2005, 08:48
I suggest a program called Screen VidShot (http://www.geovid.com/Screen_VidShot/)... It might be helpful for you but I'm not sure. It can capture video from your desktop....
Strog
June 14th, 2005, 09:18
Georg,
Perhaps that's a good program but unfortunately it's a Windows app and not likely to be very useful for a *nix solution. :wink: