[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

BeeJ

3/29/2012 11:26:00 PM

I never said I was a mathematician.

PART 1
I want to present the Ratio of two numbers.
e.g. a screen resolution is 1920x1080
The ratio I would present is 16:9

But how do I calculate to get 16:9 ?
The only way I can figure to do this is to have a loop inside a loop
and keep incrementing by some small amount until the divisor comes out
within some tolerance of the desired value.

So for 1920x1080 = 17.7777777777778 is what I would be looking for.
Keep looping until maybe I get 17.77 and use the pairs that give me
that results.
Also need to watch which way I am going if the initial ratio is say
1080x1920.

Is there a more sophisticated way to get the answer x:y ?

Note that not all cases result in a integer value for the pair values.
So x.y:z or maybe x:y.z or even w.x:y.z is possible I think.

PART 2
What are standard ratios (if such a thing exists) for images other than
16:9 or 4:3 ?

--
Noah's Ark was built by amateurs,
The Titanic was built by professionals.
Row, row, row your boat gently down the stream ...
Life is but a dream!


348 Answers

Karl E. Peterson

3/29/2012 11:52:00 PM

0

on 3/29/2012, BeeJ supposed :
> PART 1
> I want to present the Ratio of two numbers.
> e.g. a screen resolution is 1920x1080
> The ratio I would present is 16:9
>
> But how do I calculate to get 16:9 ?

In middle school, they called this "reducing fractions." You know how
to google from there, right?

> PART 2
> What are standard ratios (if such a thing exists) for images other than
> 16:9 or 4:3 ?

My monitors are 16:10, but that's kinda geeky.

--
..NET: It's About Trust!
http://vfre...


JensB

3/29/2012 11:58:00 PM

0

BeeJ formulated the question :
> I never said I was a mathematician.
>
> PART 1
> I want to present the Ratio of two numbers.
> e.g. a screen resolution is 1920x1080
> The ratio I would present is 16:9
>
> But how do I calculate to get 16:9 ?
> The only way I can figure to do this is to have a loop inside a loop and keep
> incrementing by some small amount until the divisor comes out within some
> tolerance of the desired value.
>
> So for 1920x1080 = 17.7777777777778 is what I would be looking for.
> Keep looping until maybe I get 17.77 and use the pairs that give me that
> results.
> Also need to watch which way I am going if the initial ratio is say
> 1080x1920.
>
> Is there a more sophisticated way to get the answer x:y ?

1920 / 1080 = 1 rem 840
1080 / 840 = 1 rem 240
840 / 240 = 3 rem 120
240 / 120 = 2 with no remainder, therefore GCD = 120

1920 / 120 = 16, 1080 / 120 = 9

Your job to put it in a function

--
Michael Cole


mm

3/30/2012 1:14:00 AM

0


"BeeJ" <nospam@spamnot.com> escribió en el mensaje
news:jl2r2f$pl$1@speranza.aioe.org...

> PART 2
> What are standard ratios (if such a thing exists) for images other than
> 16:9 or 4:3 ?

5:4


BeeJ

3/30/2012 1:23:00 AM

0

How about?
Tested for 1920,1080 & 1080,1920 and 1080,1080 and various other
non-nice such as 1921,1080.
Seems to work.
Where did I screw up?

Public Function Ratio(l1 As Long, l2 As Long) As String

Dim ll1 As Long
Dim ll2 As Long
Dim lRem As Long
Dim lRemLast As Long

' for starters
ll1 = l1
ll2 = l2
lRem = ll1 Mod ll2
If lRem Then
Do

ll1 = ll2
ll2 = lRem
lRemLast = lRem
lRem = ll1 Mod ll2

Loop While lRem

End If

If lRemLast Then
Ratio = CStr(l1 / lRemLast) & ":" & CStr(l2 / lRemLast)
Else
Ratio = "1:1"
End If

End Function 'Ratio

--
Noah's Ark was built by amateurs,
The Titanic was built by professionals.
Row, row, row your boat gently down the stream ...
Life is but a dream!


BeeJ

3/30/2012 1:25:00 AM

0

Tried searching for "Calculate Ratio Pairs" and got a lot of links to
"Au Pair". Hmmm...

--
Noah's Ark was built by amateurs,
The Titanic was built by professionals.
Row, row, row your boat gently down the stream ...
Life is but a dream!


BeeJ

3/30/2012 1:30:00 AM

0

Eduardo formulated the question :
> "BeeJ" <nospam@spamnot.com> escribió en el mensaje
> news:jl2r2f$pl$1@speranza.aioe.org...
>
>> PART 2
>> What are standard ratios (if such a thing exists) for images other than
>> 16:9 or 4:3 ?
>
> 5:4

OK but not a natural ratio. 6:4 is.
5:4 is 10x8 or a cropped film size.
35mm is 3:2 or 6:4.
But I am using all of the above anyway.
Where did 5x7 come from?
I always used to print 8x12 from slides because I could not stand to
lose anything. I have a bunuch of Cibachrome 8x12 prints around that I
did at college years ago. Gone are the days ...

--
Noah's Ark was built by amateurs,
The Titanic was built by professionals.
Row, row, row your boat gently down the stream ...
Life is but a dream!


mm

3/30/2012 1:35:00 AM

0

"BeeJ" <nospam@spamnot.com> escribió en el mensaje
news:jl32an$ee6$1@speranza.aioe.org...
> Eduardo formulated the question :
>> "BeeJ" <nospam@spamnot.com> escribió en el mensaje
>> news:jl2r2f$pl$1@speranza.aioe.org...
>>
>>> PART 2
>>> What are standard ratios (if such a thing exists) for images other than
>>> 16:9 or 4:3 ?
>>
>> 5:4
>
> OK but not a natural ratio. 6:4 is.
> 5:4 is 10x8 or a cropped film size.

But also for many 1280x1024 monitors. Mine is 5:4 (Viewsonic).

> 35mm is 3:2 or 6:4.
> But I am using all of the above anyway.
> Where did 5x7 come from?
> I always used to print 8x12 from slides because I could not stand to lose
> anything. I have a bunuch of Cibachrome 8x12 prints around that I did at
> college years ago. Gone are the days ...

But you want aspect ratios for everything or just for computer monitors?


mm

3/30/2012 1:37:00 AM

0

> Noah's Ark was built by amateurs,

But it was designed by a Professional.

> The Titanic was built by professionals.
> Row, row, row your boat gently down the stream ...
> Life is but a dream!
>
>


Mayayana

3/30/2012 3:51:00 AM

0

| PART 2
| What are standard ratios (if such a thing exists) for images other than
| 16:9 or 4:3 ?
|

Are you talking images or monitors? As Karl said,
some monitors are 16:10. I think that was tried
briefly before 16:9 was settled on.

For photo printing the typical sizes are 4x6, 5x7, 8x10.


unknown

3/30/2012 7:58:00 AM

0

"BeeJ" <nospam@spamnot.com> wrote in message
news:jl2r2f$pl$1@speranza.aioe.org...
> Is there a more sophisticated way to get the answer x:y ?
>
> Note that not all cases result in a integer value for the pair values.
> So x.y:z or maybe x:y.z or even w.x:y.z is possible I think.

What if a user supplied you with a cropped image, like 100x1 pixels, and not
from a camera?

> PART 2
> What are standard ratios (if such a thing exists) for images other than
> 16:9 or 4:3 ?

Sort by SAR column:

http://en.wikipedia.org/wiki/List_of_common_r...