There are only a few standard ratios: 4:3 , 5:4 , 16:10 , 16:9 . GCD is a good idea, but it will fail, at least in terms of 16:10 and 1366x768 .
A pure GCD algorithm will get 683:384 for 1366x768, because 683 is simple and the resolution is almost 16: 9 (16.0078125).
I believe that for real tasks it is necessary to implement a rather complicated algorithm:
First try out the known proportions (find them on wikipedia ), making some mistakes and only then use the GCD as a backup.
Do not forget about 32:10 ; -)
kirilloid
source share