3

Is there a way to produce an image file (png) wihout producing first a pdf file? I'm useing the standalone class

\documentclass[preview, border=1pt, convert={outext=.png}]{standalone}

I am able to produce a png file with the command:

pdflatex --shell-escape formula.tex && convert -resize 50% formula.png formula.png

but I don't like to write a pdf file each time on the disk, because I need only the png file. Is there a better alternative?

  • 2
    standalone class has a convert option so that you seem to get png output but it just uses shell-escape to do what you show above, tex can only make dvi or pdf output so you need to write one of those forms to disk at some point – David Carlisle Apr 24 '19 at 11:28
  • If you don't want to see the pdf/dvi redirect it into some tmp folder – user186389 Apr 24 '19 at 11:38
  • actually I misread your example, I thought you were calling convert to convert pdf to png but you are already using the convert option to standalone to make that implicit, then separately scaling the png image afterwards. So what is the question? there is no visible pdf in the commands that you show is there? – David Carlisle Apr 24 '19 at 11:42
  • maybe I'm doing it wrong.. Don't I need the command line convert option to convert the pdf to png? beside I need also to resize the image.. – Giuliano Malatesta Apr 24 '19 at 11:45

1 Answers1

2

With the standalone class you can produce PDF files and with the convert option turn the produced PDF into a graphics file automatically (using external software, which requires the -shell-escape compiler option). With the command

pdflatex --shell-escape formula.tex

you are creating a png file by conversion of a pdf which is not shown.

Instead of using

convert -resize 50%

you could set the size already in the tex file with

\documentclass[preview, border=0.5 pt, convert={size=800x800,outext=.png}]{standalone}