+# with much advice from members of the preview-latex project:
+# David Kastrup, dak@gnu.org and
+# Jan-Åke Larsson, jalar@mai.liu.se.
+# and with much help testing the code under Windows from
+# Paul A. Rubin, rubin@msu.edu.
+
+# This script takes a LaTeX file and generates a collection of
+# ppm image files, one per previewed snippet.
+# Example usage:
+# legacy_lyxpreview2bitmap.py 0lyxpreview.tex 128 ppm 000000 faf0e6
+
+# This script takes five arguments:
+# TEXFILE: the name of the .tex file to be converted.
+# SCALEFACTOR: a scale factor, used to ascertain the resolution of the
+# generated image which is then passed to gs.
+# OUTPUTFORMAT: the format of the output bitmap image files.
+# This particular script can produce only "ppm" format output.
+# FG_COLOR: the foreground color as a hexadecimal string, eg '000000'.
+# BG_COLOR: the background color as a hexadecimal string, eg 'faf0e6'.
+
+# Decomposing TEXFILE's name as DIR/BASE.tex, this script will,
+# if executed successfully, leave in DIR:
+# * a (possibly large) number of image files with names
+# like BASE[0-9]+.ppm
+# * a file BASE.metrics, containing info needed by LyX to position
+# the images correctly on the screen.
+
+# The script uses several external programs and files:
+# * A latex executable;
+# * preview.sty;
+# * dvips;
+# * gs;
+# * pnmcrop (optional).
+
+# preview.sty is part of the preview-latex project
+# http://preview-latex.sourceforge.net/
+# Alternatively, it can be obtained from
+# CTAN/support/preview-latex/
+
+# The script uses the deprecated dvi->ps->ppm conversion route.