With my super short image re-sizing procedure in my last post, I wrote a class the abstract an image file into an object. Within it, is a function to scale the image. Then I ran into a problem:
Say we have a image that's 800 x 600, and I want to resize it to fit a 600 x 200 rectangle. By using my procedures, the code:
new Bitmap(img, new Size( 600, 200));
create a image that's 600x200 from the original image. Well... the problem is that the image scale is off.
If we are indeed resizing pictures to fit a predefined windows size of 800x600, or perhaps 400x300, with my old procedures, the result would have some photos being stretched. Who would want to actually view their photos like that?
So a different method is needed that would check the original picture size against the desired size, and attempt to fit the picture in it without changing the aspect ratio. Which should be rather simple to implement.
沒有留言:
張貼留言