aspect ratio calc function
This commit is contained in:
@@ -605,6 +605,22 @@ GetDateOrdinalSuffix(D) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
; Calculate the aspect ratio of a video/image using the width + height
|
||||||
|
getAspectRatio(width, height) {
|
||||||
|
gcd := gcdFunc(width, height)
|
||||||
|
return round(width/gcd) ":" round(height/gcd)
|
||||||
|
}
|
||||||
|
|
||||||
|
; The gcdFunc() is a helper function that calculates the GCD (greatest common divisor) of two numbers using the Euclidean algorithm.
|
||||||
|
; Used for calculating aspect ratio of Videos
|
||||||
|
gcdFunc(a, b) {
|
||||||
|
while b
|
||||||
|
t := b, b := Mod(a, b), a := t
|
||||||
|
return a
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; OnMsgbox - Custom Msgbox Screens
|
; OnMsgbox - Custom Msgbox Screens
|
||||||
|
|||||||
Reference in New Issue
Block a user