Browse Source

add script to convert svg to png

Pi 1 month ago
parent
commit
110cf6c847
1 changed files with 19 additions and 1 deletions
  1. 19 1
      convert.sh

+ 19 - 1
convert.sh

@@ -1,2 +1,20 @@
 #!/bin/bash
-for size in 48 72 96 144 192 512; do convert -scale "${size}x${size}" rest/static/clip/icon.svg -colors 255 -type Palette  -background white -quality 75 -alpha background  rest/static/clip/${size}.png; done
+set -euo pipefail
+for i in clip goto upload
+do
+	(
+		cd "rest/static/$i"
+		for x in 48 72 96 144 192 512
+		do
+			convert \
+				-background transparent \
+				-transparent white \
+				-density 400 icon.svg \
+				-geometry "${x}x${x}" \
+				-define png:compression-level=9 \
+				-define png:compression-filter=4 \
+				-strip "$x".png \
+			&& : "Use ImageMagick to convert SVG to PNG"
+		done
+	)
+done