In case you are wondering, the formula to calculate the new height of an image based on the existing aspect ratio is height / width * new width.
hmm, I dont understand what they say at the end of the ghacks article ^
I think this below is fairly obvious - and doing something different to the above (?).
If I want to, say, crop one side of the image to make it fit the nearest ratio, using one of the examples from the OP:
|Width: 3,000 [A] Height: 1993 |
to crop the height (to get 3:2 ratio), I'd divide B by 2; then multiply by 3 to get the correct pixel height (new value for A).
1993/2 = 996.5
996.5*3 = 2989.5 (new height/new value for A)