Remove branding from convert script
parent
37bf31b0d3
commit
3a5f817228
|
@ -1,8 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
LENGTH=128
|
||||
MARGIN=1
|
||||
WIDTH=126
|
||||
HEIGHT=84 # flags
|
||||
#ROUND=10
|
||||
|
||||
TEMP=`mktemp -d -p ""`
|
||||
|
||||
|
@ -34,52 +35,6 @@ for svg_path in pride/svg/*.svg; do
|
|||
echo ${svg%.svg} created
|
||||
done
|
||||
|
||||
# branding
|
||||
for svg_path in branding/svg/*.svg; do
|
||||
svg=${svg_path#"branding/svg/"}
|
||||
if [[ $svg == "treehouse-icon-wordmark.svg" ]] || [[ $svg == "treehouse-logo-full.svg" ]]; then
|
||||
# resize
|
||||
# create white background
|
||||
convert ${svg_path} \
|
||||
-resize ${WIDTH}x${WIDTH} \
|
||||
$TEMP/resized-${svg%.svg}.png
|
||||
else
|
||||
# resize
|
||||
# creates clear background
|
||||
convert -background none \
|
||||
${svg_path} \
|
||||
-resize ${WIDTH}x${WIDTH} \
|
||||
$TEMP/resized-${svg%.svg}.png
|
||||
fi
|
||||
if [[ $svg == "treehouse-icon-wordmark.svg" ]] \
|
||||
|| [[ $svg == "treehouse-logo-full.svg" ]]; then
|
||||
# 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
|
||||
else
|
||||
# already rounded
|
||||
cp $TEMP/resized-${svg%.svg}.png $TEMP/rounded-${svg%.svg}.png
|
||||
fi
|
||||
# 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} \
|
||||
./branding/png/${svg%.svg}.png
|
||||
echo ${svg%.svg} created
|
||||
done
|
||||
|
||||
rm -rf $TEMP
|
||||
|
||||
# fix and remove metadata
|
||||
|
|
Loading…
Reference in New Issue