I have a problem that I don't seem to be able to solve... so I ask for your help! It is basically a math problem, not so much a python, but possibly there is an easy python solution.
My problem is the following: I have to know the scale factor appplied to an image with PIL im.thumbnail.
Let's say that I have an image 4822 x 3643 pixel and I want to scale it to 800 x 600 (maximum values)
If I run the following
I get an image with 794 x 600 pixel (which is OK, of course).
So the equations should be
I would expect that x and y are the same value (since I scale that image of ONE specific value, say 16%)... but this is not, because of the rounding for the pixel values.
x = 16.4661965989216092907507258399
y = 16.469942355201756793851221520725
How can I get the same value for x and y... whatever the input image size is?