[KLUG Members] non-X image processing

Bruce Smith members@kalamazoolinux.org
07 May 2002 15:34:02 -0400


> 2.  Another possibility I'm working on is manually adjusting the settings 
> based on the time of day, but I can't seem to get the date command to give 
> me just time to the nearest hour.  I also want to use this to stop it from 
> updating in the middle of the night when the lights are off.

# this returns the hour

date +%H

# If you want to round, you can check the current minute > 30.
# Let me know if you need help with that in a script.

> 3.  The script has to be launched manually, and there's no way to interact 
> with it other than to ps -e and kill the sleep process.  Any way to make it 
> launch through rc.d like a real service?  Also helpful would be a way to 
> dump a .pid file into /var/run.

There are lots of ways to run it, like with a cron job that runs every
minute, every 3 minutes, or every hour, ....

> 4.  I'd also like to add a timestamp to the images.  Convert is supposed to 
> be able to do this, but I haven't gotten it right yet.  The man page is 
> pretty cryptic, even for a man page.

# this works for me:

d="`date "+%D %T"`"
d2="`date "+%Y%m%d-%H%M%S"`"
/usr/bin/X11/convert \
	-fill white -box black \
	-draw "text 5,10 \"$d\"" infile.jpg cam-${d2}.jpg


# you can also add a -font parameter if you don't like the default.

--------------------------------------------
Bruce Smith                bruce@armintl.com
System Administrator / Network Administrator
Armstrong International, Inc.
Three Rivers, Michigan  49093  USA
http://www.armstrong-intl.com/
--------------------------------------------