Want to resize multiple images at once with ImageMagic

Asked 2 years ago, Updated 2 years ago, 102 views

There is a serial number image in the folder as shown below.

myimg_01.png
myimg_02.png
...
myimg_28.png

I would like to convert these to 168px altogether using ImageMagic.I want to reduce the width while keeping the aspect ratio.

I would like to overwrite the converted results in each file or save them in the output destination folder with the same name (I don't want to rename them later).

What kind of command would it be?

imagemagick

2022-09-30 19:33

2 Answers

Self-resolved.

mogrify-resize x168*.png

↑ Resize all PNG images in the current directory to 168px height.Modify the original file.

Note: http://www.imagemagick.org/script/mogrify.php


2022-09-30 19:33

It looks like it has already been resolved, but if you want to save it to a file with the same name in the output directory, use the -path option.

$mogrify-path output_dir-resize x168*.png

Naturally, output_dir must exist as a directory and be writable.


2022-09-30 19:33

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.