The example in the question has two documentclass
commands, which is not allowed in LaTeX. You can use a single command with the convert
option added to the options of the first line.
Note that the second 2pt
option does not do anything, it generates a warning and it can be removed. Note also that you need to run LaTeX with the shell-escape
option to allow calling convert
. I don't use TeXstudio myself but according to How to invoke latex with the -shell-escape flag in TeXMakerX? you can do it in various ways, one of which is to add a compile directive at the start of the file as in the example below.
MWE:
% !TeX TXS-program:compile = txs:///pdflatex/[--shell-escape]
\documentclass[preview,border=2pt,convert={density=300,outext=.png}]{standalone}
\begin{document}
\Huge converted pdf
\end{document}
Result (note that the squares indicate transparency, they are shown because they are invisible):

Apart from the .png
the .pdf
is also generated automatically.
convert' and on Windows it is
magick convert' followed by the other information (density, filenames, etc.) This is done outside of TeX. – user139954 Mar 10 '18 at 21:20