cotrace  (Compact Trace) version 1.13 (June 6, 2014)
         [versions 0.1-0.3 were called `ctrace']

Author:  Stepan Orevkov      orevkov(())math.ups-tlse.fr
                             http://picard.ups-tlse.fr/~orevkov

         monochrome bmp -> eps
---------------------------------------------------------------

This is a very simple vectorizer. It transforms 1 bit per
pixel (i.e., black and white) bmp files into the eps format.
The main (maybe, the only) advantage is that it produces a very
short output file. Originally it is designed for the vectorization
of ancient Maya glyphs which were scaned from hand-made pictures.
For them, cotrace produces a postscript code which is 3-7 times 
shorter than AutoTrace' code providing the same quality.


----------------
  Installation
----------------

Just compile the file  cotrace.c  using your favorite C compiler.
For example, under LINUX, this can be done by the command

   gcc cotrace.c -o cotrace


---------
  Usage
---------

cotrace [options] InputFile [>OutputFile]

Options:

    -rnn  Remove monochrome regions whose outer perimeter is shorter
          than  nn  pixels. Default value is  30. When speaking of
          the perimeter, we assume that pixels are squares.

    -b    Set BoundingBox to be the smallest box containing all black
          pixels. By default, the BoundingBox is [0 0 2w 2h] where  w  
          and  h  are the width and the height of the bitmap mesured in
          pixels. The picture is scaled so that the pixel size corresponds
          to 1/36 inch (2 postscript points).

    -n    Forbid multiline strings on the output (if -c is not specified).
          In this case, the output EPS file does not contain any backslash
          character but the prolog of the eps file becomes 160 bytes longer
          and the rest becomes 2% longer.

    -s    Separate the output (if -c option is not specified), i.e. create
          three files `foo.bb', `foo.pro', and `foo.bd' where `foo.bmp' is
          the name of the input file. These files contain the bounding box,
          the prolog, and the body of the eps file respectively. 

    -c    type1 charstring output instead of EPS (see details in T1Format.pdf).

    -a    Binary output (if -c option is specified).

    -p    Create a proof file foo.prf. This is an EPS file where the
          control points of the outline Bezier curves are shown.

    -m    Mirror image with respect to the vertical axis.

    -gnn  Add margins of  nn  pixels width ( nn  may be negative).
          If -b option is specified, then the margins are added to
          the minimal box containing black pixels.


----------------
  Restrictions
----------------

1). The minimal box bounding black pixels cannot exceed 3527x3527 pixels.

2). Compressed bmp is not supported. Neither multi-plan bmp.

3). I am not sure that it works correctly for small values of  -r  option.


-----------------------------
  Encoding used in eps file
-----------------------------

The outline is traced by Bezier curves except that the initial and the final
point of each contour are connected by a segment using PS command `closepath'. 
Each contour is represented by a string (i.e. a sequence of ascii characters 
enclosed in parentheses). The first 4 characters encode the initial point.
The rest of the string is divided into pairs of characters, and each pair
encodes the vector relating successive base points of the Bezier curve.
The decoding algorithm is given in the prolog of the resulting eps file.
If  -n  option is used, then long strings are replaced by arrays of
smaller strings.


--------------------------------------------------------------
  What to do with raster formats other than monochrome bmp ?
--------------------------------------------------------------

You can convert them into monochrome bmp. For example, I do it under 
Linux using the program `convert' from the package `ImageMagick'. 
Like this:

   convert foo.tiff -monochrome tmp.bmp
   cotrace tmp.bmp >foo.eps
   rm tmp.bmp


----------------------------------------------
You may do with this program whatever you want
except to sell it or to say that you wrote it.

All comments and/or bug reports are appreciated.
Stepa O

