Skip to main content

A multiplatform document scanning library for Python

Project description

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 interfacescanlib 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scanlib-1.3.0.tar.gz (87.9 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

scanlib-1.3.0-cp314-cp314t-win_amd64.whl (85.8 kB view details)

Uploaded CPython 3.14tWindows x86-64

scanlib-1.3.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (243.9 kB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

scanlib-1.3.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (241.2 kB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.17+ ARM64manylinux: glibc 2.28+ ARM64

scanlib-1.3.0-cp314-cp314t-macosx_10_15_universal2.whl (91.2 kB view details)

Uploaded CPython 3.14tmacOS 10.15+ universal2 (ARM64, x86-64)

scanlib-1.3.0-cp39-abi3-win_amd64.whl (85.2 kB view details)

Uploaded CPython 3.9+Windows x86-64

scanlib-1.3.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (237.0 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

scanlib-1.3.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (234.0 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64manylinux: glibc 2.28+ ARM64

scanlib-1.3.0-cp39-abi3-macosx_10_9_universal2.whl (90.5 kB view details)

Uploaded CPython 3.9+macOS 10.9+ universal2 (ARM64, x86-64)

File details

Details for the file scanlib-1.3.0.tar.gz.

File metadata

  • Download URL: scanlib-1.3.0.tar.gz
  • Upload date:
  • Size: 87.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for scanlib-1.3.0.tar.gz
Algorithm Hash digest
SHA256 e7c0bebff6fb5aa7c482a05b0cf34912f3483042374483364b2d975b461b9739
MD5 cc23bcb2bf1bbe9fd15053aea73cbeaa
BLAKE2b-256 56809bf97189c2f648e89e7f638863ae3438838818c5caec66d8ab4efda5677f

See more details on using hashes here.

Provenance

The following attestation bundles were made for scanlib-1.3.0.tar.gz:

Publisher: wheels.yml on amottola/scanlib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file scanlib-1.3.0-cp314-cp314t-win_amd64.whl.

File metadata

  • Download URL: scanlib-1.3.0-cp314-cp314t-win_amd64.whl
  • Upload date:
  • Size: 85.8 kB
  • Tags: CPython 3.14t, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for scanlib-1.3.0-cp314-cp314t-win_amd64.whl
Algorithm Hash digest
SHA256 044dcd6a83f0ba7c009c2532754bc2c010d8a8c289669bdf78b1eeb2b1b24d47
MD5 2342a97b5ce7be2e5376154cf3b70b72
BLAKE2b-256 51915220e0d2d149b6e01059301a21762b9f93bbb7aab56fd5953402d002bf60

See more details on using hashes here.

Provenance

The following attestation bundles were made for scanlib-1.3.0-cp314-cp314t-win_amd64.whl:

Publisher: wheels.yml on amottola/scanlib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file scanlib-1.3.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for scanlib-1.3.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f7a19fea6341397f5be46e5a8263959926edc3463cbcd92ccc43b91826806396
MD5 027534602125ef9c6c2c8d563f8c6072
BLAKE2b-256 ff668b049501c6c6b56c384481d44498e2950ca5617c1b1eec187e128590b139

See more details on using hashes here.

Provenance

The following attestation bundles were made for scanlib-1.3.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: wheels.yml on amottola/scanlib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file scanlib-1.3.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for scanlib-1.3.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 aed8421283d5749b3f9849b3dc2855ac773eb71a4b1986d1f18d315a72c66f78
MD5 7b663e554060215f45f9f3f3677d7265
BLAKE2b-256 0556b8bfaa0318549554adfcab50f1610e95a6317013496b86507f33bdcb88f5

See more details on using hashes here.

Provenance

The following attestation bundles were made for scanlib-1.3.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl:

Publisher: wheels.yml on amottola/scanlib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file scanlib-1.3.0-cp314-cp314t-macosx_10_15_universal2.whl.

File metadata

File hashes

Hashes for scanlib-1.3.0-cp314-cp314t-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 1f498704104b880fd5c765d4061774bf4427f5edaef0190b25d258035c7c3262
MD5 dab35275c9961759847c4b142d4db652
BLAKE2b-256 41854b31a6fe260f93a2fdd002d78de5cba74059109a25833f06ae6b02ba4590

See more details on using hashes here.

Provenance

The following attestation bundles were made for scanlib-1.3.0-cp314-cp314t-macosx_10_15_universal2.whl:

Publisher: wheels.yml on amottola/scanlib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file scanlib-1.3.0-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: scanlib-1.3.0-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 85.2 kB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for scanlib-1.3.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 a68cf5c27175b6e2d2f156ac564fcfe248619e1f9f8106d70ffd6df6af798ec0
MD5 ee1210c51ba0ced208c919c3bf2179e7
BLAKE2b-256 2a5669b78cb2d96ee1a77f037ada0e3627f2a0ccfe3141fad722b08245153649

See more details on using hashes here.

Provenance

The following attestation bundles were made for scanlib-1.3.0-cp39-abi3-win_amd64.whl:

Publisher: wheels.yml on amottola/scanlib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file scanlib-1.3.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for scanlib-1.3.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ead98c4c9c316919876cc2ac2cea79987c62ef6bb9943b8ebb3a4175150de9c8
MD5 2e505a55c7f4f2fa71af8c1f332eec16
BLAKE2b-256 5f8665610c90567e385fca268041825c506b9909ad78581bac241f9e5296b066

See more details on using hashes here.

Provenance

The following attestation bundles were made for scanlib-1.3.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: wheels.yml on amottola/scanlib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file scanlib-1.3.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for scanlib-1.3.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 6272202b966b11befa77456b3a083fdaf5e8ea90c70adc1bb766482c38951236
MD5 7bdd1c2e348974e2df4a3238605bd425
BLAKE2b-256 aa589f47d96f8bb3783f624f07b656b598c7e71d636bc2c077e17547a1d2cc3e

See more details on using hashes here.

Provenance

The following attestation bundles were made for scanlib-1.3.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl:

Publisher: wheels.yml on amottola/scanlib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file scanlib-1.3.0-cp39-abi3-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for scanlib-1.3.0-cp39-abi3-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 460cfecbe87f2561c7bbbd6a503f27d282ce9ba252abdc237d6b20f1e4e07298
MD5 9b67e7195ef237f86af93b7df7ae7154
BLAKE2b-256 f48e0e892025654d80171d896d137a2286b66ded234a2d0c8e95852ffacd9ae7

See more details on using hashes here.

Provenance

The following attestation bundles were made for scanlib-1.3.0-cp39-abi3-macosx_10_9_universal2.whl:

Publisher: wheels.yml on amottola/scanlib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page