Created
October 29, 2014 17:51
-
-
Save Lmd64-zz/c0623e80226c7dc01c0d to your computer and use it in GitHub Desktop.
Snap Webcam And Caption It
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdir -p ~/Pictures/BuildPhotos ; \ | |
cd ~/Pictures/BuildPhotos ; \ | |
photoPath="$(date +%y%m%d%H%M%S).png" ; \ | |
resizedPhotoPath="resized-$(date +%y%m%d%H%M%S).png" ; \ | |
/usr/local/bin/imagesnap -w 1 $photoPath ; \ | |
topCaption='this is a test' ; \ | |
topCaption="$(echo ${topCaption} | tr '[:lower:]' '[:upper:]')" ; \ | |
bottomCaption='...which is resulting in a large amount of text that displays much text in this text' ; \ | |
bottomCaption="$(echo ${bottomCaption} | tr '[:lower:]' '[:upper:]')" ; \ | |
convert $photoPath -resize 320x320\> -size 320x -gravity south $resizedPhotoPath ; \ | |
width=`identify -format %w ${resizedPhotoPath}` ; \ | |
convert $resizedPhotoPath \ | |
-gravity north -background '#0000' -font "Helvetica-Narrow-Bold" -pointsize 20 -fill black -size ${width}x caption:"${topCaption}" -composite \ | |
-gravity north -background '#0000' -font "Helvetica-Narrow-Bold" -pointsize 20 -geometry +0-4 -fill white -size ${width}x caption:"${topCaption}" -composite \ | |
-gravity south -background '#0000' -font "Helvetica-Narrow-Bold" -pointsize 20 -fill black -size ${width}x caption:"${bottomCaption}" -composite \ | |
-gravity south -background '#0000' -font "Helvetica-Narrow-Bold" -pointsize 20 -geometry +0-4 -fill white -size ${width}x caption:"${bottomCaption}" -composite \ | |
$photoPath | |
rm $resizedPhotoPath |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment