Menu

LaTeX document to PNG

← TOC    ↑ Home    LaTeX document PDF EPS SVG PNG JPEG ICO XPM

LaTeX document to PNG

This page shows how to convert a LaTeX document x.tex into a PNG image.

When converting vector graphics to bitmap images (like PNG) you have to specify a resolution. This is the number of pixels per inch.


Choice 1: Use gxhconvert

Procedure

gxhconvert -o=png -r=_resolution_ x.tex

See the [gxhconvert manual] for a full description of the gxhconvert script.

Options

Option Purpose
-a
--alpha
Create alpha channel. Untouched input regions result in transparent output regions.
--interlaced Create interlaced PNG. The start of the file (data stream) allows to render the image in low quality, details for better quality follow.
--optimized Optimize (decrease) file size. Computation takes a little longer and uses more memory.
--ultra-optimized PNG file size optimization, do exhaustive search with large number of trials using optipng options
"-zc8-9 -zm1-9 -zs0-3 -f0-5"
--web Shortcut for
"--interlaced --optimized --ultra-optimized".

Choice 2: Manual conversion, create alpha channel

Procedure

pdflatex -interaction=nonstopmode x
pdf2svg x.pdf x.svg
inkscape --batch-process --export-type=png --export-overwrite --export-filename=x.png --export-dpi=_resolution_ --export-area-page x.svg

Temporary files

  • x.aux
  • x.log
  • x.pdf
  • x.svg

Choice 3: Manual conversion, no alpha channel

Procedure

pdflatex -interaction=nonstopmode x
pdftoppm -r _resolution_ x.pdf | pnmtopng > x.png

Temporary files

  • x.aux
  • x.log
  • x.pdf
← TOC    ↑ Home    LaTeX document PDF EPS SVG PNG JPEG ICO XPM

Related

Wiki: gxhconvert manual