AntennaPod/artwork/screenshots/generateScreenshots.sh

72 lines
2.4 KiB
Bash
Raw Normal View History

2020-01-14 10:18:41 +01:00
#!/bin/sh
function generateText() {
echo "$1"
2020-04-11 22:04:20 +02:00
convert -size 1698x750 xc:none -gravity Center -pointsize 130 -fill white -font Lato-Regular \
2020-01-14 10:18:41 +01:00
-annotate 0 "$1" /tmp/text.png
}
2020-07-19 10:51:23 +02:00
function generateTabletText() {
echo "$1"
convert -size 1730x350 xc:none -gravity Center -pointsize 80 -fill white -font Lato-Regular \
-annotate 0 "$1" /tmp/text.png
}
2020-01-14 10:18:41 +01:00
function simplePhone() {
generateText "$1"
convert templates/phone.png \
$2 -geometry +306+992 -composite \
2020-01-14 10:18:41 +01:00
/tmp/text.png -geometry +0+0 -composite \
$3
}
2020-07-19 10:51:23 +02:00
function simpleTablet() {
generateTabletText "$1"
convert $2 -resize 1280 "/tmp/resized-image.png"
convert templates/tablet.png \
/tmp/resized-image.png -geometry +227+459 -composite \
/tmp/text.png -geometry +0+0 -composite \
$3
}
2020-01-14 10:18:41 +01:00
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`
2020-07-19 10:51:23 +02:00
text6=`cat raw/$language/texts.txt | head -7 | tail -1`
2020-01-14 10:18:41 +01:00
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
2020-01-14 10:18:41 +01:00
generateText "$text3"
convert templates/twophones.png \
templates/twophones-a.png -geometry +0+10 -composite \
raw/$language/03a.png -geometry +119+992 -composite \
2020-01-14 10:18:41 +01:00
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
2020-01-14 10:18:41 +01:00
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
2020-07-19 10:51:23 +02:00
simpleTablet "$text6" raw/$language/tablet.png output/$language/tablet.png
mogrify -resize 1120 "output/$language/0*.png"
2020-01-14 10:18:41 +01:00
}
mkdir output 2>/dev/null
2020-04-11 22:04:20 +02:00
generateScreenshots "de-DE"
generateScreenshots "en-US"
generateScreenshots "nl-NL"
2020-01-14 10:18:41 +01:00
rm /tmp/text.png