From b17d221d8d8776a069f54ec63355b6db9b3bcf23 Mon Sep 17 00:00:00 2001 From: Robert Johnson Date: Thu, 31 Aug 2023 11:26:07 -0400 Subject: [PATCH] added help comments. --- cut_counters.sh | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/cut_counters.sh b/cut_counters.sh index 95f2f3e..7c83107 100755 --- a/cut_counters.sh +++ b/cut_counters.sh @@ -3,6 +3,11 @@ # To use this program, pleas supply an initial image, then the number of cuts # You want. +if [ "$#" -ne 3 ]; then + echo "Usage: $0 " + exit 1 +fi + width=`identify -ping -format '%w' $1` height=`identify -ping -format '%h' $1` no_v_slices=$2 @@ -13,4 +18,18 @@ vert_size=`echo "$height/($no_h_slices+1)" | bc -l` hort_size=`echo "$width/($no_v_slices+1)" | bc -l` echo $vert_size -echo $hort_size \ No newline at end of file +echo $hort_size + +for ((size=1; size<=num_sizes; size++)); do + width=$((size * 100)) + height=$((size * 100)) + + output_filename="${output_base_name}_${width}x${height}.jpg" + + # Use 'convert' command to resize the image + convert "$source_image" -resize "${width}x${height}" "$output_filename" + + echo "Created: $output_filename" +done + +echo "All images created successfully."