SVG pixel ratio is 1: 2 from code to rendering

When rendering my SVG x, y, the width and height are doubled in pixels. What causes this?

EDIT:

Monitor 3840 X 2160 with a scale of 200% in the windows

<!DOCTYPE html>
<html>
<head>
    <style>
        #svg {
            border-style: solid;
        }
    </style>
</head>
<body>
    <svg id="svg" width="300px" height="200px">
        <image x="20" y="20" width="100px" height="100px" xlink:href="test_image.png"></image>
    </svg>
</body>
</html>

enter image description here

+4
source share
2 answers

Windows scaling was set to 200% when using the 3840 X 2160 monitor, which led to the SVG pixel ratio being 1: 2 from code to rendering.

0
source

I would add a comment, but did not have a sufficient reputation.

Your code worked as expected for me, the ratio was correct. Could this be due to the image or browser you are viewing?

SVG Image, .

SVG : www3.org

-1

Source: https://habr.com/ru/post/1655272/


All Articles