I have an image that is (just for example, can be any size):
599 original width
599 original height
and a destination aspect ratio for example (can be any):
1:2
I want to scale down the image and make it exactly the aspect ratio, a simple multiplication gives only:
299.5 x 599
while I expect
299 x 598
How to get the expected result?
Sorry for my bad English, I find it hard for me to describe a mathematics question well.
You don't say what the class of problems you are working on, but one approach is to divide $599$ by $2$ and round down because you can't have fractional pixels. That gives the new dimension in that direction as $299$. Then multiply that by $2$ to get the size in the other direction, giving $598$. This gives the largest rectangle of proportion $1:2$ that fits in $599 \times 599$