# how to remove the background for png picture [duplicate]

I would like to make the background transparent. In Texmaker, if I right-click on the TikZ picture, I can save it as a png image as follows

If I save this picture, I get the white background. Is there a way to remove it?

\documentclass[border=10pt,tikz]{standalone}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{calc,fit,arrows.meta, positioning}
\usepackage{graphicx}
\usetikzlibrary{calc}

\begin{document}

\begin{tikzpicture}[auto,node distance=3cm,>={Stealth[width=4mm, length=6mm, fill=red]}]
\coordinate (O) at (5,0);

\draw [very thick,fill=green,fill opacity=.2]
(-4, 4) circle (2.0cm) node [fill opacity=1]{\textbf{A}};

\end{tikzpicture}

\end{document}

• I'm not sure you can achieve this within LaTeX, but if you rewrite your question in Google you can find a lot of tools and trick for achieve it with many options since Paint until Photoshop, IMHO is the easiest way. – Aradnix Apr 4 '15 at 17:05
• With ImageMagick installed: convert <file>.pdf <file>.png will give you a .png with transparency. – Paul Gessler Apr 4 '15 at 17:10
• The problem is that PDFs are always opaque (simulating paper). You can use an image editor to make the background transparent, but if you save the result as a PDF, it will be white again. – John Kormylo Apr 4 '15 at 19:45
• @JohnKormylo The PDF produced by the ECM above is not opaque (and does not contain a simulated paper). – Paul Gaborit Nov 5 '15 at 12:25

The problem is very likely the use of transparency (option fill opacity). The following examples used opaque colors, the lightgreen is achieved by mixing green with white:

\documentclass[border=10pt,tikz]{standalone}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
\draw [very thick,fill=green!20!white]
(-4, 4) circle (2.0cm) node {\textbf{A}};
\end{tikzpicture}

\end{document}


This file can be converted to a PNG file, where the background is transparent:

The PNG image was converted via ghostscript, full command line of the conversion:

\$ gs -sDEVICE=pngalpha -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 -dUseFastColor=true -dPDFSETTINGS=/prepress -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -r216x216 -sOutputFile=test.png -ftest.pdf