跟进我的评论:Cirkuit 通过运行以下命令序列将 TikZ 图表转换为图像:
pdflatex img.tex
pdftops -eps img.pdf
convert -density 300 img.eps img.png
这里的img.tex 将是一个遵循此模板的 LaTeX 文件:
\documentclass{article}
\usepackage{tikz,amsmath,siunitx}
\usetikzlibrary{arrows,snakes,backgrounds,patterns,matrix,shapes,fit,calc,shadows,plotmarks}
\usepackage[graphics,tightpage,active]{preview}
\PreviewEnvironment{tikzpicture}
\PreviewEnvironment{equation}
\PreviewEnvironment{equation*}
\newlength{\imagewidth}
\newlength{\imagescale}
\pagestyle{empty}
\thispagestyle{empty}
\begin{document}
\begin{tikzpicture}
% (your TikZ code goes here)
\end{tikzpicture}
\end{document}
如果您能够使用 Cirkuit 或类似的编辑器,或者为自己编写脚本以将图表放入该模板并运行适当的工具,那么您将有一种将 TikZ 代码转换为 PNG 图像的快速方法。
为了更直接地回答您的问题...不,我不知道有什么方法可以将 TikZ 图 直接 转换为 PNG 而无需通过 PDF 文件(或至少 DVI)某个阶段。