How can you resize the image without deforming the image?
Show older comments
Can you please provide a code to resize an image without making it look different. Example I have a 2000 x 1500 pixel image size. I want the image to fit in an 1024 x 1024 size without reshaping it.
1 Comment
John D'Errico
on 26 Dec 2017
Sorry. You cannot "resize" an image to a different shape without changing the shape. Why does that seem a truism to me? Code cannot do magic. No matter what you do, you will lose some portion of the image, or you will need to fill the image out to the new boundary with your choice of fill pixels.
Nothing stops you from arbitrarily resizing the image while also doing a crop. So resize it first to be too large, then crop away what you don't want. WTP? Or, just interpolate the image on a restricted set of points, so the result has the shape that you want, sampled from the desired area. Again, WTP? Or interpolate the image to the smaller size, but using 0 or 1, or NaN in the regions that would be extrapolated. Again, WTP? Why not make an effort, then show what you tried if it does not work, and ask for help?
Accepted Answer
More Answers (0)
Categories
Find more on Image Processing Toolbox 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!
