From bb599c9fbba57548cdf25be27ea6748d947a91f9 Mon Sep 17 00:00:00 2001 From: NishiOwO Date: Sun, 10 May 2026 03:22:24 +0900 Subject: [PATCH] add icon-converter.sh --- tools/icon-converter.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 tools/icon-converter.sh diff --git a/tools/icon-converter.sh b/tools/icon-converter.sh new file mode 100755 index 0000000..9d96846 --- /dev/null +++ b/tools/icon-converter.sh @@ -0,0 +1,15 @@ +#!/bin/sh +if [ "x$1" = "x" -o "x$2" = "x" ]; then + echo "Usage: $0 input name" + exit 1 +fi + +GEO=`convert $1 json:- 2>/dev/null | jq -r '(.[0].image.geometry.width | tostring) + "x" + (.[0].image.geometry.height | tostring)'` +WIDTH=`echo $GEO | cut -dx -f1` +HEIGHT=`echo $GEO | cut -dx -f2` + +echo "MwU32 $2[] = {" +echo " ($WIDTH << 16) | $HEIGHT," +convert $1 txt:- 2>/dev/null | grep -oE '#[0-9a-fA-F]{8}' | sed 's/^#/ 0x/' | sed -E 's/$/,/' +echo " 0" +echo "};"