[Leptonica Home Page]

Source Code and Information

Updated: Dec 20, 2022

    The road to wisdom? -- Well, it's plain
    and simple to express:
        and err
        and err again
        but less
        and less
        and less.

            --Piet Hein (Grooks)


This site contains well-tested C code for some basic image processing operations, along with a description of the functions and some design methods. A full set of affine transformations (translation, shear, rotation, scaling) on images of all depths is included, with the exception that some of the scaling methods do not work at all depths. There are also implementations of binary morphology, grayscale morphology, convolution and rank order filters, and applications such as jbig2 image processing and color quantization.

You will also find basic utilities for the safe and efficient handling of arrays (of strings, numbers, number pairs and image-related geometrical objects), byte queues, generic stacks, generic lists, and endian-independent indexing into 32-bit arrays.

There is a very high-level summary of the functions in the library. You can use this to quickly get an idea of where you may find a needed function.

Documentation external to the source code is provided for the following operations and applications:

  1. Rasterops

  2. Binary morphology

  3. Grayscale morphology

  4. Convolution

  5. Scaling

  6. Rotation

  7. Affine transformations

  8. Seed filling and connected components

  9. Applications:
  10. Grayscale and color image enhancement

  11. Grayscale mapping and binarization

  12. Connectivity-preserving thinning

  13. Playing around


Click here to download a source release. [ update: Dec 20, 2022 ]

Be sure to download the README as well.

If you are building the library and applications on Windows, the sw package is available on the github repository. There you can obtain the latest release and build the library using cmake.

Tom Powers has also built the Unofficial Leptonica Documentation using Sphinx. It covers most of the information in these pages and is more easily navigated. Note, however, that all information about releases (README, builds, version notes, etc) relates to version 1.68, which is about 7 years out of date and is not supported.

You may also find these pages useful:

Related Publications

Here are some references to selected papers on image processing and image analysis that you might find interesting.

Luc Vincent and I wrote a chapter on Document image analysis, in Mathematical morphology: theory and applications, published by ISTE-Wiley in June 2010. The book is is a compendium on topics in morphology, edited by Laurent Najman and Hugues Talbot. Here is a page that provides information, including the location of source code for running the applications and generating the figures for this chapter.

[Leptonica Home Page]

Creative Commons License
This documentation is licensed by Dan Bloomberg under a Creative Commons Attribution 3.0 United States License.

© Copyright 2001-2021, Leptonica