Skip to main content

Resize Multiple Images with ImageMagick

resize

Problem

Sometimes, we need to resize multiple images quickly with the same dimension like the same width or height. This method can quickly do that with an image tool ImageMagick.

Install ImageMagick

ImageMagick is a powerful image processing tool for command-line.

On Mac, install ImageMagick with brew.

brew install imagemagick

or if on Mac with M1/M2/M3 chips, following this guide:

arch -x86_64 brew install imagemagick

Prepare

Create a directory /xyzand put all the images there.

tip

Use the same naming convention for the image file names such as:

  • imagefile_001.png
  • imagefile_002.png

Resize

In the newly created directory /xyz, run this

mogrify -resize 1000 *.png

This sub-command mogrify from ImageMagick will set the width of all the .png image files in folder /xyz to be 1000px.

Or you can resize the images with the same height, for all the png and jpg files.

mogrify -resize x500 *.png *.jpg

This will set the height of all the .png AND .jpg image files to be 500px.

Reference


Like it? A donation or tip would go a long way.

  BTC  14DYUJw7SYszhDtn3UHhRwV9WpmGWeFAve
  ETH  0xCfB04B53C05488Ac0aC4F47C9550e8Ca1eaA476e
  ICP  d80bd36baca1a0166e812c0f669ffaa222a7c6b6f2a8e3f5c690bafe251aaf4b