Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Batch convert images without using a 'for' loop

To batch convert images, I use a for loop:

for f in *.(jpg|png); do magick $f -resize 64x64\> output-folder/$f; done

note I use Zsh. If you use Bash, you need *.{jpg,png} and not *.(jpg|png)

But maybe there is a simpler way, provided either by ImageMagick or by a shell itself? Something like this:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

# Doesn't work
magick *.{jpg,png} -resize 64x64\> output-folder/

>Solution :

With mogrify, like this:

mkdir OUTPUT
magick mogrify -path OUTPUT -resize 64x64\> *.jpg *.png
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading