Welcome to yEd Q&A!
Here you can ask questions and receive answers from other members of the community and yEd developers. And you can tell us your most wanted feature requests.

Categories

How do I prevent some imported SVGs from distorting?

0 votes

I've got some svg files that I've used for a long time with yEd. Many versions back I discovered some of the SVGs when re inserted into a yEd new or previously made document have their edge box thingy way bigger than the svg image itself.

For example the imported svg might be about 50px by 50px but the selection box boundary (the box that shows when you click on the image to resize it with mouse) might be in the order of 600px by 200px with the svg graphic sitting in the bottom right of this box. And those big dimensions also appear in the image properties in yEd.

If I shrink the box to what size/shape the image should be the image gets squished and out of proportion. So I can have really big boxes with edges going nowhere near the graphic or really distorted graphic that you cannot tell what it is.

I've uploaded 2 svg files that this happens to me with.

http://yed.yworks.com/support/qa/?qa=blob&qa_blobid=7668799965453284796

http://yed.yworks.com/support/qa/?qa=blob&qa_blobid=11722957902979364291

It doesn't happen with all the svg files I have, just a few.

Running yEd 3.10

in Help by

1 Answer

0 votes

Your SVG documents contain unused and/or invisible geometric elements. Since these elements are in there, they are taken into account when calculating the size of the displayed graphic. If you remove these unnecessary elements, yEd does no longer reserve more space than expected.

E.g. I have removed (or rather commented out) two unnecessary <path> elements from your network-server-vm and now it displays fine. (Using a diff tool, you will spot my modifications right away.) The same approach yields a nice version of your generic-1u-server, too.

A good approach for finding problematic elements is opening the SVG document in Inkscape, zooming far out, and then stepping through the elements in Inkscape's XML editor ("Edit" -> "XML Editor"). Each time an element is selected in the XML editor, it is highlighted in the main drawing canvas (if not, it probably lies outside the currently displayed area and you need to zoom out some more). This way you can easily determine if the element actually contributes to the graphic or not. In the latter case, it should be removed (which can be conveniently done in the XML editor).

by [yWorks] (160k points)
edited by
Thank you so much! I shall give your method a shot.
Interesting that earlier versions of yEd didn't take those extra elements into account and displayed them correctly.

At least I now have a way to resolve the problem. Cheers.
Legal Disclosure | Privacy Policy
...