tools to create bordered cards in a sprite
authorMatteo Nastasi <nastasi@alternativeoutput.it>
Thu, 30 Apr 2020 06:48:33 +0000 (08:48 +0200)
committerMatteo Nastasi <nastasi@alternativeoutput.it>
Thu, 30 Apr 2020 06:48:33 +0000 (08:48 +0200)
bin/borderizer.sh [new file with mode: 0755]
bin/sprite_main.sh [new file with mode: 0755]
bin/spriter.sh [new file with mode: 0755]
briskin5/img/with_border_template.png [new file with mode: 0644]
briskin5/img/with_border_template.xcf [new file with mode: 0644]
img/beta.png [new file with mode: 0644]
img/beta_light.png [new file with mode: 0644]

diff --git a/bin/borderizer.sh b/bin/borderizer.sh
new file mode 100755 (executable)
index 0000000..f69874f
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+if [ $# -ne 3 -o "$1" = "-h" -o "$1" = "--help" ]; then
+    echo "$0 <folder_in> <template_file> <suffix>"
+    exit 1
+fi
+
+fold=$1
+tmpl=$2
+sfx=$3
+
+w=$(identify -format "%w" ${fold}/00${sfx}.png)
+h=$(identify -format "%h" ${fold}/00${sfx}.png)
+
+wt=$(identify -format "%w" "${tmpl}")
+ht=$(identify -format "%h" "${tmpl}")
+
+x=$(((wt - w) / 2))
+y=$(((ht - h) / 2))
+
+for card in $(seq 0 39); do
+    convert "$tmpl" $(printf "%s/%02d%s.png" "$fold" "$((seed * 10 + card))" "$sfx") \
+            -geometry +${x}+${y} -composite $(printf "%s/%02d_bord%s.png" "$fold" "$((seed * 10 + card))" "$sfx")
+done
diff --git a/bin/sprite_main.sh b/bin/sprite_main.sh
new file mode 100755 (executable)
index 0000000..422e82e
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/bash
+./bin/borderizer.sh briskin5/img briskin5/img/with_border_template.png ""
+./bin/spriter.sh briskin5/img "_bord" briskin5/img/cards_xx
+geeqie briskin5/img/cards_xx_bord.png
diff --git a/bin/spriter.sh b/bin/spriter.sh
new file mode 100755 (executable)
index 0000000..a972251
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/bash
+#
+#  Max height in play area 121 px
+#
+
+if [ $# -ne 3 -o "$1" = "-h" -o "$1" = "--help" ]; then
+    echo "$0 <folder_in> <suffix> <file_out_without_extension>"
+    exit 1
+fi
+fold=$1
+sfx=$2
+fou=$3
+
+w=$(identify -format "%w" ${fold}/00${sfx}.png)
+h=$(identify -format "%h" ${fold}/00${sfx}.png)
+
+convert -size $((w * 8))x$((h * 6)) xc:none ${fou}${sfx}_bg.png
+
+argz="${fou}${sfx}_bg.png"
+
+for seed in 0 1 2 3; do
+    for card in $(seq 0 9); do
+        x=$(((seed * 2 + card / 5) * w)) 
+        y=$(((card % 5) * h))
+        argz="$argz $(printf "%s/%02d%s.png" "$fold" "$((seed * 10 + card))" "$sfx") -geometry +${x}+${y} -composite "
+    done
+done
+
+argz="$argz ${fou}${sfx}.png"
+convert $argz
diff --git a/briskin5/img/with_border_template.png b/briskin5/img/with_border_template.png
new file mode 100644 (file)
index 0000000..03946d1
Binary files /dev/null and b/briskin5/img/with_border_template.png differ
diff --git a/briskin5/img/with_border_template.xcf b/briskin5/img/with_border_template.xcf
new file mode 100644 (file)
index 0000000..7ae892d
Binary files /dev/null and b/briskin5/img/with_border_template.xcf differ
diff --git a/img/beta.png b/img/beta.png
new file mode 100644 (file)
index 0000000..22929b1
Binary files /dev/null and b/img/beta.png differ
diff --git a/img/beta_light.png b/img/beta_light.png
new file mode 100644 (file)
index 0000000..e2b40cf
Binary files /dev/null and b/img/beta_light.png differ