This is a really a logic or maths problem, but I can't get my head around it. Maybe someone can help me.
I have written a small app which resamples an image if the width is greater than 640 pixels or the height is greater than 480 pixels.
My problem is I want to maintain the aspect ratio (the ratio between the width and the height), and find the maximum it can fit within 640 x 480 (for display on TV),
e.g. width = 200, height = 900
-> Given that the max width is 640 and the max height = 480, what is the maximum width/height that can fit in the boundaries of 640x480?
Can you see my problem here? If I get a standard size image (e.g. 800x600) and resize it, it will be fine. If I get an image which is 200 x 900 and resample it to 640x480, the images is stretched.
Any ideas appreciated. This is really simple, I have just hit a mental block!
------------------------------------
There's no place like 127.0.0.1
------------------------------------
I have written a small app which resamples an image if the width is greater than 640 pixels or the height is greater than 480 pixels.
My problem is I want to maintain the aspect ratio (the ratio between the width and the height), and find the maximum it can fit within 640 x 480 (for display on TV),
e.g. width = 200, height = 900
-> Given that the max width is 640 and the max height = 480, what is the maximum width/height that can fit in the boundaries of 640x480?
Can you see my problem here? If I get a standard size image (e.g. 800x600) and resize it, it will be fine. If I get an image which is 200 x 900 and resample it to 640x480, the images is stretched.
Any ideas appreciated. This is really simple, I have just hit a mental block!
------------------------------------
There's no place like 127.0.0.1
------------------------------------