Resize and Crop All Files to Fixed Size with Imagemagick Convert

Here’s the imagemagick command (in a loop in a Windwos batch file) for doing this to all files:

  • resize to fixed size 100×100, with each dimension being at least 100 (regardless of the aspect ratio, but preserving it)
  • crop the part of the image that exceeds 100×100
for %%f in (*.png) do ( convert %%f -resize "100x100^" -gravity center -crop 100x100+0+0 +repage %%f )
This entry was posted in Software. Bookmark the permalink.