From e0394f866cb7ad8fc35b8759c4d79e33ae483ac7 Mon Sep 17 00:00:00 2001 From: materus Date: Tue, 9 Jul 2024 20:49:32 +0200 Subject: [PATCH] scripts: convert: change convert command --- extraFiles/scripts/convert_images.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/extraFiles/scripts/convert_images.sh b/extraFiles/scripts/convert_images.sh index 12c97e9..eca7173 100755 --- a/extraFiles/scripts/convert_images.sh +++ b/extraFiles/scripts/convert_images.sh @@ -1,5 +1,9 @@ #/usr/bin/env bash IFS=$'\n' +convert_cmd () { +if ! command -v convert &> /dev/null; then nix shell nixpkgs\#imagemagick -c convert "$@"; else convert "$@"; fi +} + change_to_webp() { @@ -7,7 +11,7 @@ change_to_webp() { file="${f%.*}" file_webp="${file}.webp" echo "Trying to convert to $file_webp" - if convert "$f" "$file_webp"; then + if convert_cmd "$f" "$file_webp"; then if touch -r "$f" "$file_webp"; then rm "$f" echo "Finished converting $f"