Skip to content

Instantly share code, notes, and snippets.

@freshteapot
Created November 1, 2023 13:28
Show Gist options
  • Save freshteapot/78c21d35719f126c0f028ce6e0c06420 to your computer and use it in GitHub Desktop.
Save freshteapot/78c21d35719f126c0f028ce6e0c06420 to your computer and use it in GitHub Desktop.
Resize from 6.5 to 5.5
#!/bin/bash
# Resize from 6.5 to 5.5
# Adapted from https://gist.github.com/fhasni/f741333d1437b1033652d30cc3e7543d
VERSION="1.0.3"
OUTPUT_DIR="output/scaled"
for filename in ./${VERSION}/*; do
w=$(printf "%.2f" $(echo '(1242/1284)*100' | bc -l))
h=$(printf "%.2f" $(echo '(2208/2778)*100' | bc -l))
mkdir -p $OUTPUT_DIR
echo $(basename "$filename")
convert "$filename" -resize "$w%x$h%" "$OUTPUT_DIR/$(basename "$filename")"
echo "$OUTPUT_DIR/$(basename "$filename")"
done
echo "DONE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment