January 13, 2017

imageSnap

image Snap

ImageSnap is a Public Domain command-line tool that lets you capture still images from an iSight or other video source. You can use scripting tools to automate when to take pictures.

Someone wrote a BASH scripts to take a picture of someone that has stolen their laptop computer. Pretty cool way to use the tool.

Example Script

This is an example BASH script I wrote to send a picture of me when I log into the computer every morning:

#! /bin/bash
imagesnap -q -w 2 ~/Desktop/$(date +%y%m%d%H%M%S).png
PHP Example
#!/usr/bin/php
<?php
$files=shell_exec("imagesnap -q -w 2 ~/Desktop/$(date +%y%m%d%H%M%S).png");
?>

By default the picture will use the laptop camera, so if I hook up an external display with a camera it won't use that. I added the 2 seconds warm up because without the warm up the picture appears to be dark.

I have an action in Keyboard Maestro to enable the script to run within a minute after I log into the computer.

Cron Job

You can easily set up a file, using either of the above examples and run a cron job:

31 17 * * * user /path/to/file.sh

I can see if I am in the same mood in the morning as in the evening.

Here's a quick guide to what each item on cron line means:

Cron Sheet

Comments

Add your Comments

Feel free to leave a comment about this post.

- Feel Free to add HTML to your comment!