A multiplatform document scanning library for Python
Project description
scanlib
A multiplatform document scanning library for Python with platform-native scanning backends and minimal dependencies.
Features
- Cross-platform — unified API across Windows (WIA 2.0), macOS (ImageCaptureCore), and Linux (SANE)
- eSCL / AirScan — direct HTTP scanning of network scanners without OS drivers, enabled automatically on Linux and Windows
- Command-line interface —
scanlib list,scanlib info, andscanlib scanfor quick scanning from the shell - Output to PDF — assemble scanned pages into a PDF and control page encoding (JPEG or PNG)
- Minimal dependencies — no external image or PDF processing libraries; JPEG uses platform-native encoders, PNG uses stdlib
zlib, PDF assembly uses only the standard library - Multi-page scanning — automatic document feeder support and flatbed multi-page with a simple callback
- Page-level control — preview, rotate, reorder, and encode individual pages as JPEG or PNG before assembling the final PDF
- Thread-safe — call from any thread; backend threading is handled internally
- Progress & cancellation — monitor scan progress and abort mid-scan via callback
Backends
| Platform | Backend | Scanner types | eSCL | System packages |
|---|---|---|---|---|
| macOS 10.7+ | ImageCaptureCore | USB + network | Opt-in (SCANLIB_ESCL=1) |
None |
| Windows 10+ | WIA 2.0 | USB | Always enabled | None |
| Linux | SANE | USB | Always enabled | libsane-dev libjpeg-dev |
The eSCL (AirScan) backend discovers and drives network scanners directly over HTTP — no OS-level scanner drivers needed. On Linux and Windows it runs alongside the platform backend automatically. On macOS, ImageCaptureCore already handles network scanners natively; set SCANLIB_ESCL=1 to use the eSCL backend instead.
Installation
pip install scanlib
Python 3.9+. Pre-built wheels available for all major platforms. On Linux, SANE and libjpeg must be installed at the system level:
# Debian / Ubuntu
apt install libsane-dev libjpeg-dev
# Fedora / RHEL
dnf install sane-backends libjpeg-turbo-devel
On macOS and Windows, no additional system packages are required.
Quick Start
Command line
# List available scanners
scanlib list
# Show scanner capabilities
scanlib info -s 0
# Scan to PDF
scanlib scan -o document.pdf --dpi 300 --color-mode gray
# Multi-page flatbed scan with interactive prompting
scanlib scan -o multipage.pdf --pages ask
Python API
import scanlib
scanners = scanlib.list_scanners()
with scanners[0] as scanner:
doc = scanner.scan()
with open("output.pdf", "wb") as f:
f.write(doc.data)
Documentation
Full documentation is available at python-scanlib.readthedocs.io.
About
Created by Angelo Mottola, with the help of Claude Code.
This project was started to fill a void in the Python scanning ecosystem, which I found to be very much fragmented. It is also my first experiment in heavily AI-assisted software development (I still hesitate to use the term "vibe" coding), where I mostly did code review and direction.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file scanlib-1.2.0.tar.gz.
File metadata
- Download URL: scanlib-1.2.0.tar.gz
- Upload date:
- Size: 77.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a6991e1a1aa2c112a30bf14183bf4c43c987c86d2fa55ad961e64e8abc4f51b5
|
|
| MD5 |
2508eadd532971dca2a365ce410307f4
|
|
| BLAKE2b-256 |
491e76cb60e20d778bf17369818e430902cd5dd5b33b6fe074b392b53684fc7d
|
Provenance
The following attestation bundles were made for scanlib-1.2.0.tar.gz:
Publisher:
wheels.yml on amottola/scanlib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scanlib-1.2.0.tar.gz -
Subject digest:
a6991e1a1aa2c112a30bf14183bf4c43c987c86d2fa55ad961e64e8abc4f51b5 - Sigstore transparency entry: 1203528887
- Sigstore integration time:
-
Permalink:
amottola/scanlib@4c338f6d4a70b68018c1f54a832af1011c2c6dac -
Branch / Tag:
refs/tags/v1.2.0 - Owner: https://github.com/amottola
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@4c338f6d4a70b68018c1f54a832af1011c2c6dac -
Trigger Event:
push
-
Statement type:
File details
Details for the file scanlib-1.2.0-cp314-cp314t-win_amd64.whl.
File metadata
- Download URL: scanlib-1.2.0-cp314-cp314t-win_amd64.whl
- Upload date:
- Size: 79.0 kB
- Tags: CPython 3.14t, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c0e34d6ba8fc82540c07d6f5fbad3261c9a7f124a928e38ece6bab2413f7b1a1
|
|
| MD5 |
7077090fa343282a266fc6d038885dfb
|
|
| BLAKE2b-256 |
72732b80350243b3a2a8429ccc25d3e76498e79bdc10e59ef7db3ecb4d5896a7
|
Provenance
The following attestation bundles were made for scanlib-1.2.0-cp314-cp314t-win_amd64.whl:
Publisher:
wheels.yml on amottola/scanlib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scanlib-1.2.0-cp314-cp314t-win_amd64.whl -
Subject digest:
c0e34d6ba8fc82540c07d6f5fbad3261c9a7f124a928e38ece6bab2413f7b1a1 - Sigstore transparency entry: 1203528892
- Sigstore integration time:
-
Permalink:
amottola/scanlib@4c338f6d4a70b68018c1f54a832af1011c2c6dac -
Branch / Tag:
refs/tags/v1.2.0 - Owner: https://github.com/amottola
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@4c338f6d4a70b68018c1f54a832af1011c2c6dac -
Trigger Event:
push
-
Statement type:
File details
Details for the file scanlib-1.2.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: scanlib-1.2.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 236.6 kB
- Tags: CPython 3.14t, manylinux: glibc 2.17+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8bb02ab51c7f97cf6775079de90cedc7e967c1d659e049fd7f1c1a65d520f2cf
|
|
| MD5 |
2c3f5f36ab6c440a747e1ed200cb780d
|
|
| BLAKE2b-256 |
e009d10c8ee2484a1c0e6dcaba3a4b59481255b2e60bcf5985164d580112da46
|
Provenance
The following attestation bundles were made for scanlib-1.2.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:
Publisher:
wheels.yml on amottola/scanlib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scanlib-1.2.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl -
Subject digest:
8bb02ab51c7f97cf6775079de90cedc7e967c1d659e049fd7f1c1a65d520f2cf - Sigstore transparency entry: 1203528900
- Sigstore integration time:
-
Permalink:
amottola/scanlib@4c338f6d4a70b68018c1f54a832af1011c2c6dac -
Branch / Tag:
refs/tags/v1.2.0 - Owner: https://github.com/amottola
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@4c338f6d4a70b68018c1f54a832af1011c2c6dac -
Trigger Event:
push
-
Statement type:
File details
Details for the file scanlib-1.2.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.
File metadata
- Download URL: scanlib-1.2.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
- Upload date:
- Size: 233.9 kB
- Tags: CPython 3.14t, manylinux: glibc 2.17+ ARM64, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5cd659b35215eafdf8a049362adcc8f3131b3cd413f30b66197dcc545429223c
|
|
| MD5 |
3282089a37fc0f38b1d72e65fcb88464
|
|
| BLAKE2b-256 |
0bbdc0ef3874343bef9518912da625bb3c941ac5bed153d8788f296f8f734bab
|
Provenance
The following attestation bundles were made for scanlib-1.2.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl:
Publisher:
wheels.yml on amottola/scanlib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scanlib-1.2.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl -
Subject digest:
5cd659b35215eafdf8a049362adcc8f3131b3cd413f30b66197dcc545429223c - Sigstore transparency entry: 1203528909
- Sigstore integration time:
-
Permalink:
amottola/scanlib@4c338f6d4a70b68018c1f54a832af1011c2c6dac -
Branch / Tag:
refs/tags/v1.2.0 - Owner: https://github.com/amottola
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@4c338f6d4a70b68018c1f54a832af1011c2c6dac -
Trigger Event:
push
-
Statement type:
File details
Details for the file scanlib-1.2.0-cp314-cp314t-macosx_10_15_universal2.whl.
File metadata
- Download URL: scanlib-1.2.0-cp314-cp314t-macosx_10_15_universal2.whl
- Upload date:
- Size: 84.0 kB
- Tags: CPython 3.14t, macOS 10.15+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
77989faf9305a1bf0736ea318a1891c9edafe7af3b77d911f3363dcdade4e4eb
|
|
| MD5 |
6ff08fccf3bf3463658621c4a9765d7c
|
|
| BLAKE2b-256 |
49ea1111c1cbd0b5d496d620348ae1736cf75bb3ff2a84744fecebb6346e17ee
|
Provenance
The following attestation bundles were made for scanlib-1.2.0-cp314-cp314t-macosx_10_15_universal2.whl:
Publisher:
wheels.yml on amottola/scanlib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scanlib-1.2.0-cp314-cp314t-macosx_10_15_universal2.whl -
Subject digest:
77989faf9305a1bf0736ea318a1891c9edafe7af3b77d911f3363dcdade4e4eb - Sigstore transparency entry: 1203528904
- Sigstore integration time:
-
Permalink:
amottola/scanlib@4c338f6d4a70b68018c1f54a832af1011c2c6dac -
Branch / Tag:
refs/tags/v1.2.0 - Owner: https://github.com/amottola
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@4c338f6d4a70b68018c1f54a832af1011c2c6dac -
Trigger Event:
push
-
Statement type:
File details
Details for the file scanlib-1.2.0-cp39-abi3-win_amd64.whl.
File metadata
- Download URL: scanlib-1.2.0-cp39-abi3-win_amd64.whl
- Upload date:
- Size: 78.3 kB
- Tags: CPython 3.9+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
04deed5106af2718dc73c87e54c5fc54620987d869ea13f49c63996aa3f3e6e7
|
|
| MD5 |
785d68f549b8ff7776e4cf75908534cf
|
|
| BLAKE2b-256 |
c8ebbe04985d643c331f4fcab21843f32f7c7a3d876a6cb61f998c3ac8393325
|
Provenance
The following attestation bundles were made for scanlib-1.2.0-cp39-abi3-win_amd64.whl:
Publisher:
wheels.yml on amottola/scanlib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scanlib-1.2.0-cp39-abi3-win_amd64.whl -
Subject digest:
04deed5106af2718dc73c87e54c5fc54620987d869ea13f49c63996aa3f3e6e7 - Sigstore transparency entry: 1203528928
- Sigstore integration time:
-
Permalink:
amottola/scanlib@4c338f6d4a70b68018c1f54a832af1011c2c6dac -
Branch / Tag:
refs/tags/v1.2.0 - Owner: https://github.com/amottola
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@4c338f6d4a70b68018c1f54a832af1011c2c6dac -
Trigger Event:
push
-
Statement type:
File details
Details for the file scanlib-1.2.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: scanlib-1.2.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 229.7 kB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
794ea9112a5c73f7ee17239d194bc5b7e9c041cd06bb705874fda1608ada4763
|
|
| MD5 |
cfc7899d80982618a6b1dd62885fedbd
|
|
| BLAKE2b-256 |
be94b55a188e4bc7374d91b7dd434c8e3872f70a39710eb46222494fb9c3472f
|
Provenance
The following attestation bundles were made for scanlib-1.2.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:
Publisher:
wheels.yml on amottola/scanlib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scanlib-1.2.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl -
Subject digest:
794ea9112a5c73f7ee17239d194bc5b7e9c041cd06bb705874fda1608ada4763 - Sigstore transparency entry: 1203528923
- Sigstore integration time:
-
Permalink:
amottola/scanlib@4c338f6d4a70b68018c1f54a832af1011c2c6dac -
Branch / Tag:
refs/tags/v1.2.0 - Owner: https://github.com/amottola
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@4c338f6d4a70b68018c1f54a832af1011c2c6dac -
Trigger Event:
push
-
Statement type:
File details
Details for the file scanlib-1.2.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.
File metadata
- Download URL: scanlib-1.2.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
- Upload date:
- Size: 226.7 kB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ ARM64, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d886574f83364452a77b91dba9011daed37af484379bd2ed478b6dff4ae9ca2b
|
|
| MD5 |
bd44ca76703d910fd2d7c6de5c13404f
|
|
| BLAKE2b-256 |
77b10150d3fe15d318db39a0072cfef37ef3c89e019a61e8e439fd353c90bea7
|
Provenance
The following attestation bundles were made for scanlib-1.2.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl:
Publisher:
wheels.yml on amottola/scanlib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scanlib-1.2.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl -
Subject digest:
d886574f83364452a77b91dba9011daed37af484379bd2ed478b6dff4ae9ca2b - Sigstore transparency entry: 1203528889
- Sigstore integration time:
-
Permalink:
amottola/scanlib@4c338f6d4a70b68018c1f54a832af1011c2c6dac -
Branch / Tag:
refs/tags/v1.2.0 - Owner: https://github.com/amottola
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@4c338f6d4a70b68018c1f54a832af1011c2c6dac -
Trigger Event:
push
-
Statement type:
File details
Details for the file scanlib-1.2.0-cp39-abi3-macosx_10_9_universal2.whl.
File metadata
- Download URL: scanlib-1.2.0-cp39-abi3-macosx_10_9_universal2.whl
- Upload date:
- Size: 83.2 kB
- Tags: CPython 3.9+, macOS 10.9+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
63dabc18a11f45dde1267fdb9e628b2b25623072feaa4f22a8b1c1639a94713b
|
|
| MD5 |
600bcc453e7f82b339c716ee755293dc
|
|
| BLAKE2b-256 |
fe4c06acadccc1c3f20d1625eb08613566671bf7f514db3709dec1d576ba3dff
|
Provenance
The following attestation bundles were made for scanlib-1.2.0-cp39-abi3-macosx_10_9_universal2.whl:
Publisher:
wheels.yml on amottola/scanlib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scanlib-1.2.0-cp39-abi3-macosx_10_9_universal2.whl -
Subject digest:
63dabc18a11f45dde1267fdb9e628b2b25623072feaa4f22a8b1c1639a94713b - Sigstore transparency entry: 1203528915
- Sigstore integration time:
-
Permalink:
amottola/scanlib@4c338f6d4a70b68018c1f54a832af1011c2c6dac -
Branch / Tag:
refs/tags/v1.2.0 - Owner: https://github.com/amottola
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@4c338f6d4a70b68018c1f54a832af1011c2c6dac -
Trigger Event:
push
-
Statement type: