Lets say I have a non-square image..
If I increment the width and I recalculate the height according to the incremented width (ratio), sometimes I get xxx.5 (decimals) for the width
ex.: width = 4, height = 2
I augment the width with a factor of 1.25 I’ll get : width = 5
Next, the height will be : heigth = 2.5
How can I determine the nearest image format that would have integers on both sides? (bigger if possible)
Thanks
reduce the fraction to lowest terms and then multiply by integers. You reduce
a/bto lowest terms by dividing each by their common gcd. Ifd = gcd(a,b), then(a/d) / (b/d)is in lowest terms. Now, if you want the next largest integer fraction with the same ration, then multiple the numerator and denominator byd+1. Thus,(d+1) * (a/d)is the numerator and(d+1) * (b/d)is the denominator.