From 7451e358bd6aea9c67329e20282962640ea4f96e Mon Sep 17 00:00:00 2001 From: bwt Date: Wed, 5 Feb 2020 22:02:31 -0500 Subject: [PATCH] Use mktemp for tempfile and allow out-of-aspect resizing --- generate-icns.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/generate-icns.sh b/generate-icns.sh index 5f5d262..32f712e 100755 --- a/generate-icns.sh +++ b/generate-icns.sh @@ -21,7 +21,7 @@ for SIZE in $((DIMS[0] - WIDESORT[0])) $((DIMS[0] + WIDESORT[0])); do (( SIZE > 0 && (SIZE & (SIZE - 1)) == 0 )) && RESIZE=${SIZE} done -set -x -convert "${1}" -resize ${RESIZE}x${RESIZE} /tmp/tmp.png -png2icns ${1/%png/icns} /tmp/tmp.png -rm /tmp/tmp.png +TEMPFILE=$(mktemp) +convert "${1}" -resize ${RESIZE}x${RESIZE}\! ${TEMPFILE} +png2icns ${1/%png/icns} ${TEMPFILE} +rm ${TEMPFILE}