Skip to content

Instantly share code, notes, and snippets.

@kipal
Last active March 15, 2022 14:16
Show Gist options
  • Save kipal/1bc6caabf14549a75c82bf72abd91b7b to your computer and use it in GitHub Desktop.
Save kipal/1bc6caabf14549a75c82bf72abd91b7b to your computer and use it in GitHub Desktop.
Resize a batch of images with ImageMagick without exceeding any resource limits

Example:

State of the current directory:

  $ ls
  a.jpg b.jpg c.jpg c.png

The execution:

   $ convert '*.jpg[200x]' resized%03d.png

New state of the current directory:

   $ ls
   a.jpg b.jpg c.jpg c.png resized000.png resized001.png resized002.png

Where:

*.jpg is the glob to match certain files [200x] is the instruction for the new width resized is the prefix for the new files %03d is the fixed 3 character long ordinal number

Original post on askubuntu.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment