Sort JPEGs by size descending before resizing

This commit is contained in:
2026-07-04 22:45:33 -04:00
parent 03d268ac89
commit c7877eff74
+3 -2
View File
@@ -10,8 +10,9 @@ source "$SCRIPT_DIR/config.sh"
echo "Resizing large JPGs in $(pwd)" echo "Resizing large JPGs in $(pwd)"
find . -regextype posix-egrep -regex ".*\.(jpg|JPG|JPEG|jpeg)$" -print0 | while IFS= read -r -d '' f find . -regextype posix-egrep -regex ".*\.(jpg|JPG|JPEG|jpeg)$" -printf '%s\t%p\0' | \
do sort -z -t$'\t' -k1,1rn | \
while IFS=$'\t' read -r -d '' _size f; do
# Skip files already processed with these parameters # Skip files already processed with these parameters
COMMENT=$(~/Applications/magick identify -format "%c" "$f" 2>/dev/null) COMMENT=$(~/Applications/magick identify -format "%c" "$f" 2>/dev/null)
if [[ "$COMMENT" == "$MAGICK_COMMENT" ]]; then if [[ "$COMMENT" == "$MAGICK_COMMENT" ]]; then