So we ran into this issue yesterday where we had 5000+ images each in different height / width and we wanted to remove the white-space around the objects in the picture and then crop – resize them to exact dimensions. All in Bulk process.
Photoshop Actions didn’t work well for this and editing them one by one was not even considered as an option.
I’ve chosen ImageMagick for this because… why not? It’s so powerful and can get things done in seconds.
Assume all your images are in the same directory and extension is “.png”.. Fire up the Terminal and execute the below command. This will trim the whitespace around image.
mogrify *.png -flatten -fuzz 1% -trim +repage *
And then this.. This command will first resize/crop to 350x350px and pad the image to center with a 50px spacing around specified in -extent attribute by 400×400.
mogrify *.png -resize 350x350 -background white -gravity center -extent 400x400 *
All 5000+ images are perfectly aligned to center and cropped – resized like this.
Read more about ImageMagick usage: http://www.imagemagick.org/Usage/resize/