All entries for Wednesday 28 October 2009

October 28, 2009

University webcam image grab script thing

For no particularly good reason I've written a Bash(*) script which grabs an image from the University webcam and optionally does stuff to it. Aside from Bash it requires ImageMagick and curl, is located here and works thus:

mike@continuity:~$ ./uow_webcam_grab
uow_webcam_grab - script to grab an image from University of Warwick webcam.
Usage: uow_webcam_grab [options] [filename]
Image format is jpg unless -p is used in which case it's png. .jpg or .png extension automatically added to supplied filename it not specified.
If no filename specified output is written to stdout.
Available options:
-t : Trims image to remove the date stamp.
-h : Halves the width and height of the image. (Can be used multiple times.)
-p : Creates polaroid style snapshot. (Requires ImageMagick 6.3.1-6 or higher.)
-c : Caption for polaroid. (Does nothing if -p not used.)
-g : Converts image to greyscale
-n : Negates the image. (white -> black. yellow -> blue. etc.)
-s : Converts image to sepia like from days of yore. (Requires a version of ImageMagick higher than 5.5.3 but don't know how much higher. Ignored if filesize of retrieved image is less than 40k since that indicates image is mostly black and sepia conversion of such an image looks weird.)

E.g.

mike@continuity:~$ ./uow_webcam_grab -htp -c "$(date)" camgrab_$(date +%F-%H-%M-%S)

creates a png image called camgrab_2009-10-28-20-17-09.png which looks like:

The webcam is useless after dark.

The view from the webcam is not very interesting after dark.


(*) Or maybe it's bash, or BASH. It seems to depend where one looks. Does it matter? Well given that Unix like operating systems on which one would usually use it usually use a case-sensitive file system which would allow the creation of files named bash, Bash and BASH in the same directory on account of how they are different file names then... oh who am I kidding, no, not really.


Search this blog

Tags

Not signed in
Sign in

Powered by BlogBuilder
© MMXXIV