Resizing Different Size Images to the SAME Size
Show older comments
Hi all,
I would like to change several different size images to make them the same exact size. However, when I simply resize them, some of them look distorted, as they get stretched or compressed to fit into that size.
How do I resize multiple pictures and make them the same exact specified size while maintaining each picture's proportion?
Thanks so much!
6 Comments
Matt Kindig
on 12 Oct 2012
Edited: Matt Kindig
on 12 Oct 2012
If the original pictures don't have the same aspect ratio as the target image size, then they will be distorted when resizing--there really isn't any way around this.
Walter Roberson
on 13 Oct 2012
Unless padding is added so that a portion of the resized picture ends up being solid black (or whatever)
Image Analyst
on 13 Oct 2012
Edited: Image Analyst
on 13 Oct 2012
And, just to round out the comments: http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F And, you can use imresize(). Also, what size do you want them? As big as the biggest image height or width? As big as the smallest image? Some fixed size? Or something else?
Steven
on 13 Oct 2012
Walter Roberson
on 13 Oct 2012
Not if any of them are different aspect ratios from the other, not unless you are willing to lose part of the picture.
For example, suppose one image was 800 x 400, and another image was 400 x 250. You can expand the second image to 800 high with no distortion by doubling in both dimensions, but that would get you 800 x 500 rather than 800 x 400 like the first image is. You could throw away 100 after the expansion to 800 x 500, but that would lose information. If you were to resize the 800 x 500 to be 800 x 400 without cutting out any information and without adding padding, then objects would end up scaled to 4/5 of their original width, which would (for example) squash circles into ellipses.
Steven
on 13 Oct 2012
Answers (0)
Categories
Find more on Read, Write, and Modify Image in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!