Skip to content

Instantly share code, notes, and snippets.

@leafo
Created April 22, 2017 01:06
Show Gist options
  • Save leafo/474cef17f6f0d6175bc3a723978fb6ff to your computer and use it in GitHub Desktop.
Save leafo/474cef17f6f0d6175bc3a723978fb6ff to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
rawdir="$1"
[ -z "$rawdir" ] && echo "missing dir" && exit
dir=$(cd "$rawdir" && pwd)
tmp=$(mktemp -d)
(
cd "$tmp"
ffmpeg -f v4l2 -s 640x480 -ss 00:00:3 -i /dev/video0 -vframes 1 -qscale:v 2 webcam.jpg
scrot -q 1 desktop.png
# composite
gm composite -gravity SouthEast -geometry +10+10 webcam.jpg desktop.png composite.png
ts=$(date +%s)
cp composite.png "$dir/$ts.png"
echo "Wrote " "$dir/$ts.png"
)
rm -r "$tmp"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment