Skip to content

Instantly share code, notes, and snippets.

@jontelang
Created October 12, 2017 08:58
Show Gist options
  • Save jontelang/f0634a98590fe56f4d7a7c9059180c1a to your computer and use it in GitHub Desktop.
Save jontelang/f0634a98590fe56f4d7a7c9059180c1a to your computer and use it in GitHub Desktop.
Automatically takes screenshots + webcam shots and organises them into folders
function snapimage(){
mv screensnap.jpg ~/.Trash
mv screensnap.png ~/.Trash
mv camerasnap.jpg ~/.Trash
mv camerasnap.png ~/.Trash
cd /tmp #/Volumes/FUJITSU/Automatic-Images-Via-Imagesnap/
# /usr/sbin/screencapture -x screensnap.png
/usr/sbin/screencapture -x screensnap.png
/usr/local/bin/imagesnap -T2 camerasnap.png
sips -s format jpeg screensnap.png --out screensnap.jpg
sips -s format jpeg camerasnap.png --out camerasnap.jpg
#convert -resize x480 /tmp/screensnap.png /tmp/screensnap.png
filename=$(date +%Y-%m-%d___%H.%M.%S.jpg)
year=$(date +%Y)
month=$(date +%m)
day=$(date +%d)
/usr/local/bin/convert +append camerasnap.jpg screensnap.jpg $filename
chmod 755 $filename
mkdir -p /Volumes/FUJITSU/Automatic-Images-Via-Imagesnap/$year/$month/$day
mv $filename /Volumes/FUJITSU/Automatic-Images-Via-Imagesnap/$year/$month/$day/$filename
# echo "filename: $filename"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment