0

I want to convert several files (>100) from .dot format (generated by Doxygen) to .png format, using Graphviz.

Following page describes the file conversion for only one file:

Graphviz: How to go from .dot to a graph?

dot -Tpng input.dot > output.png

Now, I want to proceed with a massive conversion proccess, which involves a lot of files inside a directory.

Most of documentation is for Linux OS, like the following:

https://github.com/rakhimov/cppdep/wiki/How-to-view-or-work-with-Graphviz-Dot-files

( as example:

To run dot on files in directories and sub-directories recursively:

$ find -type f -name "*.dot" directory_path | xargs dot -Tpdf -O )

but I really need to do it on Windows OS.

I have been trying with the following command:

forfiles /c "dot -Tpng @file > @fname.png"

however, in this case, Windows cmd shows the error message:

"There is no layout engine support for "-tpng" Use one of: circo dot fdp neato nop nop1 nop2 osage patchwork sfdp twopi"

for each one of the file conversion attemps.

How it can be done?

Thanks for your time.

  • Which version of dot are you using on windows (dot -V ; also try to locate the dot executable: where dot). Normally doxygen, which version did you use, will convert the .dot files to the image format as specified with DOT_IMAGE_FORMAT in the Doxyfile. When running doxygen did it give errors? – albert Feb 02 '18 at 12:23
  • Hello, `dot -V` gives `dot - graphviz version 2.38.0 (20140413.2041)`. Doxygen 1.8.14 works fine – SergioAlvare Feb 06 '18 at 08:59
  • Did you tried `forfiles /c "dot -Tpng @file -o @fname.png"` instead? – user882813 Feb 08 '18 at 02:46

1 Answers1

2

Try this, it worked for me:

forfiles /m "*.dot" /c "cmd /c dot -Tpng @file > @fname.png"

or, if the extension is ".gv"

forfiles /m "*.gv" /c "cmd /c dot -Tpng @file > @fname.png"
Damiano
  • 21
  • 2