TEX2PNG
Converting a LaTeX Formula into a PNG Image
 
 
INTRODUCTION
 

TeX2PNG is a tool for converting a LaTeX formula into a PNG image. It is written in C++ and uses classical software of Linux distributions: LaTeX, GhostScript and NetPBM (more precisely the programs pnmtopng and pnmscale). It is also possible to visualize directly the generated image. For this purpose, a Java virtual machine is needed to execute the necessary classes of the .

 
ONLINE VERSION
 

Here you can generate online PNG images from LaTeX mathematical formulas. It is a CGI interface that calls the TeX2PNG program. The server where the program runs is not very powerful, so be patient with it, and please do not call the program several times at the same moment. If we notice severe abuse on this server, we will shut down the facility. Moreover, the size of the generated images is limited to 1600 x 1200 pixels with this online version. Thanks in advance for your comprehension.

LaTeX Formula:  
     
Zoom:  
     
   

For the syntax of the formulas, you can check the help for LaTeX formulas of Wikipedia.

 
CONSOLE VERSION
 

Tex2PNG is a command-line program. The syntax is very simple, you only need to call the program with the LaTeX formula between quotes and the name of the file where the PNG image will be stored.

tex2png "\sum_{i=1}^N{i}=\frac{N(N+1)}{2}" result.png

The example above generates this image:

The program provides the following options, to be placed before the LaTeX formula:

  • -bx: Indicates that the Java classes of the B++ Library are in the folder x. Without this option, the program searches the information in the BPP_JAVA environment variable.

  • -d: Displays the image on the screen. The output file is then optional.

  • -lq: Provides an image of lower quality, the generation is much faster.

  • -r*: Replaces the symbol * by the LaTeX command \times.

  • -sx: Sets the scale of the image to x. By default, this value is set to 20, which allows to obtain an image of enough quality for an insertion into a Microsoft Word document for instance (for a font of 12 points, the image will be reduced to 30 % of its original size).

 
DOWNLOAD
 

If you need to use intensively this software (or want a better resolution of the generated images), its GPL-licensed source code and or binary code for Microsoft Windows are available. In the Windows archive, you will also find the Java package necessary for the direct display of the mathematical formulas. Do not forget that some software is essential for TeX2PNG to work (cf. the introduction). Under Linux, these tools are usually available by default; under Windows, it is advised to install Cygwin to get these tools.