A Windows XP help forum. PCbanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » PCbanter forum » Windows 10 » Windows 10 Help Forum
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Calculating the aspect ratio



 
 
Thread Tools Rate Thread Display Modes
  #46  
Old June 7th 19, 07:51 PM posted to alt.comp.os.windows-10
Ken Springer[_2_]
external usenet poster
 
Posts: 3,817
Default Calculating the aspect ratio

On 6/7/19 11:54 AM, Paul wrote:
Ken Springer wrote:
On 6/7/19 10:43 AM, Mayayana wrote:
"Ken Springer" wrote

| https://eikhart.com/blog/aspect-ratio-calculator
|
| Note that the Math object is inherent to JS, so
| I'm not sure there's any universal formula there.
|
| Doesn't the math have to be built in somewhere?
|
Yes, but it's built into the javascript engine. It's a
native object. Similarly, so many webmasters now
ass jquery to their page that jquery methods also
become native. That can make it more difficult to
figure out what code is doing.

| I'd pick on his explanation in one spot, but it's no biggie.
|
I downloaded the page but it doesn't work for me.
From the code it looks like he's settling for ratios
that are not whole numbers. In other words, 2.133333:1
rather than 32:15. The former method only requires
simple division.


And 32:15 is the answer I'm looking for from any formula. No extra
steps to get that as Good Guy and nospam are suggesting.


You'd be surprised where the computing is done.

A good webpage makes *your* computer do the calculatin,
using Javascript. I didn't realize this until much later,
on the "jsbeautifier" site. I thought at first, when I
pasted text into it to compute, the server was doing it.
But then I noticed "hey, there's no uploading going on",
and then a lightbulb clicked on. Instead, a mass of
Javascript code was being downloaded, and a js script
running on my own computer was doing the formatting.
Cool.


This actually doesn't surprise me, it makes perfect sense, IMO.

We've got this kind of power sitting on our desks, and so few people
realize it. :-(

--
Ken
MacOS 10.14.5
Firefox 67.0
Thunderbird 60.7
"My brain is like lightning, a quick flash
and it's gone!"
Ads
  #47  
Old June 7th 19, 07:54 PM posted to alt.comp.os.windows-10
Gene Wirchenko[_2_]
external usenet poster
 
Posts: 496
Default Calculating the aspect ratio

On Fri, 7 Jun 2019 09:15:20 -0600, Ken Springer
wrote:

[snip]

Correct, ratios and proportions are grade school math. But writing a
mathematical formula to do it with just inputting 2 variables,
apparently is not. G


It is not a formula. You solve it using Euclid's Algorithm which
calculates the Greatest Common Divisor of two numbers. Then, divide
each original value by the GCD to get the simplified ratio.

Sincerely,

Gene Wirchenko
  #48  
Old June 7th 19, 07:55 PM posted to alt.comp.os.windows-10
Ken Springer[_2_]
external usenet poster
 
Posts: 3,817
Default Calculating the aspect ratio

On 6/7/19 11:47 AM, Paul wrote:
Mayayana wrote:
"Ken Springer" wrote

|
| W1... Enter 1280
| H1... Enter 600
|
| How does he calculate the aspect ratio, just above the Example
| rectangle, to be 32:15? This is the math I don't remember. LOL
|

He's not doing that. But you can do it with division.
1280 / 600 = 2.13333333:1. You need whole numbers?
I don't know how to do that with a formula.

This is the simplest I came up with, using VBScript. It first
calculates the fraction. Then it multiplies that by numbers until
it finds a whole number. In this case it's 2.1333333333333
and the first multiplier that will yield a whole number is 15.
That yields 32. The aspect ratio, expressed in the lowest
possible integer pair, is then that number with the multiplier:
32:15.

MsgBox AspectRatio(1280, 600)

Function AspectRatio(a, b)
Dim i, i2, x, a1, b1
x = a / b
For i = 1 to 100
If (x * i) - CLng(x * i) = 0 Then
i2 = i
Exit For
End If
Next
a1 = x * i2
b1 = i2
AspectRatio = a1 & ":" & b1
End Function


OK. We've gone wa-a-a-a-a-a-a-ay over my head now! LOL


--
Ken
MacOS 10.14.5
Firefox 67.0
Thunderbird 60.7
"My brain is like lightning, a quick flash
and it's gone!"
  #49  
Old June 7th 19, 07:56 PM posted to alt.comp.os.windows-10
nospam
external usenet poster
 
Posts: 4,718
Default Calculating the aspect ratio

In article , Ken Blake
wrote:

true. algebra is taught in middle school.


Not necessarily. It will depend on the individual school district, and
what constitutes "middle school".

For me, the phrase "middle school" didn't exist.



Nor for me. Back in my day, there was Jr High School.


I don't know why
people had to change the name. LOL



Presumably because Jr High School and Middle School are not the same.
Jr High School was grades 7, 8, and 9, and Middle School is grades 6,
7, and 8.

At least that's my experience with those names. I suppose it's
possible that their meaning may vary in some locations.


it's more than just which grades
  #50  
Old June 7th 19, 08:29 PM posted to alt.comp.os.windows-10
Ken Springer[_2_]
external usenet poster
 
Posts: 3,817
Default Calculating the aspect ratio

On 6/7/19 12:54 PM, Gene Wirchenko wrote:
On Fri, 7 Jun 2019 09:15:20 -0600, Ken Springer
wrote:

[snip]

Correct, ratios and proportions are grade school math. But writing a
mathematical formula to do it with just inputting 2 variables,
apparently is not. G


It is not a formula. You solve it using Euclid's Algorithm which
calculates the Greatest Common Divisor of two numbers. Then, divide
each original value by the GCD to get the simplified ratio.


Do you think that's how Mr. Hedges is doing it on his website?


--
Ken
MacOS 10.14.5
Firefox 67.0
Thunderbird 60.7
"My brain is like lightning, a quick flash
and it's gone!"
  #51  
Old June 7th 19, 08:38 PM posted to alt.comp.os.windows-10
Paul[_32_]
external usenet poster
 
Posts: 11,873
Default Calculating the aspect ratio

Ken Springer wrote:
On 6/7/19 10:45 AM, Good Guy wrote:
On 07/06/2019 17:10, Ken Springer wrote:

Not necessarily. It will depend on the individual school district,
and what constitutes "middle school".


We learned algebra in primary school except that instead of using x
and y as variables, our teacher used boxes that we were required to
fill to make a sum. The sum could be a simple addition or subtraction
or multiplication or division. We were required to think what number
goes in the box to make the equation/sum balance. IOW find the missing
number!!!


I'd call that addition, not algebra. G



For me, the phrase "middle school" didn't exist. I don't know why
people had to change the name. LOL


We just called it "primary school", "secondary school" and "high school".


Or, elementary school, junior high school, and high school.



Ours had dual labeling.

Primary
Elementary Grade 1 thru Grade 6
Junior High Grade 7 thru Grade 9
Senior High Grade 10 thru Grade 12

Some areas of the country have a Grade 13 (not sure
what's up with that, and what's missing).

The serious coloring, with the big crayons,
happens in Senior High.

And if you're in a rural area, some have
multiple grades in the same room.

And at one time, you didn't even need a teaching
degree, to teach. That came later.

Paul
  #52  
Old June 7th 19, 08:40 PM posted to alt.comp.os.windows-10
Ken Springer[_2_]
external usenet poster
 
Posts: 3,817
Default Calculating the aspect ratio

On 6/6/19 3:25 PM, Ken Springer wrote:
Does anyone know the underlying mathematical formula used in this webpage?

https://andrew.hedges.name/experiments/aspect_ratio/

I'm afraid my algebraic skills have dwindled to almost nil in the 65
years since high school algebra! LOL


OK, this is a new subthread, I don't want to derail any of the others.

It has been completely unintentional, but this problem has turned into
an interesting observation of reading comprehension, and people's
tendency to follow the thought processes of those before them.

I thought, for a moment, that nospam and Ammammata were going to head
off in the right direction. That direction is...

To ask me why I need the formula! LOL

Everyone assumed I wanted to do something with a photo. I suspect that
is a result of the aspect ration calculation pages I looked at all used
photos as an example in one way or another. But that's not the purpose.

And, I didn't say a darned thing about photos! VBG

And, by golly, before I could get this posted, it looks like Char
Jackson has the answer!

I'm looking at the aspect ratios of various screen resolutions. So far
I've located 48. If you want to see a couple oddball resolutions,
replace your monitor's driver with MS's Generic PNP Monitor driver. I
don't think all of the resolutions are for monitors, new or old, but I
don't know that either.

As we all get older, most of us begin having visual issues. :-( I'm
looking for a solution to help that without having to install any
additional software or purchase additional hardware.

I need the formula so I can plug it into a cell in a spreadsheet.
Scripts and such isn't the answer, as the final spreadsheet file needs
to be generic enough to even work in Numbers on a Mac.

Although, it doesn't need to work in VisiCalc. LOL

--
Ken
MacOS 10.14.5
Firefox 67.0
Thunderbird 60.7
"My brain is like lightning, a quick flash
and it's gone!"
  #53  
Old June 7th 19, 08:48 PM posted to alt.comp.os.windows-10
nospam
external usenet poster
 
Posts: 4,718
Default Calculating the aspect ratio

In article , Ken Springer
wrote:

I'm looking at the aspect ratios of various screen resolutions. So far
I've located 48. If you want to see a couple oddball resolutions,
replace your monitor's driver with MS's Generic PNP Monitor driver. I
don't think all of the resolutions are for monitors, new or old, but I
don't know that either.

As we all get older, most of us begin having visual issues. :-( I'm
looking for a solution to help that without having to install any
additional software or purchase additional hardware.

I need the formula so I can plug it into a cell in a spreadsheet.
Scripts and such isn't the answer, as the final spreadsheet file needs
to be generic enough to even work in Numbers on a Mac.


why?

pick the highest resolution that is comfortable for your eyesight and
ignore the rest.

photos will normally be scaled to fit, no matter which one you choose,
and can be zoomed to full resolution if desired.
  #54  
Old June 7th 19, 09:00 PM posted to alt.comp.os.windows-10
Mayayana
external usenet poster
 
Posts: 6,438
Default Calculating the aspect ratio

"Ken Springer" wrote

| That's exactly the type of answer I'm looking for. But a VBScript is
| not likely to work for the finished product. Ergo, a mathematical
formula.
|

The finished product being....? A pentadigit computer
holding a #2 pencil? Do you expect to be spening a lot of
time in the woods calculating dimensions?



  #55  
Old June 7th 19, 09:03 PM posted to alt.comp.os.windows-10
Ken Springer[_2_]
external usenet poster
 
Posts: 3,817
Default Calculating the aspect ratio

On 6/7/19 12:45 PM, Char Jackson wrote:
On Fri, 7 Jun 2019 10:48:21 -0600, Ken Springer
wrote:

On 6/7/19 10:43 AM, Mayayana wrote:
"Ken Springer" wrote

| https://eikhart.com/blog/aspect-ratio-calculator
|
| Note that the Math object is inherent to JS, so
| I'm not sure there's any universal formula there.
|
| Doesn't the math have to be built in somewhere?
|
Yes, but it's built into the javascript engine. It's a
native object. Similarly, so many webmasters now
ass jquery to their page that jquery methods also
become native. That can make it more difficult to
figure out what code is doing.

| I'd pick on his explanation in one spot, but it's no biggie.
|
I downloaded the page but it doesn't work for me.
From the code it looks like he's settling for ratios
that are not whole numbers. In other words, 2.133333:1
rather than 32:15. The former method only requires
simple division.


And 32:15 is the answer I'm looking for from any formula. No extra
steps to get that as Good Guy and nospam are suggesting.


If you have Excel, you can use something like this:

=$D1/GCD($D1,$D2) & ":" & $D2/GCD($D1,$D2)

The two values that you're checking go into cells D1 and D2 in the above
formula, but of course you can put them anywhere and just update the
formula. The formula itself can go anywhere you like, into any empty
cell.

You can add conditionals for various things, such as cases where it
spits out an aspect ratio of 8:5 when you were expecting 16:10.


By golly, Char, I think you've got it!!!! I don't have Excel, too rich
for my blood these days. Also, bloated for what I need a spreadsheet
for. But I understand exactly what your doing now that I know about the
GCD function.

I'll be playing with this later. Right now, I've a new monitor to
unpack!!!!!! VBG



--
Ken
MacOS 10.14.5
Firefox 67.0
Thunderbird 60.7
"My brain is like lightning, a quick flash
and it's gone!"
  #56  
Old June 7th 19, 09:13 PM posted to alt.comp.os.windows-10
Mayayana
external usenet poster
 
Posts: 6,438
Default Calculating the aspect ratio

"Ken Springer" wrote


| Everyone assumed I wanted to do something with a photo.

I assumed you wanted a method to apply an unknown number
of times. It doesn't matter why.

| I'm looking at the aspect ratios of various screen resolutions. So far
| I've located 48. If you want to see a couple oddball resolutions,
| replace your monitor's driver with MS's Generic PNP Monitor driver. I
| don't think all of the resolutions are for monitors, new or old, but I
| don't know that either.
|
I've dealt with that on my system. It didn't seem that there
were so many variations that you really need a formula. My
own monitor is 16:10. I just divide the width by 16 then multiply
by 9 to see if I have a match. It's not hard to guess which ones
might match, anyway. And my solar-powered calculator that
I bought for $10 in 1985 at CVS does the rest. But as it
turns out, the best resolution I can get for my needs is
16:9. So I have a black stripe down each side of the monitor.


  #57  
Old June 7th 19, 09:16 PM posted to alt.comp.os.windows-10
Paul[_32_]
external usenet poster
 
Posts: 11,873
Default Calculating the aspect ratio

Ken Springer wrote:
On 6/6/19 3:25 PM, Ken Springer wrote:
Does anyone know the underlying mathematical formula used in this
webpage?

https://andrew.hedges.name/experiments/aspect_ratio/

I'm afraid my algebraic skills have dwindled to almost nil in the 65
years since high school algebra! LOL


OK, this is a new subthread, I don't want to derail any of the others.

It has been completely unintentional, but this problem has turned into
an interesting observation of reading comprehension, and people's
tendency to follow the thought processes of those before them.

I thought, for a moment, that nospam and Ammammata were going to head
off in the right direction. That direction is...

To ask me why I need the formula! LOL

Everyone assumed I wanted to do something with a photo. I suspect that
is a result of the aspect ration calculation pages I looked at all used
photos as an example in one way or another. But that's not the purpose.

And, I didn't say a darned thing about photos! VBG

And, by golly, before I could get this posted, it looks like Char
Jackson has the answer!

I'm looking at the aspect ratios of various screen resolutions. So far
I've located 48. If you want to see a couple oddball resolutions,
replace your monitor's driver with MS's Generic PNP Monitor driver. I
don't think all of the resolutions are for monitors, new or old, but I
don't know that either.

As we all get older, most of us begin having visual issues. :-( I'm
looking for a solution to help that without having to install any
additional software or purchase additional hardware.

I need the formula so I can plug it into a cell in a spreadsheet.
Scripts and such isn't the answer, as the final spreadsheet file needs
to be generic enough to even work in Numbers on a Mac.

Although, it doesn't need to work in VisiCalc. LOL


OK, give us an example test case with numbers, as to
how you would go about doing this.

LCDs work best at native resolution. I would not be
thinking about "aspect ratio" with an LCD monitor, because
good options are pretty limited. You can change the OS
"Percentage scale" option to affect font choices, to
improve things if your vision is slipping. That doesn't
require maths, just a mouse.

Pan mode has been broken by WDDM "improvements'. So it
can't be that. It might work with XDDM.

What else is there ?

Why do you think we went looking for Image aspect ratio
as a first guess ? Because aspect ratio doesn't do you
a darn bit of good.

You preserve aspect ratio choices on a CRT (which can
handle multiple resolutions without looking crappy),
in order to keep circles looking like circles (rather than
ellipses). So that's the reason there. You can hardly
"hammer" a CRT and perform miracles. Reducing the
resolution too much, causes the user to use the
scroll bars too much, when doing MSWord. That would
not exactly be satisfactory.

So give us a worked example, of how knowing an aspect
ratio, will improve your life.

Paul
  #58  
Old June 7th 19, 09:21 PM posted to alt.comp.os.windows-10
nospam
external usenet poster
 
Posts: 4,718
Default Calculating the aspect ratio

In article , Paul
wrote:

LCDs work best at native resolution.


that does not apply when the pixel size is smaller than what the eye
can resolve, as it is with hi-dpi displays.

I would not be
thinking about "aspect ratio" with an LCD monitor, because
good options are pretty limited.


different aspect ratios means either letterboxing, stretching one
dimension to fit or clipping, none of which look good.
  #59  
Old June 7th 19, 10:10 PM posted to alt.comp.os.windows-10
Ken Springer[_2_]
external usenet poster
 
Posts: 3,817
Default Calculating the aspect ratio

On 6/7/19 1:38 PM, Paul wrote:
And if you're in a rural area, some have
multiple grades in the same room.


I did 5th and 6th grades in the same room, with the same teacher. And
1st through 12th grades were in the same building.

And at one time, you didn't even need a teaching
degree, to teach. That came later.


That would be my mother. :-)


--
Ken
MacOS 10.14.5
Firefox 67.0
Thunderbird 60.7
"My brain is like lightning, a quick flash
and it's gone!"
  #60  
Old June 7th 19, 10:11 PM posted to alt.comp.os.windows-10
Ken Springer[_2_]
external usenet poster
 
Posts: 3,817
Default Calculating the aspect ratio

On 6/7/19 2:00 PM, Mayayana wrote:
"Ken Springer" wrote

| That's exactly the type of answer I'm looking for. But a VBScript is
| not likely to work for the finished product. Ergo, a mathematical
formula.
|

The finished product being....? A pentadigit computer
holding a #2 pencil? Do you expect to be spening a lot of
time in the woods calculating dimensions?


Teaching basic math to my cats! LOL


--
Ken
MacOS 10.14.5
Firefox 67.0
Thunderbird 60.7
"My brain is like lightning, a quick flash
and it's gone!"
 




Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off






All times are GMT +1. The time now is 01:02 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 PCbanter.
The comments are property of their posters.