i need logic re-size image 320x240 or smaller , should maintain aspect ratio.
1) determine side of image larger 1 2) if width, calc: faktor = 320/width, else faktor = 240/height; 3) downscale image size.x *faktor, size.y *faktor.
example:
given: image has 1024x640
1) wider high. 2) faktor = 320 / 1024 -> 0.3125 3) 1024 * 0.3125 = 320 (huh!) 640 * 0.3125 = 200.
Comments
Post a Comment