diff options
Diffstat (limited to 'images')
-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 |