Resize all images to the same dimension while preserving the aspect ratio
Posted: 2015-04-06T06:40:33-07:00
Hi all,
My questions is quite unusual but it's very important for me.
I have a bunch of files with one of the dimensions (either heigh or width) the same while the other is of very similar value to each other (e.g. all have heigh of 2576 and the width is sometimes 2800, sometimes 2822 etc.). The task would be to resize (in fact shrink using e.g. Only Shrink Larger Images ('>' flag)) all files to one dimension while preserving the aspect ratio. I am not sure, but it perhaps could be done by shrinking each image based on the largest fitting dimension. My second guess is to make each image same size by adding white boarders and then crop. What do you think?
Perhaps I am a bit closer to the solution. I checked this post: viewtopic.php?p=71482#p71482
and wrote a command
As far as I can tell, this command resizes (using white background) file in.jpg and saves it to out.jpg? Am I right?
My questions is quite unusual but it's very important for me.
I have a bunch of files with one of the dimensions (either heigh or width) the same while the other is of very similar value to each other (e.g. all have heigh of 2576 and the width is sometimes 2800, sometimes 2822 etc.). The task would be to resize (in fact shrink using e.g. Only Shrink Larger Images ('>' flag)) all files to one dimension while preserving the aspect ratio. I am not sure, but it perhaps could be done by shrinking each image based on the largest fitting dimension. My second guess is to make each image same size by adding white boarders and then crop. What do you think?
Perhaps I am a bit closer to the solution. I checked this post: viewtopic.php?p=71482#p71482
and wrote a command
Code: Select all
convert in.jpg -resize 4000x3000^ -gravity center -background white -extent 4000x3000 out.jpg