0

I am somehow head blocked to figure this out but is there an easy mathematical way to determine the intrinsic ratio for a given image lets say e.g. w 580 h 650 to get to a ratio like 3/4, 4/3, 5/6, 16/9 etc pp. Best regard Ralf

rkoller
  • 1,424
  • 3
  • 26
  • 39
  • For what purpose would this be used? – cimmanon Feb 28 '14 at 01:01
  • I wanted to give Team Sass's Toolkit a spin to set the intrinsic ratio for sets of images to prevent reflowing. – rkoller Feb 28 '14 at 17:35
  • Not sure I understand. Are you using it for this technique: http://stackoverflow.com/questions/12121090/responsively-change-div-size-keeping-aspect-ratio ? – cimmanon Feb 28 '14 at 17:38
  • yep i want to calculate the ratio to use it in the following intrinsic mixin: https://github.com/Team-Sass/toolkit#intrinsic-ratios .They use the exact same method like in the link you've posted. – rkoller Feb 28 '14 at 17:50
  • 1
    Yeah, you don't need to reduce the fraction all the way down to the smallest amount, you just need to produce a decimal. All that's going on there is division: `7/8` gives the same results as `35/40` because Sass doesn't understand fractions anyway. – cimmanon Feb 28 '14 at 17:53
  • That basically means i might use, if i take the example w 580px h 650px,the value 0.89230769 as the ratio? so in general it's just width/height? – rkoller Feb 28 '14 at 18:00
  • 1
    Yeah (or the reverse). Their examples would have been a little less ambiguous if they'd used spaces (`7 / 8` vs `7/8`). – cimmanon Feb 28 '14 at 18:03
  • cool! thanks! i'll give it a shot when i am back home... – rkoller Feb 28 '14 at 18:08

0 Answers0