File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -98,16 +98,16 @@ process_images() {
9898 echo " DRY RUN: Would update markdown references"
9999 else
100100 # Set quality dynamically based on file size
101- if [ " $kbsize " -ge 15000 ]; then # ≥ 15MB
102- quality=50
103- elif [ " $kbsize " -ge 5000 ]; then # 5–15MB
104- quality=70
105- else # < 5MB
106- quality=85
101+ if [ " $kbsize " -ge 1500 ]; then # ≥ 150KB
102+ quality=80
103+ elif [ " $kbsize " -ge 500 ]; then # 500–1500KB
104+ quality=75
105+ else # < 500KB
106+ quality=95
107107 fi
108108 echo " Optimizing $img (${kbsize} KB, ${width} px), quality=$quality "
109109 # Resize and convert to WebP. If error occurs, capture it and exit.
110- error=$( magick " $img " -resize 1280x\> -quality $quality " $webp_img " 2>&1 )
110+ error=$( magick " $img " -resize 1280x\> -quality $quality -define webp:lossless=true " $webp_img " 2>&1 )
111111 convert_status=$?
112112 if [ $convert_status -ne 0 ]; then
113113 echo " ⚠️ Error converting $img to WebP format."
You can’t perform that action at this time.
0 commit comments