# Obtaining dot commands from SVG

**URL:** <https://forum.graphviz.org/t/obtaining-dot-commands-from-svg/771>\
**Category:** Help\
**Created:** [August 12, 2021, 7:53am UTC](https://forum.graphviz.org/t/obtaining-dot-commands-from-svg/771 "2021-08-12T07:53:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![radio1985](https://avatars.discourse-cdn.com/v4/letter/r/e480ec/32.png) [@radio1985](https://forum.graphviz.org/u/radio1985)\
**Post date:** [August 12, 2021, 7:53am UTC](https://forum.graphviz.org/t/obtaining-dot-commands-from-svg/771/1 "2021-08-12T07:53:43Z")

</div>

Hi All,  
I have a graph available in .drawio format which I have downloaded as a SVG format.  
I want this SVG to be converted as a dot file and obtain the dot commands, so that I can add these dot commands in my Doxygen documentation. The main reason to obtain the dot syntax is to add in the source code without adding as a file.  
Any idea how I can achieve this?

Thanks a lot

---

<div class="post-metadata">

**Author:** ![steveroush](https://avatars.discourse-cdn.com/v4/letter/s/a9adbd/32.png) [@steveroush](https://forum.graphviz.org/u/steveroush)\
**Post date:** [August 12, 2021, 6:46pm UTC](https://forum.graphviz.org/t/obtaining-dot-commands-from-svg/771/2 "2021-08-12T18:46:15Z")

</div>

If I understand your request, you want to convert an **SVG** file (created by the **[draw.io](http://draw.io)** program) to a **dot** (input) file.  
Sorry, while it sounds cool, I’m unaware of any “Google translate” to do this. There is a very tiny chance it could be done manually, but it would require _very_ detailed knowledge of both **SVG** and **dot**.  
If you really need a **dot** input file, I suggest learning the **Graphviz (dot)** language and recreate your graph strictly with **dot**.

---

<div class="post-metadata">

**Author:** ![radio1985](https://avatars.discourse-cdn.com/v4/letter/r/e480ec/32.png) [@radio1985](https://forum.graphviz.org/u/radio1985)\
**Post date:** [August 12, 2021, 7:22pm UTC](https://forum.graphviz.org/t/obtaining-dot-commands-from-svg/771/3 "2021-08-12T19:22:33Z")

</div>

Hi steveroush,  
Thanks for the reply. I’ll try with GraphViz language and recreate the dot.

Thanks!

---

<div class="post-metadata">

**Author:** ![steveroush](https://avatars.discourse-cdn.com/v4/letter/s/a9adbd/32.png) [@steveroush](https://forum.graphviz.org/u/steveroush)\
**Post date:** [August 12, 2021, 7:42pm UTC](https://forum.graphviz.org/t/obtaining-dot-commands-from-svg/771/4 "2021-08-12T19:42:01Z")

</div>

I suggest looking at this document: [https://www.graphviz.org/pdf/dotguide.pdf](https://www.graphviz.org/pdf/dotguide.pdf)  
and this web page: [Attribute Types | Graphviz](https://graphviz.org/docs/attr-types/)

---

<div class="post-metadata">

**Author:** ![paniolo](https://avatars.discourse-cdn.com/v4/letter/p/bbe5ce/32.png) [@paniolo](https://forum.graphviz.org/u/paniolo)\
**Post date:** [September 7, 2021, 1:22am UTC](https://forum.graphviz.org/t/obtaining-dot-commands-from-svg/771/5 "2021-09-07T01:22:32Z")

</div>

Could we do the opposite? Include the source code in SVG output? I know you run into problems if you try to use XML comments because “–” is disallowed in comments, but I found a workaround where I manually add the dot source code using CDATA and defs just before the closing svg tag so a graph might appear like this:

```auto
 <defs>
 <![CDATA[
   graph g { a -- b -- c }
 ]]>
 </defs>
 </svg>

```
