Commit 6641e35
committed
Shrink large images to at most 1024x1024 pixels
Looks for files over 300k, with current height or width over 2000 pixels,
and resizes those to up to 1024x1024. Uses ImageMagick:
$ find . -type f -size +300k -exec file \{\} \;| awk -F: '{if ($2 ~/image/) print $1}'| while IFS= read -r file_path; do if (( $(identify -ping -format '%w' "$file_path") > 2000 )) || (( $(identify -ping -format '%h' "$file_path") > 2000 )); then identify -ping -format '%w %h %f' "$file_path";echo;mogrify -resize 1024x1024\> "$file_path";fi;done
(Should really ignore the SVG files)
Based on earlier suggestion by Bastian.1 parent 39ef69c commit 6641e35
28 files changed
File tree
- static/img
- 2025
- bosc2025-img
- 2026
Loading
Loading
Loading
Loading
Loading
0 commit comments