If you don't need to handle raster files and PDF/PS/EPS through the same tool, don't loosen ImageMagick's security.
Instead, keep your defense in depth for your web applications intact, check that your Ghostscript has been patched for all known -dSAFER
vulnerabilities and then invoke it directly.
gs -dSAFER -r300 -sDEVICE=png16m -o document-%03d.png document.pdf
-dSAFER
opts you out of the legacy-compatibility "run Postscript will full permission to interact with the outside world as a turing-complete programming language" mode.-r300
sets the desired DPI to 300 (the default is 72)-sDEVICE
specifies the output format (See the Devices section of the manual for other choices.)-o
is a shorthand for -dBATCH -dNOPAUSE -sOutputFile=
If you're rendering EPS files, add -dEPSCrop
so it won't pad your output to page size and use -sDEVICE=pngalpha
to get transparent backgrounds.