image-resize-if-needed

main
Kar 2025-04-24 14:14:26 +00:00
commit a414640f0b
1 changed files with 12 additions and 0 deletions

12
image-resize-if-needed.sh Normal file
View File

@ -0,0 +1,12 @@
#!/bin/bash
#apt install imagemagick
#brew install imagemagick
for img in "$@"; do
width=$(identify -format "%w" "$img")
if (( width > 800 )); then
echo "Resizing: $img ($width px wide)"
convert "$img" -resize 800x "$img"
else
echo "Skipping: $img (already $width px wide or smaller)"
fi
done