Code: Select all
find . -name "*.jpg" -exec mogrify -define jpeg:extent=150kb -interlace line -quality 70 -strip -type TrueColor {} \;
Code: Select all
find . -name "*.jpg" -exec mogrify -define jpeg:extent=150kb -interlace line -quality 70 -strip -type TrueColor {} \;
Code: Select all
if [ find . -name "*.jpg" -size +100000c ]; then -exec mogrify -define jpeg:extent=150kb -interlace line -quality 100 -strip -type TrueColor {} else -exec mogrify -interlace line -strip -type TrueColor {} \;
Code: Select all
find . -name "*.jpg" -exec mogrify -size 100000 -define jpeg:extent=150kb -interlace line -quality 100 -strip -type TrueColor {} \;
Code: Select all
arr=(`find . -name "*.jpg"`)
num=${#arr[*]}
for ((i=0; i<num; i++)); do
size=`convert "${arr[$i]}" -format "%b" info:`
size=`echo $size | sed -n 's/^\([0-9]*\)B$/\1/p'`
size=`echo "scale=0; $size/1000" | bc`
if [ $size -ge 100 ]; then
convert "${arr[$i]}" -define jpeg:extent=150kb -interlace line -quality 70 -strip -type TrueColor "${arr[$i]}"
fi
done
You are passing "-size" as an argument to mogrify. You should be passing it as an argument to find. For example:borskaegel wrote:Ok, I removed the IF statement and I have this:
Maybe I'm just not seeing it, but how do I pass the actual file size in using -size? I tried what you see above, "-size 100000b" and nothing works. I get invalid argument as an error.Code: Select all
find . -name "*.jpg" -exec mogrify -size 100000 -define jpeg:extent=150kb -interlace line -quality 100 -strip -type TrueColor {} \;
Code: Select all
find . -name "*.jpg" -size +100000c -exec echo {} \;