# Tag Archives: tikz2png

## Quick Images with TikZ

How do you create high-quality technical images for documents, your website or posts on Stack Exchange? I have used tools in an ad-hoc manner for a while and have become frustrated lately. Once you have used TikZ1 with $$\LaTeX$$ most other tools feel inferior. The only problem is: TikZ is a $$\LaTeX$$ package and can not be used on its own. So how to convert TikZ to say PNG comfortably?

$$\TeX$$-guru Martin Scharrer comes to the rescue: he wrote the package standalone for exactly this use case. Based on his explanation on tex.SE I built a small bash script that does all the repetitive work for you. With one simple command, this

%p% \usetikzlibrary{arrows,automata,positioning}
\begin{tikzpicture}[shorten >=1pt,node distance=2cm,auto]
\node[state,initial]    (q_0)                {$q_0$};
\node[state,accepting]  (q_1) [right of=q_0] {$q_1$};

\path[->] (q_0) edge [bend left]  node {$a$} (q_1)
(q_1) edge [bend left]  node {$b$} (q_0);
\end{tikzpicture}

becomes this in a matter of seconds:

Get tikz2png on GitHub and enjoy!

1. Check out the awesome gallery of examples and the comprehensive manual.