Downloading liblept pre-built binaries and header files for Windows

The easiest way to use liblept is to download the latest version of, the pre-built binary archive, from the Leptonica website.

It contains the entire lib and include directories needed to build Windows-based programs that use the static or dynamic versions of the liblept library (including static library versions of zlib, libpng, libjpeg, libtiff, and giflib). The libraries are built with Microsoft Visual Studio 2008 32-bit. The complete contents of the archive can be seen here.

Unpack this file to the same directory that liblept will be in. For example, after unpacking you should have something similar to this:


The archive contains the latest releases of the supported image libraries at the time liblept was released. For the current version (Leptonica-1.68) these are:

Image Library Versions
Library Version Date
zlib 1.2.5 19-Apr-2010
libpng 1.4.3 25-Jun-2010
libjpeg 8c 16-Jan-2011
libtiff 3.9.4 15-Jun-2010
giflib 4.1.6 10-Nov-2007

A simple method to print out the versions of liblept and its image libraries is shown in the Quickstart.

If you’d like to determine the compiler options used to build these binaries or build them yourself see (Optional) Building the liblept library and (Optional) Building zlib, libjpeg, libpng, libtiff and giflib.


Executables for the programs in the liblept /prog directory are not included in this archive. Follow these instructions to build them yourself.

About version numbers in library filenames

To make it possible to tell at a glance which version of the libraries are being provided, they all now have version numbers as part of their filenames. This, however, this makes them somewhat more difficult to use in Visual Studio Projects and external makefiles when the versions change.

Copy C:BuildFolder\leptonica-1.68\vs2008\create_unnumbered_hardlinks.bat and remove_unnumbered_hardlinks.bat to C:\BuildFolder\lib. Then, after opening a Command Window, switching to the C:\BuildFolder\lib directory and running create_unnumbered_hardlinks.bat (or just double-clicking it in Windows Explorer) you’ll be able to refer to the static liblept library:


as any of the following:


and the import library for the liblept DLL:




Similarly, you’ll be able to refer to:





A NTFS hardlink doesn’t act quite the same as a unix symbolic link. If the target of the link is deleted or renamed, the hardlink becomes a copy of the original file. When in doubt after updating/rebuilding the targets, it’s best to remake the hardlinks by first running remove_unnumbered_hardlinks.bat and then running create_unnumbered_hardlinks.bat again.

For those who don’t want to rely on NTFS hardlinks, another solution is provided for handling numbered library filenames within Visual Studio Projects. To use it, set your Project’s Configuration Properties | C/C++ | General | Inherited Property Sheets to:


This lets you use the provided *_VERSION user macros when specifying the libraries you want to link with.

For example, to link with the liblept DLL you should now set Configuration Properties | Linker | Input | Additional Dependencies to:


And to link with the static Release version of liblept use these:


You can view the user macros defined in leptonica_versionnumbers.vsprops by opening the View ‣ Other Windows ‣ Property Manager and looking at the Common Properties | User Macros page.

If you copy this file to a known location, reference it in your own Projects, and use the new *_VERSION macros when specifying linker dependencies, you will be isolated from worrying about version number changes in library filenames. After that, you can use the Property Manager (or a text editor since it’s a simple XML file) to fix any version number updates by changing this one file.