Skip to main content

Process images in batch

Imagemagick comes with a command-line tool called morgrify. It can process images in batch. Here are some examples of converting formats and resizing images.

Installation:

brew install imagemagick

Convert from JPEG to WEBP format:

mogrify -format webp -quality 80 *.jpeg

Keep aspect ratio but max (width or height) pixel 1920.

mogrify -format webp -quality 80 -resize '1920x1920>' *.jpg

For photography:

mogrify -format webp -strip -quality 75 -resize '800x800>' *.jpeg

For blog:

mogrify -format webp -strip -quality 75 -resize '1024x1024>' *.png

For scanned artwork:

mogrify -format webp -strip -quality 75 -resize '1680x1680>' *.jpeg

For HEIC phots taken on iPhone:

mogrify -format jpeg -auto-orient -strip -quality 75 -resize '1320x1320>' *.HEIC