Page 1 of 1

Reduces all images in many sub directories

Posted: 2019-02-09T06:03:38-07:00
by tom445
Hi,

Could someone help provide me the command to achieve the following in one script:

Resize images to a maximum of 1,000px in width (therefore keeping aspect ratio)
Resize images to a maximum of 1,000px in height (therefore keeping aspect ratio)
Convert from PNG to JPG
Look in all subdirectories

I basically have 3,500 images, 70% in PNG and 30% in JPG, and I want them to be a maximum of 1,000px either height or width, and they are to replace originals.

The command I've got so far is:
convert -size 1000x1000, but I don't know how to do the rest.


Thanks a lot.

Re: Reduces all images in many sub directories

Posted: 2019-02-09T07:20:12-07:00
by snibgo
What version of IM, on what platform?

Code: Select all

magick in.png -size 1000x1000 out.jpg
This reads one png file, resizes so the maximum dimension is 1000 pixels, and writes it as a jpg. It doesn't remove the png.

For the rest, I would use a script. Mogrify will do all the files in a single directory, but you need a script to process multiple directories.