I have an image with width 4096 and height 2896. I would like to scale the image to below 4000 pixels wide - and as close to 4000 as possible. I would also like to keep the dimensions whole numbers.
Is there an equation to do this?
Thanks
More Details
Clarification: I do not care if I divide by a rational number.
Reason: I am doing this due to a software limitation. The software that we make the image with can not have a width or height 4000px or more. But the size I want is 4096. To try and make the final image as crisp as possible, I reasoned that you should not have any rounding.
You can't keep it close $4000$. We have $4096 = 2^{12}$, $2896 = 2^4 \times 181$, i.e. the gcd of width, height is $2^4.$ If I understand you correctly, the scaling factors are $2, 4, 8,$ and $16$.
Can't you just scale it by .9 or something, and then round numbers up or down?