diff options
author | nytpu <alex@nytpu.com> | 2021-09-22 16:26:51 -0600 |
---|---|---|
committer | nytpu <alex@nytpu.com> | 2021-09-22 16:26:51 -0600 |
commit | 98f65d452abce29b6d4e645e915942599c2287a1 (patch) | |
tree | 9bc69493fc418a24155b6073ab97ccebc354ca69 | |
parent | update link to source (diff) | |
download | cheetah-bot-98f65d452abce29b6d4e645e915942599c2287a1.tar.bz2 cheetah-bot-98f65d452abce29b6d4e645e915942599c2287a1.zip |
add randomize-images tool
-rwxr-xr-x | tools/randomize-images.sh | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tools/randomize-images.sh b/tools/randomize-images.sh new file mode 100755 index 0000000..3e2e2b7 --- /dev/null +++ b/tools/randomize-images.sh @@ -0,0 +1,24 @@ +#!/bin/sh +set -eu + +if [ ! -d "$1" ]; then + printf "%s: Please provide a directory containing files to convert.\n" "$0" + exit 1 +fi + +prevdir="$(pwd)" +cd "$1" + +files="$(ls | shuf)" +cur=1 +for file in ${files}; do + printf "\rConverting Day %d (%.10s)... " "${cur}" "${file}" + mogrify -resize 'x1000>' -- "${file}" + mogrify -resize '1500x>' -- "${file}" + extension="${file##*.}" + mv -- "${file}" "D${cur}.${extension}" + cur=$((cur + 1)) +done +printf "\rOrganized and downscaled %d Files. \n" "${cur}" + +cd "${prevdir}" |