Comprehensive TeX Archive Network

Direc­tory tex-archive/dviware/dvi2bitmap


Version 1.0, 2015 January 12

dvi2bitmap is a utility to convert TeX DVI files directly to bitmaps,
without going through the complicated (and slow!) route of conversion
via PostScript and PNM.  The prime motivation for this is to prepare
mathematical equations for inclusion in HTML files, but there are
plenty of uses beyond that.  It uses the same kpathsea font-searching
library as other TeX programs, again as long as you have the
appropriate library installed.


  * Written in C++.

  * The program is a wrapper for libdvi2bitmap, a library which abstracts
    DVI and PK files, Bitmaps, and various other objects supporting

  * Supports GIF, XBM, XPM bitmaps as output, plus PNG if libpng is

  * Can read DVI files from a non-seekable stream such as a pipe.

  * Internally constructed bitmap is expandable.

  * Integrated with the kpathsea path-searching algorithm, as used by other
    TeX and DVI programs.  It is not, however, dependent on it, so it
    will still work happily if you don't have the library installed.
    Can use a pre-set search path, or scripts, to find fonts instead.

  * Can generate fonts on the fly.

  * Highly configurable, and very fast.  Designed for use in a batch
    production mode.

  * Released under the GPL.

See <http://purl.org/nxg/dist/dvi2bitmap>

Configuring and building

To configure and build:

    make install

Important ./configure options are

  * --with-png=... : points to the libpng library

  * --with-kpathsea=... : points to the kpathsea library, for finding
      TeX fonts; see the documentation for discussion

You can override the C++ compiler the configure script will choose by
setting the environment variable CXX, either via `CXX=cxx ./configure'
or `env CXX=cxx ./configure', depending on your shell.  Choose the
install location with the argument --prefix.

Since this program uses `standard' TeX fonts, but at resolutions
appropriate for screens rather than paper, there is a certain fuss
involved in generating, and after that, finding, these fonts.  If you
have the `kpathsea' library installed, then this should Just Work.
Failing that, you might have to set an environment variable.  See the
section of the manual entitled `Finding fonts' for some discussion of
this.  As well, it's a good idea to give the command

    (cd test; make)

after you've built the distribution.  As well as testing the program,
this attempts to give you some advice about what you need to do on
your particular system to tell dvi2bitmap where its fonts are.

The program can work with the kpathsea library.  This is the same
path-searching library which several TeX implementations use to find
fonts (and more).  If you wish to use this (you should, if you can),
then give the option `--with-kpathsea' to the configure command, again
optionally specifying a path, and if the library is installed on your
machine, the program will use it.  To build the library, see the
discussion on 'building kpathsea' below.

If you want it to be able to generate GIFs, then give the configure
option `--enable-gif'.  Starting in 2005, this is enabled by default,
since the Unisys patents appear to have expired in 2004.  You can
disable the ability to generate GIFs (probably a good plan, if you
have the PNG library available) with the option `--disable-gif'.

If you want it to be able to generate PNG files (much better, since
they're free of the GIF copyright problems), then give the configure
option `--with-png'; if you don't have libpng in the default places
(typically /usr/lib or /usr/local/lib), then instead use
`--with-png=/path/to/png', where the specified path is that to the
directory which contains the png include/ and lib/ directories.  This
will check you have the libpng library and headers somewhere the
compilers can find them, and build in support if it finds them.  The
PNG library is not distributed with this utility: you can find it at

The program builds successfully on (at least) the following
machine/compiler combinations.  It should be written in
standards-conforming C++, so if it doesn't build then (1) it's not as
conformant as I think it is (in which case please tell me), (2) your
compiler is not as conformant as you think it is (in which case please
don't tell me), or (3) you need to invoke some magic to get the
compiler to be conformant (in which case tell me, if there's something
I can do in the autoconfigure script).

    powerpc-apple-darwin6.6 (MacOS X, 10.2.6)
        g++ 3.1 20020420 (prerelease)

        CXX=CC: Sun WorkShop 6 update 2 C++ 5.3 2001/05/15

        CXX=cxx: Compaq C++ V6.5-014

    i686-pc-linux-gnu (RedHat 7.3)
        g++ 2.96

Building kpathsea

To build the kpathsea library (presuming it's not available in your
TeX distribution), you should start from a Subversion checkout.
You can check out the entire tree
(with the command 'svn co svn://tug.org/texlive/trunk/Build/source')
but that takes a _long_ while.
Or you can check out just the required bits:

  % svn co svn://tug.org/texlive/trunk/Build/source/m4
  % svn export svn://tug.org/texlive/trunk/Build/source/version.ac
  % svn co svn://tug.org/texlive/trunk/Build/source/texk/am texk/am
  % svn co svn://tug.org/texlive/trunk/Build/source/texk/kpathsea texk/kpathsea
  % svn co svn://tug.org/texlive/trunk/Build/source/texk/tests/texmf texk/tests/texmf
  % cd texk/kpathsea

Then build:

  % autoreconf --install --symlink
  % ./configure
  % make
  % make check
  % make install

Alternatively, snarf a copy of the base tree from eg
<http://www.tex.ac.uk/tex-archive/graphics/metapost/base.zip>, unpack
it, cd to base/source/texk/kpathsea, and build as above.

Font-string templates

Several things which can be configured -- either at ./configure time
or in the config.h file, if you have to edit that explicitly -- are
specified as being in the form of a `font string
template'.  This is a printf-like string which has %? specifiers
replaced by font parameters, according to the following scheme:
  %M = mode (eg. ibmvga)
  %f = font name (eg. cmr10)
  %d = dpi (eg. 330)
  %b = base dpi (eg. 110)
  %m = magnification (eg. 3)
  %% = %

This also applies to the DVI2BITMAP_PK_PATH environment variable,
which may be used to point to the PK paths generated by dvi2bitmap.

This applies to the font-generation script and font-search scripts.


See directory doc/ -- there are fuller installation instructions
there.  Full library documentation in directory doc_libdvi2bitmap/.
There's also a man-page in dvi2bitmap.1, but this is not 
necessarily as up-to-date as the main documentation.


Norman Gray <http://nxg.me.uk>
See also the other contributors in the file AUTHORS.


Copyright 1999--2004, Council for the Central Laboratories of the Research Councils.
Copyright 2005--2015, Norman Gray.
Released under the terms of the GPLv2, a copy of which is included in the file LICENCE.


Name Notes


Name Size Date Notes
AUTHORS 452 2013-04-15 14:39
Bitmap.cc 43185 2013-04-15 14:39
Bitmap.h 7297 2013-04-15 14:39
BitmapI­mage.cc 3684 2013-04-15 14:39
BitmapI­mage.h 2162 2013-04-15 14:39
Byte.h 390 2013-04-15 14:39
ChangeLog 5708 2013-04-15 14:39
Doxy­file.in 47364 2013-04-15 14:39
DviEr­ror.cc 911 2013-04-15 14:39
DviEr­ror.h 625 2013-04-15 14:39
DviFile.cc 48408 2013-04-15 14:39
DviFile.h 21012 2013-04-15 14:39
DviFilePo­si­tion.cc 6032 2013-04-15 14:39
DviFilePo­si­tion.h 1395 2013-04-15 14:39
FileByteStream.cc 3760 2013-04-15 14:39
FileByteStream.h 546 2013-04-15 14:39
GIFBitmap.cc 21381 2013-04-15 14:39
GIFBitmap.h 2671 2013-04-15 14:39
In­putByteStream.cc 25690 2013-04-15 14:39
In­putByteStream.h 5071 2013-04-15 14:39
Kar­lPathSearcher.cc 9896 2015-01-12 15:42
Kar­lPathSearcher.h 1140 2013-04-15 14:39
LICENCE 18009 2013-04-15 14:39
Make­file.am 4335 2015-01-12 17:29
Make­file.in 44242 2015-01-12 17:30
NEWS 34 2013-04-15 14:39
PNGBitmap.cc 14334 2013-04-15 14:39
PNGBitmap.h 923 2013-04-15 14:39
PageRange.cc 6167 2013-04-15 14:39
PageRange.h 694 2013-04-15 14:39
PipeStream.cc 19972 2013-04-15 14:39
PipeStream.h 1266 2013-04-15 14:39
PkFont.cc 37359 2015-01-12 15:42
PkFont.h 13538 2013-04-15 14:39
README 7175 2015-01-12 17:33
TODO 2241 2013-04-15 14:39
Util.cc 4770 2013-04-15 14:39
Util.h 603 2013-04-15 14:39
XBMBitmap.cc 1715 2013-04-15 14:39
XBMBitmap.h 527 2013-04-15 14:39
XPMBitmap.cc 1815 2013-04-15 14:39
XPMBitmap.h 599 2013-04-15 14:39
aclo­cal.m4 42075 2015-01-12 17:08
com­pile 7333 2013-08-12 18:16
con­fig.guess 43381 2007-07-04 21:28
con­fig.h.in 8383 2015-01-12 17:13
con­fig.sub 31240 2007-07-04 21:28
con­fig­ure 596182 2015-01-12 17:08
con­fig­ure.ac 24729 2015-01-12 17:06
de­p­comp 15936 2007-07-04 21:27
dvi2bitmap.1 30330 2015-01-12 17:08
dvi2bitmap.1.in 30335 2013-04-15 14:39
dvi2bitmap.cc 50302 2015-01-12 15:42
dvire­port.1 2281 2013-04-15 14:39
dvire­port.cc 5260 2013-04-15 14:39
getopt_long.c 35164 2013-04-15 14:39
getopt_long.h 6274 2013-04-15 14:39
get­sub­opt.c 2719 2013-04-15 14:39
in­stall-sh 9233 2007-07-04 21:27
lt­main.sh 283474 2013-08-12 18:16
miss­ing 11014 2007-07-04 21:27
stringstream.h 704 2013-04-15 14:39
test-driver 3977 2013-08-12 18:16
ver­bosity.h 986 2013-04-15 14:39
ver­sion.h 73 2015-01-12 17:33

Down­load the con­tents of this pack­age in one zip archive (1.5M).

dvi2bitmap – Util­ity to con­vert TeX DVI files di­rectly to bitmaps

A util­ity to con­vert TeX DVI files di­rectly to bitmaps, with­out go­ing through the com­pli­cated (and slow!) route of con­ver­sion via PostScript and PNM. The prime mo­ti­va­tion for this is to pre­pare math­e­mat­i­cal equa­tions for in­clu­sion in HTML files but there are many other uses be­yond that. It can gen­er­ate XBM and GIF bitmaps, plus PNG, if you have the libpng li­brary in­stalled. It uses the same kpath­sea font-search­ing li­brary as other TeX pro­grams, again as long as you have the ap­pro­pri­ate li­brary in­stalled. The pro­gram is writ­ten in C++, and in­ci­den­tally pro­vides a good ob­ject in­ter­face for DVI and PK files.

Pack­age De­tailsdvi2bitmap
Home pagehttp://dvi2bitmap.source­forge.net/
Ver­sion1.0 2015-01-12
Li­censeGNU Gen­eral Public Li­cense, ver­sion 2
Main­tainerNor­man Gray
Topics gen­er­ate graphic bitmaps from DVI files
See also dvipng
Guest Book Sitemap Contact Contact Author