scale.sh (310B)
1 #!/bin/sh 2 if [ $# -lt 2 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then 3 echo "Scale image sizes using Imagemagick's convert command." 4 echo "Usage: $0 <PERCENTAGE>% <FILE[S]>" 5 exit 0 6 fi 7 8 scale="$1" 9 shift 10 for f in "$@"; do 11 out="scaled-${f}" 12 convert "$f" -resize "$scale" "$out" 13 printf '%s\n' "$out" 14 done