diff --git a/images_resize.sh b/images_resize.sh index dc75643..f8d1910 100755 --- a/images_resize.sh +++ b/images_resize.sh @@ -10,8 +10,9 @@ source "$SCRIPT_DIR/config.sh" echo "Resizing large JPGs in $(pwd)" -find . -regextype posix-egrep -regex ".*\.(jpg|JPG|JPEG|jpeg)$" -print0 | while IFS= read -r -d '' f -do +find . -regextype posix-egrep -regex ".*\.(jpg|JPG|JPEG|jpeg)$" -printf '%s\t%p\0' | \ + sort -z -t$'\t' -k1,1rn | \ + while IFS=$'\t' read -r -d '' _size f; do # Skip files already processed with these parameters COMMENT=$(~/Applications/magick identify -format "%c" "$f" 2>/dev/null) if [[ "$COMMENT" == "$MAGICK_COMMENT" ]]; then