Sort JPEGs by size descending before resizing
This commit is contained in:
+3
-2
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user