2022-11-16 03:56:07 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2022-11-14 00:12:44 +00:00
|
|
|
LENGTH=128
|
|
|
|
MARGIN=1
|
|
|
|
WIDTH=126
|
2022-11-17 17:27:38 +00:00
|
|
|
HEIGHT=84
|
2022-11-14 00:12:44 +00:00
|
|
|
|
|
|
|
TEMP=`mktemp -d -p ""`
|
|
|
|
|
2022-11-15 06:20:18 +00:00
|
|
|
# pride flags
|
2022-12-09 06:03:47 +00:00
|
|
|
for svg_path in src/pride/pride-*.svg; do
|
2022-11-17 17:27:38 +00:00
|
|
|
svg=${svg_path#"src/pride/"}
|
2022-11-14 00:12:44 +00:00
|
|
|
# resize
|
|
|
|
convert ${svg_path} \
|
|
|
|
-resize ${WIDTH}x${HEIGHT} \
|
|
|
|
$TEMP/resized-${svg%.svg}.png
|
|
|
|
# round borders
|
|
|
|
magick $TEMP/resized-${svg%.svg}.png \
|
|
|
|
\( +clone -alpha extract \
|
|
|
|
-draw 'fill black polygon 0,0 0,10 10,0 fill white circle 10,10 10,0' \
|
|
|
|
\( +clone -flip \) -compose Multiply -composite \
|
|
|
|
\( +clone -flop \) -compose Multiply -composite \
|
|
|
|
\) -alpha off -compose CopyOpacity -composite $TEMP/rounded-${svg%.svg}.png
|
|
|
|
# add margin
|
|
|
|
convert $TEMP/rounded-${svg%.svg}.png \
|
|
|
|
-bordercolor transparent \
|
|
|
|
-border ${MARGIN} \
|
|
|
|
$TEMP/margin-${svg%.svg}.png
|
|
|
|
# make square
|
|
|
|
convert -background transparent \
|
|
|
|
-gravity center \
|
|
|
|
$TEMP/margin-${svg%.svg}.png \
|
|
|
|
-extent ${LENGTH}x${LENGTH} \
|
2022-11-17 17:27:38 +00:00
|
|
|
./dist/pride/${svg%.svg}.png
|
2022-11-15 06:20:18 +00:00
|
|
|
echo ${svg%.svg} created
|
|
|
|
done
|
|
|
|
|
2022-11-14 00:12:44 +00:00
|
|
|
rm -rf $TEMP
|
|
|
|
|
|
|
|
# fix and remove metadata
|
2022-11-17 17:27:38 +00:00
|
|
|
exiftool -all= -overwrite_original ./dist/pride/*
|