Batch resize JPEG images with maximum resolution and size

Mon 01 August 2016

Just discovered a quick and dirty way to resize a bunch of jpeg files to a maximum resolution and size:

mogrify -resize 1024x1024 -strip -define jpeg:extent=200kb *.jpg

This command will resize all jpg images in the current directory with a maximum resolution of 1024px for each side (maintaining aspect ratio) and a maximum size of 200kb. This will also strip all metadata from the jpg files.