Eldon Lesley
Eldon Lesley

Reputation: 935

Maintain Aspect Ration on SVG Image Calculation Formula

I have an image element of the SVG inb the HTML5,

The image size is: (stretch, preserveAspectRatio is set to "none") width=520px height=240px

then, I modify it to maintain aspect ratio (preserveAspectRatio is set to defer) because width>height, the height still the same = 240px but how can I calculate the new width (it is shrinked because the maintain aspect ratio) is there a formula to this?

Upvotes: 1

Views: 331

Answers (1)

Robert Longson
Robert Longson

Reputation: 124109

viewBox width / viewBox height * 240px I imagine.

Upvotes: 1

Related Questions