Skip to content

Instantly share code, notes, and snippets.

@ctroncoso
Last active August 29, 2015 14:22
Show Gist options
  • Save ctroncoso/adedadd3f21c899e2618 to your computer and use it in GitHub Desktop.
Save ctroncoso/adedadd3f21c899e2618 to your computer and use it in GitHub Desktop.
Capturas volcanes.
!/bin/bash
cd /home/ctroncoso/pictures/volcan
YESTERDAY=$(date +\%Y-\%m-\%d -d'yesterday')
FOLDER=villarrica_$YESTERDAY
mkdir $FOLDER
mv $FOLDER*.jpg $FOLDER
cd $FOLDER
echo inside $(pwd)
echo
find -name '*.jpg' | sort | gawk 'BEGIN{ a=1 }{ printf "mv %s %04d.jpg\n", $0, a++ }' | bash
avconv -framerate 6 -f image2 -i %04d.jpg -vf 'scale=640:480' ../$FOLDER.mp4
cd ..
rm -rf $FOLDER
echo finished. Now on $(pwd)
#!/bin/bash
while true
do
TSF=$(date +\%Y-\%m-\%d_\%H-\%M-\%S)
TSG=$(date +\%Y-\%m-\%d_\%H:\%M:\%S)
CAM1="http://www.sernageomin.cl/camaras/Pucon/fija/pucon.jpg"
CAM2="http://www.sernageomin.cl/camaras/Calbuco/fija/calbuco.jpg"
CAM3="http://www.sernageomin.cl/camaras/Ulmo/fija/ulmo.jpg"
CAM4="http://www.sernageomin.cl/camaras/Llafen2/fija/llafenco.jpg"
echo
echo "Running $TSG"
echo "downloading"
wget --output-document=cam1_$TSF.jpg $CAM1 &>/dev/null
sleep 2
wget --output-document=cam2_$TSF.jpg $CAM2 &>/dev/null
sleep 2
wget --output-document=cam3_$TSF.jpg $CAM3 &>/dev/null
sleep 2
wget --output-document=cam4_$TSF.jpg $CAM4 &>/dev/null
echo "resizing"
convert cam1_$TSF.jpg -resize '320x240' miff:cam1_$TSF.miff
convert cam2_$TSF.jpg -resize '320x240' miff:cam2_$TSF.miff
convert cam3_$TSF.jpg -resize '320x240' miff:cam3_$TSF.miff
convert cam4_$TSF.jpg -resize '320x240' miff:cam4_$TSF.miff
#
convert -size '320x240' canvas:black cam1_$TSF.miff -flatten miff:cam1_$TSF.miff
convert -size '320x240' canvas:black cam2_$TSF.miff -flatten miff:cam2_$TSF.miff
convert -size '320x240' canvas:black cam3_$TSF.miff -flatten miff:cam3_$TSF.miff
convert -size '320x240' canvas:black cam4_$TSF.miff -flatten miff:cam4_$TSF.miff
echo "captioning"
convert cam1_$TSF.miff -fill white -undercolor '#00000080' -gravity northwest -pointsize 18 -annotate +5+5 'Ulmo' miff:cam1_$TSF.miff
convert cam2_$TSF.miff -fill white -undercolor '#00000080' -gravity northwest -pointsize 18 -annotate +5+5 'Llafenco' miff:cam2_$TSF.miff
convert cam3_$TSF.miff -fill white -undercolor '#00000080' -gravity northwest -pointsize 18 -annotate +5+5 'Pucón' miff:cam3_$TSF.miff
convert cam3_$TSF.miff -fill white -undercolor '#00000080' -gravity northwest -pointsize 18 -annotate +5+5 'Calbuco' miff:cam4_$TSF.miff
echo "compositing"
convert -background Orange \
'(' \
'(' cam1_$TSF.miff cam2_$TSF.miff -append ')' \
'(' cam3_$TSF.miff cam3_$TSF.miff -append ')' +append \
')' -pointsize 48 label:"$TSG" -gravity Center -append villarrica_$TSF.jpg
rm cam1_$TSF.jpg cam2_$TSF.jpg cam3_$TSF.jpg cam4_$TSF.jpg
rm cam1_$TSF.miff cam2_$TSF.miff cam3_$TSF.miff cam4_$TSF.miff
echo "waiting 2 minute"
sleep 120
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment