[Tex/LaTex] Command(s) which would render a LaTeX document into a PNG on Mac

png

I am using TexShop on a Mac, which handles all of the rendering for me, but have been asked by a colleague to find the command(s) that would render the LaTex document as a PNG instead of PDF.

By way of example, on linux it would be

$ pdflatex file.tex
$ gs -sDEVICE=pnggray -sOutputFile=card.png -dNOPAUSE -r1200 file.pdf quit.ps

(Note: the -r1200 will generate an image 4x larger than used, since it will be scaled down to produce an anti-aliased image).

Thank you & kind regards.

Best Answer

The Mac OS is Unix-based, so at the Terminal

pdflatex <filename> && gs -sDEVICE=pnggray -sBATCH -sOutputFile=<filename>.png -dNOPAUSE -r1200 <filename>.pdf

should work just fine. (Fill in your <filename>, of course.)