Possible Duplicate:
Compile a LaTeX document into a PNG image that's as short as possible

What is the easiest way to compile tex file into image (I mean in any common graphic formats JPG/PNG/...)? Is there something easier then compiling into PS and transferring it into image?

  • Have a look at the standalone class which has a image convert feature (starting from v1.0). However, you always need to compile it to DVI/PS or, better, PDF and then convert it from there. standalone just does most of that for you. See the question linked by @AndrewStacey above for details. Your question seems to be a close duplicate of that one. If you don't think so please add more details into your question, e.g. your motivation etc., so that the the difference can be seen better. Similar, more specific and/or follow-up questions of existing ones are fully acceptable here. – Martin Scharrer Mar 16 '12 at 12:28

You can compile your TeX file into dvi and use dvipng for the conversion. It comes preinstalled on TeXlive.

| improve this answer | |

This only works for single pages, Windows, Powerpoint installed. Use the standalone class to get a pdf with minimum margins. Now open powerpoint and insert the pdf image. Right click on image and save to desired format.

I have used ImageMagick for batch file conversions of multiple image files in a folder.

| improve this answer | |
  • To be honest, using PowerPoint is a very complicated (and not really good) solution to not-so-complicated task. – yo' Mar 16 '12 at 12:16
  • Note that it is the standalone class (not the package) which allows you to do this. The current v1.0 also has features for multiple pages and automatic conversation to a PNG or JPG etc. – Martin Scharrer Mar 16 '12 at 12:25
  • Edited answer. And I concur with weakness of Powerpoint. My student audience are very non-computer technical, but very Powerpoint proficient, so I leverage this in the teaching. And later in the semester I demo ImageMagick to them. Few every need it. – R. Schumacher Mar 16 '12 at 12:51

The way I do it is using the ImageMagick utility convert:

pdflatex myfile
convert -density 150 myfile.pdf myfile.png

You can of course make a shell script for that (in linux in the following way, in windows it can be done as well but I don't know how): Make a file pnglatex in your /usr/bin directory with contents

pdflatex $1 &&
echo Converting: &&
convert -density 150 $f.pdf $f.png

Then you can run pnglatex myfile or pnglatex myfile.tex. You can of course choose any common image format, but PNG is probably most suitable (see comments).

| improve this answer | |
  • 1
    I suggest to use PNG instead of JPG. JPG is not really suitable when you have text. – topskip Mar 16 '12 at 12:17
  • I agree with @PatrickGundlach: JPG is only for photos and should not be used for screenshots and diagrams. PNG is lossless and much better for these. See also tex.stackexchange.com/a/10970/2975. – Martin Scharrer Mar 16 '12 at 12:35
  • 1
    Using Image Magick is a good way to do it, especially under Linux and similar OSs, because there it is normally quickly installed and easy to use. I like to point out that the standalone class (starting from v1.0) does this internally if requested by the convert option. The density and other options can be adjusted by class options. See the manual for more details. – Martin Scharrer Mar 16 '12 at 12:37
  • @PatrickGundlach Looking back, I have to agree. I'll change it to PNG. – yo' Mar 16 '12 at 14:20

Not the answer you're looking for? Browse other questions tagged or ask your own question.