Skip already-processed ZIPs by sampling first JPEG comment

Extracts one JPEG from each ZIP to check for the processing comment
before doing a full extract/resize/rezip cycle. Shared constants moved
to config.sh as single source of truth. Trap and cleanup extended to
cover the sample temp file.
This commit is contained in:
2026-07-03 19:32:04 -04:00
parent 2ed392d466
commit 6901c66bcf
3 changed files with 35 additions and 6 deletions
+3 -3
View File
@@ -5,10 +5,10 @@
#
# Usage: xxx.sh
echo "Resizing large JPGs in $(pwd)"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/config.sh"
MAX_PIXELS=8000000
MAGICK_COMMENT="magick:resize=8mp,quality=85,sampling=4:2:0"
echo "Resizing large JPGs in $(pwd)"
find . -regextype posix-egrep -regex ".*\.(jpg|JPG|JPEG|jpeg)$" -print0 | while IFS= read -r -d '' f
do