AntennaPod/artwork/screenshots/generateScreenshots.sh
ByteHamster 6edbc21e7d Screenshot improvements
- Create screenshots in parallel
- Fixed blue border
- Switched theme screenshot and automatic downloading
- Scaling images down a bit
2020-04-10 23:40:37 +02:00

61 lines
1.9 KiB
Bash

#!/bin/sh
function generateText() {
echo "$1"
convert -size 1698x750 xc:none -gravity Center -pointsize 150 -fill white -font Lato-Regular \
-annotate 0 "$1" /tmp/text.png
}
function simplePhone() {
generateText "$1"
convert templates/phone.png \
$2 -geometry +306+992 -composite \
/tmp/text.png -geometry +0+0 -composite \
$3
}
function addLayer() {
convert $2 $1 -composite $2
}
function generateScreenshots() {
language=$1
mkdir output/$1 2>/dev/null
text0=`cat raw/$language/texts.txt | head -1 | tail -1`
text1=`cat raw/$language/texts.txt | head -2 | tail -1`
text2=`cat raw/$language/texts.txt | head -3 | tail -1`
text3=`cat raw/$language/texts.txt | head -4 | tail -1`
text4=`cat raw/$language/texts.txt | head -5 | tail -1`
text5=`cat raw/$language/texts.txt | head -6 | tail -1`
simplePhone "$text0" raw/$language/00.png output/$language/00.png
simplePhone "$text1" raw/$language/01.png output/$language/01.png
simplePhone "$text2" raw/$language/02.png output/$language/03.png
generateText "$text3"
convert templates/twophones.png \
templates/twophones-a.png -geometry +0+10 -composite \
raw/$language/03a.png -geometry +119+992 -composite \
templates/twophones-b.png -geometry +0+0 -composite \
raw/$language/03b.png -geometry +479+1540 -composite \
/tmp/text.png -geometry +0+0 -composite \
output/$language/02.png
simplePhone "$text4" raw/$language/04.png output/$language/04.png
simplePhone "$text5" raw/$language/05.png output/$language/05.png
addLayer templates/suggestions.png output/$language/05.png
mogrify -resize 1120 output/$language/*.png
optipng output/$language/*.png
}
mkdir output 2>/dev/null
generateScreenshots "de-DE" &
pids[0]=$!
generateScreenshots "en-US" &
pids[1]=$!
for pid in ${pids[*]}; do
wait $pid
done
rm /tmp/text.png