Resize images in bulk with ImageMagick

Shrink a folder of photos for the web in one command.

SNP 138 #13B Filed imagemagick cmd

shell
mkdir -p web
magick mogrify -path web -resize '1600x1600>' -quality 82 -strip *.jpg
  • '1600x1600>' fits inside 1600 px on the long side and only shrinks, never enlarges (that's what the > does; the quotes stop the shell from reading it as a redirect)
  • -quality 82 is plenty for photos
  • -strip drops the EXIF data, including GPS coordinates you may not want to publish
  • -path web writes to a folder instead of overwriting the originals

Convert to WebP while you're at it:

shell
magick mogrify -path web -format webp -resize '1600x1600>' -quality 80 *.jpg

On ImageMagick 6 drop the magick prefix. For pixel art, use -filter point instead.