Add some status and safety checks

This commit is contained in:
2025-11-27 03:21:45 +00:00
parent 52572ef7ee
commit dba00da901
2 changed files with 25 additions and 3 deletions
+11 -3
View File
@@ -8,7 +8,15 @@
echo "Resizing large JPGs in $(pwd)"
find . -regextype posix-egrep -regex ".*\.(jpg|JPG|JPEG|jpeg)$" -print0 | while IFS= read -r -d '' f
#echo "Resizing $(f)"
#do mogrify -resize 2800000@@\> -sampling-factor 4:2:0 -strip -quality 85% -colorspace RGB $f
do ~/Applications/magick "$f" -resize 8000000@@\> -sampling-factor 4:2:0 -strip -quality 85% "$f"
do
# Get file size before resizing
SIZE_BEFORE=$(stat -f%z "$f" 2>/dev/null || stat -c%s "$f" 2>/dev/null)
~/Applications/magick "$f" -resize 8000000@@\> -sampling-factor 4:2:0 -strip -quality 85% "$f"
# Get file size after resizing
SIZE_AFTER=$(stat -f%z "$f" 2>/dev/null || stat -c%s "$f" 2>/dev/null)
# Display before/after sizes
echo "Resized $f: $(numfmt --to=iec-i --suffix=B $SIZE_BEFORE) -> $(numfmt --to=iec-i --suffix=B $SIZE_AFTER)"
done