From d33d2f48875ed11d75f5134a4b2773c4094b245d Mon Sep 17 00:00:00 2001 From: Thorsten Vitt Date: Thu, 30 Jun 2022 12:20:30 +0200 Subject: [PATCH] Make JSON generation work with files with spaces. Fixes #57 --- convert.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/convert.sh b/convert.sh index 6cede93..04ce867 100755 --- a/convert.sh +++ b/convert.sh @@ -101,8 +101,8 @@ do #create json metadata echo " creating json metadata" #json_file=$(echo "$file" | sed "s#^\.#"$output_metadata"#;s/\.tif$/\.json/" ) - image_width=$(identify $file 2>/dev/null | sed -n '1 p' | cut -d\ -f3 | cut -dx -f1) - image_height=$(identify $file 2>/dev/null | sed -n '1 p' | cut -d\ -f3 | cut -dx -f2) + image_width=$(identify -format '%w' "$file" 2>/dev/null) + image_height=$(identify -format '%h' "$file" 2>/dev/null) printf "{\n \"imageWidth\": %s,\n \"imageHeight\": %s,\n \"tileWidth\": %s,\n \"tileHeight\": %s,\n \"zoomLevels\": %s\n}" ${image_width} ${image_height} ${tile_width} ${tile_height} ${zoom_levels} > "${json_file}"