Skip to content

Instantly share code, notes, and snippets.

@hscstudio
Created April 27, 2020 12:07
Show Gist options
  • Save hscstudio/be92d6773a89a466d437f328d635f50f to your computer and use it in GitHub Desktop.
Save hscstudio/be92d6773a89a466d437f328d635f50f to your computer and use it in GitHub Desktop.
Batch Resize Image Imagick
find . \( -iname "*.jpg" -o -iname "*.png" \) -print0 | \
while read -d $'\0' -r image; do
convert $image -resize '500>' $image;
read w h < <(sips -g pixelWidth -g pixelHeight "$image" | \
awk '/Width:/{w=$2} /Height:/{h=$2} END{print w " " h}')
echo $image $w $h
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment