sys leptonica-sys

FFI bindings for Leptonica

15 releases

0.4.5 Apr 14, 2023
0.4.4 Feb 26, 2023
0.4.3 Jan 15, 2023
0.4.2 Sep 18, 2022
0.2.1 Jul 6, 2019

#549 in Images

Download history 364/week @ 2023-02-02 154/week @ 2023-02-09 367/week @ 2023-02-16 379/week @ 2023-02-23 579/week @ 2023-03-02 720/week @ 2023-03-09 361/week @ 2023-03-16 259/week @ 2023-03-23 273/week @ 2023-03-30 246/week @ 2023-04-06 257/week @ 2023-04-13 178/week @ 2023-04-20 319/week @ 2023-04-27 301/week @ 2023-05-04 334/week @ 2023-05-11 312/week @ 2023-05-18

1,295 downloads per month
Used in 10 crates (3 directly)

MIT license

92 lines


Rust FFI bindings to Leptonica.

Types and functions generated from the functions listed in allheaders.h.

Help wanted

Windows and Mac maintainers wanted.


This links to the C library Leptonica.

On Fedora 30 the build dependencies can be installed by running:

sudo dnf install leptonica-devel clang

On Termux 2019 (Android, Android on Chromebooks) the additional dependencies can be installed by running:

pkg install libclang leptonica-dev

Building on Windows

On Windows, this library uses Microsoft's vcpkg to provide leptonica.

Please install vcpkg and set up user wide integration or vcpkg crate won't be able to find the library. By default vcpkg installs 32 bit libraries. If you need 64 bit libraries then set following environment variable


To install leptonica

REM from the vcpkg directory
.\vcpkg install leptonica

vcpkg allows building either dynamically or statically linked application

if you prefer dynamic linking


for statically linked libraries

SET RUSTFLAGS=-Ctarget-feature=+crt-static

If you prefer to compile tesseract yourself (Because, for example, you could not get vcpkg to build using clang-cl.exe), you can set these environment variables: LEPTONICA_INCLUDE_PATH, LEPTONICA_LINK_PATHS and LEPTONICA_LINK_LIBS.

For example:

set LEPTONICA_INCLUDE_PATH=D:\leptonica\build\include
set LEPTONICA_LINK_PATHS=D:\leptonica\build\lib
set LEPTONICA_LINK_LIBS=leptonica-1.83.0


~33K SLoC