Convert SVG paths to MXGraph syntax used in DrawIO stencils
Notes:
- Only simple monotone shapes are supported due to the limitations of DrawIO shapes (think clip-art)
- SVGs containing groups
<g>
, definitions<def>
or transform attributes are not supported. - Fill and stroke properties are not translated.
- Drag and drop an SVG file onto the input textarea
Optional: One can also paste SVG XML in the input textarea - Make sure the "include all stencil tags" checkbox is selected
- Click the big convert button
- Copy the output from the Stencil XML textarea
- In DrawIO select Arrange > Insert > Shape
- Paste the Stencil XML in the provided area (replacing the demo text)
- Click Preview to make sure the image translated correctly
- Click Apply
To further improve DrawIO's handling of your shape you can do the following:
- Select your new shape by clicking on it
- In the "Style" panel change the Fill and Line properties to your liking
- In the "Arrange" panel under "Size" select "Constrain Proportions" and change the size to your liking
Now your shape is ready to be added to the Scratchpad or a custom library.
Note: To edit your shape at anytime: select it and click "Edit shape" in the "Style" panel
- Handle transform:translate with
- shapes
- paths
- Add more SVG shapes:
- line
- polyline
- polygon