diff options
author | Zach van Rijn <me@zv.io> | 2021-07-13 20:38:46 -0500 |
---|---|---|
committer | Zach van Rijn <me@zv.io> | 2021-07-13 20:38:46 -0500 |
commit | d70dc4ff13b97b4560203d49f1cfa8e9f23ec321 (patch) | |
tree | 2345c65faef896c186ef11dbd40331dcdb1be8fb /assets/images/polyguin.sh | |
parent | e977586b0e2a4c3bd1462bf2ec0573d315c37889 (diff) | |
download | site-ng-d70dc4ff13b97b4560203d49f1cfa8e9f23ec321.tar.gz site-ng-d70dc4ff13b97b4560203d49f1cfa8e9f23ec321.tar.bz2 site-ng-d70dc4ff13b97b4560203d49f1cfa8e9f23ec321.tar.xz site-ng-d70dc4ff13b97b4560203d49f1cfa8e9f23ec321.zip |
Rewrite logo composition/generation logic. Update '.gitignore' to exclude generated files.
Diffstat (limited to 'assets/images/polyguin.sh')
-rwxr-xr-x | assets/images/polyguin.sh | 90 |
1 files changed, 88 insertions, 2 deletions
diff --git a/assets/images/polyguin.sh b/assets/images/polyguin.sh index 97a2ab0..1bf0df4 100755 --- a/assets/images/polyguin.sh +++ b/assets/images/polyguin.sh @@ -1,5 +1,13 @@ #!/bin/sh -e +HERE=$(dirname $(readlink -f ${0})); +cd ${HERE}; + +rm -f gen_*; + +#--------------------------------------------------------------- +# Transparent monochrome (B on W, W on B) SVGs from master. + ## # Target: color # @@ -78,7 +86,85 @@ grep fill: polyguin.svg \ done \ ; + +#=============================================================== +docker run -v$(pwd):/x -w/x --rm -i alpine:3.14 <<'EOF' +apk add graphicsmagick imagemagick; +#=============================================================== + +#--------------------------------------------------------------- +# SVG master --> scaled PNGs for composition onto logo template. + +## +# SVG --> PNG for master logo icon. +# +# x28 is GitLab +# x54 is Website +# x200 is SPI project page +# +# This runs inside Docker because of ImageMagick bugs and GM is +# the only free software I can find that doesn't screw this up. +# +for c in color black white; do +for r in x28 x54 x200; do + gm convert -trim -density 600 -resize ${r} -background none polyguin_${c}.svg gen_polyguin_${c}_${r}.png; + chown 1000:1000 gen_polyguin_${c}_${r}.png; +done # r +done # c + + +#--------------------------------------------------------------- +# PSD master --> scaled PNGs for composition onto logo template. + ## -# SVG --> PNG +# PSD --> PNG for master logo icon. # -docker run -v$(pwd):/root --rm -it alpine:latest sh -c 'apk add graphicsmagick; cd; gm convert -trim -density 200 -resize x1000 -background none polyguin.svg polyguin.png; chown 1000:1000 polyguin.png' +# x28 is GitLab +# x54 is Website +# x200 is SPI project page +# +# GM does not support PSD anymore! +# +find . -type f -name "*.psd" | cut -d'/' -f2 | while read k; do +for r in x28 x54 x200; do + magick convert -resize ${r} "${k}[0]" "gen_${k%*.psd}_${r}.png"; + chown 1000:1000 "gen_${k%*.psd}_${r}.png"; +done +done + +#--------------------------------------------------------------- +# SVG + PSD template composition. + +## +# Contrast suffers a bit but these are great on image backgrounds. +# +for c in color black white; do +for r in x28 x54 x200; do + # transparent black polyguin + gm composite gen_polyguin_${c}_${r}.png gen_polylogo_template_black_${r}.png gen_polylogo_black_${c}_${r}.png; + chown 1000:1000 gen_polylogo_black_${c}_${r}.png; + + # transparent white polyguin + gm composite gen_polyguin_${c}_${r}.png gen_polylogo_template_white_${r}.png gen_polylogo_white_${c}_${r}.png; + chown 1000:1000 gen_polylogo_white_${c}_${r}.png; +done # r +done # c + +## +# These have better contrast and are suited for solid backgrounds. +# +# FIXME: improve contrast. +# +for r in x28 x54 x200; do + # solid black color --> grayscale polyguin + magick convert -colorspace Gray -contrast-stretch 0 gen_polylogo_black_color_${r}.png gen_polylogo_black_mono_${r}.png; + chown 1000:1000 gen_polylogo_black_mono_${r}.png; + + # solid white color --> grayscale polyguin + magick convert -colorspace Gray -contrast-stretch 0 gen_polylogo_white_color_${r}.png gen_polylogo_white_mono_${r}.png; + chown 1000:1000 gen_polylogo_black_mono_${r}.png; +done # r + +#=============================================================== +EOF +#=============================================================== |