TikzPictures.jl icon indicating copy to clipboard operation
TikzPictures.jl copied to clipboard

Support PNG output

Open knuesel opened this issue 3 years ago • 1 comments

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.

knuesel avatar Apr 23 '21 08:04 knuesel

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.

mykelk avatar Apr 23 '21 13:04 mykelk