Math PNG
From Mathtran
Why math PNGs
Photographs taken by a digital camera often include, as hidden metadata, information such as the date and time at which the photograph was taken. This is possible because the graphics format used allows such data to be stored. This data can be very useful.
Ordinarily, a bitmap representation of a mathematical formula is not scalable, and cannot sensibly be edited. However, both of these are possible if the original mathematical formula is available, together with the parameters used when creating its bitmap representation.
A math PNG is an ordinary PNG, except that it represents a mathematical formula, and it contains as metadata the formula it represents, together with the transformation parameters. One can think of a math PNG as a tiny TeX document, that happens to be wrapped in a PNG bitmap file.
A math PNG is scalable and editable, given suitable tools.
About PNG
PNG is a W3C recommendation for placing bitmapped images on web pages. Each PNG file consists of a sequence of chunks.
The standard allows for additional custom chunks to appear in the PNG file. It evens allows for the [http://www.w3.org/TR/2003/REC-PNG-20031110/#4Concepts.Registration registration of additional chunk types.
A math PNG is a PNG with an additional math chunk.
Content of math chunk
At present the standard for math PNG files is somewhat more informal that we would wish. A math PNG is one that
- contains a math chunk, and
- whose image is the rendered form of the data math chunk.
The data in a math chunk consists of
- a mathematical formula, in TeX notation,
- the log data and dvi produced by TeX when typesetting the formula,
- the scale factor or resolution to be applied when creating the bitmap image, and
- the depth of the formula
If there are no TeX errors, then the log data is empty. The dvi data omits font definitions and page numbers, to save space. Typically, the math data adds about 50% to the size of the PNG file. This is considerably less for high resolution bitmaps.
MathTran uses the [Python] module mathpng.py to manipulate math PNGs.
