You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

22 lines
378 B

#!/usr/bin/env zsh
src="$1"
dst="$2"
sizeof() {
stat --format="%s" "$*"
}
convert "$src" -resize 800x800\> -quality 50 "$dst"
before=$(sizeof $src)
after=$(sizeof $dst)
if (( before <= after )); then
cp -f "$src" "$dst"
print -- "[0%] cp $before => $before"
else
gain=$(( ( (before - after) * 100 ) / before ))
print -- "[$gain%] convert $before => $after"
fi