Exit on imagemagick failure

This commit is contained in:
Sasha Koshka 2024-08-08 17:47:08 -04:00
parent 5061bfba82
commit 71014afc0a

View File

@ -73,6 +73,7 @@ if test -z "$output"; then
output="captioned-`basename "$input"`"
fi
if ! test -f "$input"; then
echo "$name: $input not found"
exit 1
@ -88,7 +89,7 @@ convert \
-pointsize 55 -size "$captionWidth" -gravity Center \
caption:"$caption" \
-bordercolor white -border 20x20 \
"$captionTemp"
"$captionTemp" || exit 1
echo "$name: compositing over $input..."
# https://www.imagemagick.org/discourse-server/viewtopic.php?t=33797
@ -97,7 +98,7 @@ convert \
-background white \( "$input" -coalesce \) \
-set page "%[fx:u.w]x%[fx:u.h+v.h]+%[fx:t?(u.w-v.w)/2:0]+%[fx:t?u.h:0]" -coalesce \
null: -insert 1 -layers composite -layers optimize \
"$output"
"$output" || exit 1
rm "$captionTemp"
echo "$name: done!"