

''' That is, the largest positive value that divides each of the given values.

''' Gets the Greatest Common Divisor (GCD) of one or more values. Return New Point((resolution.Width \ gcd), (resolution.Height \ gcd)) Read the about page for more information. Click on a result to see an example ratio and click on the example to see it in full-scale.

Fill in the resolution you have and it will show all the scales that won't result in half pixels in a list. Public Shared Function GetAspectRatio(resolution As Size) As Pointĭim gcd As Integer = GetGreatestCommonDivisor(resolution.Width, resolution.Height) due to embedded audio, differing frame sizes and aspect ratios, and inter-frame compression / pulldown. Resolution scale calculatorCalculate resolution downscaling options for video editing. The sensor of 640X480 will be not sufficient. The resolution scale calculator helps you measure your digital resolutions up-scaled or down-scaled values while maintaining the original aspect ratio. ''' The resulting aspect ratio, expressed as X:Y. A sensor resolution of 1024X768 or 1280X1024 would be more appropriate in this case. Here is my current code: ''' Calculate the aspect ratio of the source resolution.
#640X480 ASPECT RATIO CALCULATOR HOW TO#
However, having a table of "known display aspect ratios" as suggested in that thread I'm not sure if it is a viable solution, and I'm not sure how to apply that to the calculation. The two most common aspect ratios for video are 4:3 (e.g. For a video that is 1920 pixels wide and 1080 pixels in height, the greatest common divisor is 120, resulting in an aspect ratio of 16:9. My question is: what I'm doing wrong in the calculation of the aspect ratio and how do I fix it?.ĮDIT: After researching a bit, I partially understood that the GCD approach is not viable for these kind of resolutions as mentioned here: You can calculate the ratio by dividing the width and height by the greatest common divisor of both. It fails for many other untypical resolutions.
#640X480 ASPECT RATIO CALCULATOR CODE#
Time ago I did a research trying to find a solution to calculate aspect ratio of a resolution, and this answer helped me to write the code below, which works fine for all common resolutions, but I just discovered that it fails to calculate the aspect ratio for many other resolutions, for example my code below will give a result value of "683:384" when trying to calculate the aspect ratio for "1366x768" resolution, which, according to Google results it is "almost" 16:9, so my calculation is wrong.
