Why is graphviz producing a corrupted image file? - graphviz

I am using graphviz to create a png file, however when I run my the code, after it generates the image, I try to open the file only to receive a message that either the image file type (png) is unsupported, which I tested using other pngs so I know that can't be the case, or that the file is corrupted. The code I'm running is as follows:
dot -Tpng test.dot -o test.png
with test.dot being:
graph G {
fontname="Helvetica,Arial,sans-serif"
node [fontname="Helvetica,Arial,sans-serif"]
edge [fontname="Helvetica,Arial,sans-serif"]
layout=fdp
"Infinity Blade" -- "Undertow";
"Infinity Blade" -- "Shadow Complex";
.
.
.
"Calvin and Hobbes" -- "XKCD";
"XKCD" -- "Enders Game";
}
When running the code I did also receive two messages, however neither of them had resulted in a corrupted file the first time I received them:
Warning: Overlap value "prism" unsupported - ignored
dot: graph is too large for cairo-renderer bitmaps. Scaling by 0.404306 to fit

Related

How to ensure that image files from Sphinx Documentation are copied "Automatically" in LaTeX pdf

In my Sphinx documentation project, I am using images like this:
.. image:: /_static/carousel_filling.png
:width: 300px
:height: 450px
:scale: 100 %
:alt: Image here
:align: right
In the Sphinx HTML docs generated, the images are perfectly displayed in the html pages. However, when I generate pdf documents using make latexpdf, I am coming up with the following error:
'LaTeX Warning: File `{carousel_filling}.png' not found on input line ...'
I tried to find documentation related to outputting images however I came up only with this:
Excertps from:
latex_additional_files A list of file names, relative to the
configuration directory, to copy to the build directory when building
LaTeX output. This is useful to copy files that Sphinx doesn’t copy
automatically, e.g. if they are referenced in custom LaTeX added in
latex_elements. Image files that are referenced in source files (e.g.
via .. image::) are copied automatically.
So as per this, the image files should get automatically added to the output pdf file. But this is not happening. In the pdf file where the image should be there only a blank rectangle can be seen.
Interestingly, I can see that the image file has been copied to the folder _build/latex, so it means that pdflatex is able to access the image file!!
Question
How do I correctly output the images included in my Sphinx documentation in generated pdf file?
Edit 1:
In the terminal I can see the following warning:
LaTeX Warning: File `{carousel_filling}.png' not found on input line 931.
! Package pdftex.def Error: File `"""{carousel_filling}".png' not found: using dra
ft setting.
See the pdftex.def package documentation for explanation.
Type H <return> for immediate help.
...
l.931 ...t=450\sphinxpxdimen]{{carousel_filling}.png}
?
[21]
Edit 2:
In place of the image (where the rectangle outline has been output in pdf file) I can see this:
"""{carousel_filling}".png
Don't place your images under _static. It is a special-purpose folder, not for images. E.g. create img/ at the level of your rst files, move image there, and .. image:: img/my-image.png.

Cannot open .dot file gvEdit

I cannot open the attached dot file in gvEdit.
I tried to convert it to png file
dot -Tpng final.dot > finalgraph.png
it gives me the following problem:
dot: graph is too large for cairo-renderer bitmaps. Scaling by 0.311296 to fit
dot: failure to create cairo surface: out of memory
My purpose is only to view the dot file, how should I resolve it?
The dot file is here:
https://www.dropbox.com/s/vt2q653x2x9jjbj/final.dot?dl=0

graphviz pdf generation from .dot failing with both Tpdf and Tps2

I have a .dpt file I am trying to output a .png and .pdf files out of it and I am using my command line expression as: dot -Tpng SPU123.dot -o SPU123.png to generate .png and it works fine. First, I tried to generate (following graphviz documentation) .pdf by: dot -Tpdf SPU123.dot -o SPU123.pdf but it just generated a blank .pdf and the documentation says there is something buggy with Tpdf option and instead use Tps2 option so I did: dot -Tps SPU123.dot -o SPU123.ps but I got this error:
Error: canvas size (34642,3608) exceeds PDF limit (14400)
(suggest setting a bounding box size, see dot(1))
How to generate .pdf output out of my .dot file?

ImageMagick Warning (TIF Conversion)

When I convert a Multi-Image TIF File to Individual TIF Files using ImageMagick I'm getting a Warning stating "Invalid TIFF Directory; tags are not sorted in ascending order'.
convert.exe: Invalid TIFF directory; tags are not sorted in ascending order.
'TIFFReadDirectoryCheckorder' # warning/tiff.c/TIFFWarnings/847
Hoping for Any advice I can get on this error. I am trying to take a Multi-Image TIF File and Turn it into Individual Files, however I need them to be in the order in which they were listed in the Original TIF File for this to work.
If you still have the issue check the limitation disk:
convert -list resource
Example for debian 9 /etc/ImageMagick-6/policy.xml.
I hope that could be helpful.

Loading a DOT file using RGL

RGL supports writing DOT files from a graph, is it possible to create a graph from a DOT file?
(Obviously I can parse the DOT file myself and create a graph, but I'm wondering if this functionality exists already).
First you have to install graphviz which gives you the 'dot' command.
Then you can run
dot -Tpng graph.dot > output.png
but I found that after installing dot the rgl method write_to_graphic_file automatically writes the image if you do something like
graph_obj.write_to_graphic_file('png')

Resources