I have a bunch of high-resolution images from Unsplash and,
How do I do this using Imagemagick
on a Mac?
I think this will do what you need for a single image:
magick INPUT.JPG -gravity center -extent 16:9 -resize 2560x1440 RESULT.JPG
If you want to do lots, you could use a bash
loop:
for f in *.jpg *.png ; do
magick "$f" -gravity center -extent 16:9 -resize 2560x1440 "$f"
done
If you have thousands, you could use homebrew to install GNU Parallel with:
brew install parallel
Then get them done in parallel using all your CPU cores with:
parallel --bar magick {} -gravity center -extent 16:9 -resize 2560x1440 {} ::: *.jpg *.png
If you have hundreds of thousands, or millions, that will overflow the ARG_MAX, so you will need to feed the filenames on stdin
like this:
find . -iname \*.png -print0 | parallel -0 magick {} -gravity center -extent 16:9 -resize 2560x1440 {}