JuliaTeX / TikzPictures.jl

Creating PGF/TikZ pictures and saving them in various formats
Other
89 stars 28 forks source link

Support PNG output #74

Open knuesel opened 3 years ago

knuesel commented 3 years ago

It would be useful to add support for PNG output.

While inferior to SVG in rendering quality, I think it has many use cases. Here's mine:

I want to distribute Jupyter notebooks that include the pictures generated by TikzPictures.jl . Currently the pictures are stored in the notebook as SVG. When the notebook is opened by a new user, the SVG is not trusted so the picture is not shown. The user has to rexecute the cell or explicitely trust the notebook to see the picture. See here and here for reports of this difficulty.

mykelk commented 3 years ago

I think we can do this using the Poppler backend using something like:

Poppler_jll.pdftocairo() do exe
   return success(`$exe -png $(temp_filename).pdf $(temp_filename).svg`)
end

similar to what is found in src/svg.jl. We'd want to set some kind of global variable that sets the default backend for rendering. PRs are welcome.