diff options
author | InigoGutierrez <inigogf.95@gmail.com> | 2022-11-03 14:41:58 +0100 |
---|---|---|
committer | InigoGutierrez <inigogf.95@gmail.com> | 2022-11-03 14:41:58 +0100 |
commit | 6fd8e231c6a9f080c6271da69f3b93d581cc3c6b (patch) | |
tree | c99858973184da0ece808288efe9e8cded57b97d | |
parent | 97c1168f3edb31a28d7371332f80bb141c6e3721 (diff) | |
download | scripts-6fd8e231c6a9f080c6271da69f3b93d581cc3c6b.tar.gz scripts-6fd8e231c6a9f080c6271da69f3b93d581cc3c6b.zip |
Fixed genTile.sh
-rwxr-xr-x | images/genTile.sh | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/images/genTile.sh b/images/genTile.sh index 66c89c0..c1d7089 100755 --- a/images/genTile.sh +++ b/images/genTile.sh @@ -14,6 +14,10 @@ errorAndUsage() { printf '%s error: %s\n%s\n' "$0" "$*" "$usageMessage" >&2 } +clean() { + [ -f "$tmpFile" ] && rm "$tmpFile" +} + size=64 borderSize=2 @@ -41,21 +45,4 @@ outputFile="${color}.png" [ -z "$color" ] && errorAndUsage "No color specified." && exit 1 magick -size "${borderlessSize}x${borderlessSize}" "canvas:${color}" "$tmpFile" || exit 2 -convert "$tmpFile" -bordercolor black -border "${borderSize}x${borderSize}" "$outputFile" || exit 2 - - -#!/bin/sh - -# template.sh: A template for sh scripts -# -# Usage: template.sh [-ac] [-b OPTARG] FILE... - -usageMessage="Usage: ${0} [-ac] [-b OPTARG] FILE..." - -error() { - printf '%s error: %s\n' "$0" "$*" >&2 -} - -errorAndUsage() { - printf '%s error: %s\n%s\n' "$0" "$*" "$usageMessage" >&2 -} +convert "$tmpFile" -bordercolor black -border "${borderSize}x${borderSize}" "$outputFile" || clean && exit 2 |