Created
January 28, 2016 22:38
-
-
Save levhita/7925383a2aa867a2c863 to your computer and use it in GitHub Desktop.
Allows me to add subtitles to a sequence of images.
This file contains hidden or 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
#!/bin/bash | |
input=$1 | |
output=$2 | |
declare -A st1=([text]="C IS THE FRUIT OF COMPUTING" [start]=80 [end]=123 ) | |
declare -A st2=([text]="YOU CAN MAKE GAMES" [start]=124 [end]=161 ) | |
declare -A st3=([text]="DATABASES, COMPILERS" [start]=162 [end]=210 ) | |
declare -A st4=([text]="ENGINES, DRIVERS" [start]=211 [end]=247 ) | |
declare -A st5=([text]="THERE'S, UM" [start]=248 [end]=265 ) | |
declare -A st6=([text]="C EMBEDDED SYSTEMS" [start]=266 [end]=289 ) | |
declare -A st7=([text]="C DNSS, C APPS" [start]=290 [end]=328 ) | |
declare -A st8=([text]="IN CELLPHONES, IN TVS" [start]=329 [end]=402 ) | |
declare -A st9=([text]="THERE'S BYTECODE C AND MICROPROCESSOR C" [start]=403 [end]=474 ) | |
declare -A st10=([text]="INTERPRETED C" [start]=475 [end]=545 ) | |
declare -A st11=([text]="OBJECTIVE-C" [start]=546 [end]=599 ) | |
declare -A st12=([text]="ANSI C" [start]=600 [end]=627 ) | |
declare -A st13=([text]="C PLUS PLUS" [start]=628 [end]=660 ) | |
declare -A st14=([text]="C SHARP" [start]=661 [end]=702 ) | |
declare -A st15=([text]="C AND BASH" [start]=703 [end]=741 ) | |
declare -A st16=([text]="C ON ROUTERS" [start]=742 [end]=783 ) | |
declare -A st17=([text]="C COMMAND LINES" [start]=784 [end]=827 ) | |
declare -A st18=([text]="THAT'S..." [start]=828 [end]=870 ) | |
declare -A st19=([text]="THAT'S ABOUT IT" [start]=871 [end]=915 ) | |
#.1,.3:.3,.6:.6,.9:.9,1 | |
progression_back=( .1 .3 .6 .9 ) | |
progression_front=( .3 .6 .9 1 ) | |
mkdir $output/ | |
rm -rf $output/*.png | |
cp $input/*.png $output/ | |
for i in {1..19}; do | |
ref=st$i[text]; text=${!ref} | |
ref=st$i[start]; start=${!ref} | |
ref=st$i[end]; end=${!ref} | |
echo "$text s$start e$end" | |
for j in $(seq $start $end); do | |
padded=`printf %04d $j` | |
echo -n "$padded " | |
convert "$output/$padded.png" -pointsize 32 -font "exo-extra-bold.ttf" -gravity south \ | |
-stroke "rgba(0,0,0,.9)" -fill "rgba(0,0,0,.9)" -strokewidth 4 -annotate +0+20 "$text" \ | |
-stroke none -fill "rgba(255,255,255,1)" -annotate +0+20 "$text" \ | |
"$output/${padded}-subtitled.png" | |
mv "$output/${padded}-subtitled.png" "$output/$padded.png" | |
done | |
done | |
#animate -d 4 $output/*.png | |
beep |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Used to make this -> http://imgur.com/gallery/MHRp6rK