Skip to main content

scanlib

Tests Build & Publish Documentation

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, and scanlib scan for 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 + network 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, and a network scanner found by both is reported once (matched by device UUID or IP), preferring the platform driver. On macOS, ImageCaptureCore already handles network scanners natively, so eSCL is opt-in. Set SCANLIB_ESCL=1 to enable eSCL on macOS, or — on any platform — to prefer the eSCL driver over the platform driver for scanners seen by both.

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

Metadata

Release files for scanlib 1.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for scanlib 1.3.2
File Size Uploaded
scanlib-1.3.2.tar.gz 95.1 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for scanlib 1.3.2
File
scanlib-1.3.2-cp314-cp314t-win_amd64.whl CPython 3.14 CPython 3.14 free-threading Windows x86-64 Details
scanlib-1.3.2-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 free-threading Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details
scanlib-1.3.2-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl CPython 3.14 CPython 3.14 free-threading Linux glibc 2.28+ ARM64, Linux glibc 2.17+ ARM64 Details
scanlib-1.3.2-cp314-cp314t-macosx_10_15_universal2.whl CPython 3.14 CPython 3.14 free-threading macOS 10.15+ universal2 (ARM64, x86-64) Details
scanlib-1.3.2-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details
scanlib-1.3.2-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details
scanlib-1.3.2-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64, Linux glibc 2.28+ ARM64 Details
scanlib-1.3.2-cp39-abi3-macosx_10_9_universal2.whl CPython 3.9 abi3 macOS 10.9+ universal2 (ARM64, x86-64) Details

Total release size: 1.5 MB

Release files / scanlib-1.3.2.tar.gz

Download URL scanlib-1.3.2.tar.gz
Size 95.1 kB
Tags Source
SHA-256 checksum
How to use checksums
26fcab41dd3ab16362e32ed793ce90690369545a99d5b64a25bcf909d6e027e7
BLAKE2b-256 checksum
How to use checksums
926cb23d6ade6aa405c3aff130e0558acd65eb6789b1d2a7e2a9e37daa204774
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.

Transparency log

Release files / scanlib-1.3.2-cp314-cp314t-win_amd64.whl

Download URL scanlib-1.3.2-cp314-cp314t-win_amd64.whl
Size 92.9 kB
Tags CPython 3.14 CPython 3.14 free-threading Windows x86-64
SHA-256 checksum
How to use checksums
9d6e7c16055e4c66f27f99c186bb9be71ec401b3f7856032019d2b6fd91d9239
BLAKE2b-256 checksum
How to use checksums
53e88cf8926558f85102b0bb1931eb2aaddee8f3896a3bbbbca88c3cdbfbd4f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.

Transparency log

Release files / scanlib-1.3.2-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL scanlib-1.3.2-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 251.0 kB
Tags CPython 3.14 CPython 3.14 free-threading Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
c5ded6fd967aa85aede4da9cc1f796019968defb4b6f432b64c92aef26c45f30
BLAKE2b-256 checksum
How to use checksums
99c9703536bfba068e71646864b0df278d3265b4409c725be077bc9dfb226d0e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.

Transparency log

Release files / scanlib-1.3.2-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl

Download URL scanlib-1.3.2-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Size 248.3 kB
Tags CPython 3.14 CPython 3.14 free-threading Linux glibc 2.17+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
9d3da0de15d03d68f9607c09691aa2bd3f2872be64d6dcf354b308f99032a16f
BLAKE2b-256 checksum
How to use checksums
7560ce87990c0de5c58b8e3e0c6942d981b6a535f92043af7ea84b84d03edd82
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.

Transparency log

Release files / scanlib-1.3.2-cp314-cp314t-macosx_10_15_universal2.whl

Download URL scanlib-1.3.2-cp314-cp314t-macosx_10_15_universal2.whl
Size 98.0 kB
Tags CPython 3.14 CPython 3.14 free-threading macOS 10.15+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
fee9c10f7a56b950f2fe3a2cd8ce74012c45f7649fa76e8ff1a53f86ae1f665c
BLAKE2b-256 checksum
How to use checksums
0ed79d3abf6a96aac65180e0f0715a94e4ef6eaf86b586c602849747142c9f6b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.

Transparency log

Release files / scanlib-1.3.2-cp39-abi3-win_amd64.whl

Download URL scanlib-1.3.2-cp39-abi3-win_amd64.whl
Size 92.2 kB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
8fdf8c748bd46e6be22563dfa5a43101ab259e94103673f6a4960fbd56610815
BLAKE2b-256 checksum
How to use checksums
7791f8e037fa160960015dfcf822b340aa05622c16c636a2595fa539a4e59380
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.

Transparency log

Release files / scanlib-1.3.2-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL scanlib-1.3.2-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 244.1 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
f8bd8587fd11816c62978c6fac3e137e4c4fada9f2124d6e5b8552281cd46eed
BLAKE2b-256 checksum
How to use checksums
27bb4e017ebe460acd1101175a93b3ff7b169a780fe965ab5666a0c6ce5c5d32
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.

Transparency log

Release files / scanlib-1.3.2-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl

Download URL scanlib-1.3.2-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Size 241.1 kB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
fa1b65f17a99e1c76415f0677c43c0fe361c60cfa6e6a617dbb9d2a502fd7cac
BLAKE2b-256 checksum
How to use checksums
8f3a5fe3821a3e5fe3efcbacd51c4454623f8e390b1e447fc98ef798053c22c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.

Transparency log

Release files / scanlib-1.3.2-cp39-abi3-macosx_10_9_universal2.whl

Download URL scanlib-1.3.2-cp39-abi3-macosx_10_9_universal2.whl
Size 97.9 kB
Tags CPython 3.9 abi3 macOS 10.9+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
b3020249f165e8a030cd227330e722b9b43d3900d1eb67b51600da3d0910f83e
BLAKE2b-256 checksum
How to use checksums
fea73ade36709fc12e6557b83a6ea3e00e2ee0785acccde43445497269f48283
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.3.2 This release

9 release files

1.3.1

9 release files

1.3.0

9 release files

1.2.0

9 release files

1.1.0

9 release files

1.0.0

9 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page