latexpngpdflatextikz

How I can produce a png from a tizk tex file (with class standalone)?


I have the following LaTex file:

\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}
\node[fill=yellow]{Hello World!};
\end{tikzpicture}
\end{document}

and I would like to get a single png file from that file. How can I do that?

Many thanks!

PD: I use Ubuntu 22.04

I tried the command convert, online converting but I need something snappy.


Solution

  • If you have imagemagick installed and compile your document with shell-escape enabled, you can simply use the convert option of the standalone class:

    \documentclass[tikz,convert]{standalone}
    \begin{document}
    \begin{tikzpicture}
    \node[fill=yellow]{Hello World!};
    \end{tikzpicture}
    \end{document}