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.1.tar.gz (92.0 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.1-cp314-cp314t-win_amd64.whl (89.9 kB view details)

Uploaded CPython 3.14tWindows x86-64

scanlib-1.3.1-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (248.1 kB view details)

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

scanlib-1.3.1-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (245.4 kB view details)

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

scanlib-1.3.1-cp314-cp314t-macosx_10_15_universal2.whl (95.4 kB view details)

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

scanlib-1.3.1-cp39-abi3-win_amd64.whl (89.3 kB view details)

Uploaded CPython 3.9+Windows x86-64

scanlib-1.3.1-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (241.1 kB view details)

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

scanlib-1.3.1-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (238.1 kB view details)

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

scanlib-1.3.1-cp39-abi3-macosx_10_9_universal2.whl (94.6 kB view details)

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

File details

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

File metadata

  • Download URL: scanlib-1.3.1.tar.gz
  • Upload date:
  • Size: 92.0 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.1.tar.gz
Algorithm Hash digest
SHA256 e0980c22152e3226a9a6dc7ccf75e6011cd47050c6d2cee316f1d7adf85a7af1
MD5 0b22466cc778abb0b47eb98b07534975
BLAKE2b-256 557bd552fbbfcd9eb33d99e4416a59fefdfa3b7a9c628777e00dd4318b391b4e

See more details on using hashes here.

Provenance

The following attestation bundles were made for scanlib-1.3.1.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.1-cp314-cp314t-win_amd64.whl.

File metadata

  • Download URL: scanlib-1.3.1-cp314-cp314t-win_amd64.whl
  • Upload date:
  • Size: 89.9 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.1-cp314-cp314t-win_amd64.whl
Algorithm Hash digest
SHA256 dc82e83b848500b642f860dbaad8831d56f00410cc94a841dbfbcec4e0815ad6
MD5 31681cfe71151d7bdbc816c10fee4e33
BLAKE2b-256 e589907e9ea5821922c3eacd927e63446e001fd976f98f3ff5ded5d6ce143eff

See more details on using hashes here.

Provenance

The following attestation bundles were made for scanlib-1.3.1-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.1-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.1-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7b40ac44bc76f363ef7156ae6259c6c9a7360a2d92beb2b65d09966ef640928b
MD5 7e53d763bb595e3599457885c6731c51
BLAKE2b-256 2fdc1f0ccc87716dd19a3a3c8d38ea6db1e552e05d561dcaa48b1f4cf778d249

See more details on using hashes here.

Provenance

The following attestation bundles were made for scanlib-1.3.1-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.1-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for scanlib-1.3.1-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 a31af36a34408733fc2c8126a12664d05475155655d2e22f605f5381d8603437
MD5 8e89cd4de131d87cfa2d06ce0eeda5fd
BLAKE2b-256 9dfb3f8d8092f8b983335bb40ad3231e0397036b8fa2a0f8f4490b1a77c92495

See more details on using hashes here.

Provenance

The following attestation bundles were made for scanlib-1.3.1-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.1-cp314-cp314t-macosx_10_15_universal2.whl.

File metadata

File hashes

Hashes for scanlib-1.3.1-cp314-cp314t-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 f6b1a5485ced65e41b99efd5add8ac200782e2f776f2c6d2b9795b875ca0564a
MD5 877832455bbda9e3993f112939f30f30
BLAKE2b-256 b3914fcc6d1ee934a3f72decd8ba6c558b494c999839211905f9abd1af2e3aa8

See more details on using hashes here.

Provenance

The following attestation bundles were made for scanlib-1.3.1-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.1-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: scanlib-1.3.1-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 89.3 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.1-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 a34e965fd56c389c921bb5f2a7ec6c9653a890a73e61cf80b6b114d01b44ae1b
MD5 c706224b933394958528917f4f57f11e
BLAKE2b-256 5c3a637e727931db8c74a50c59d5d1330dee21b0e1f558282c618856a84b66f2

See more details on using hashes here.

Provenance

The following attestation bundles were made for scanlib-1.3.1-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.1-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.1-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1c3885df45726004c2b42d872f35880db373bc66e522824a7d6a91c2efb2f9c6
MD5 bf17bf43955c2a2e8702deb9ee13ff0b
BLAKE2b-256 7cc75dd39b58aba352fffb9c854e021cb2c218f7ae05db8e3421bb47a0d26ba5

See more details on using hashes here.

Provenance

The following attestation bundles were made for scanlib-1.3.1-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.1-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for scanlib-1.3.1-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 b0afed83bb35adbc7d412d77116ac5c743d7afbd712206647cce4f0a5ebe71a0
MD5 afcfb96abf3fab3260464fc2bdc448b0
BLAKE2b-256 0611f4d628f4e2e0d6a71722bfa36a728427388d44a46c3c5828b42d9d1e1571

See more details on using hashes here.

Provenance

The following attestation bundles were made for scanlib-1.3.1-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.1-cp39-abi3-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for scanlib-1.3.1-cp39-abi3-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 9f3b51d0e2b340b25d44f7f103c25baf3b79ee9bf8e5ed27a2e2abbf49ecdc59
MD5 4a492d782c276a46f72061c3bcf092ab
BLAKE2b-256 af00a373d2f19674fca02cdbfccabc2e1ad14b6d0e506c88f99a1de74eb90680

See more details on using hashes here.

Provenance

The following attestation bundles were made for scanlib-1.3.1-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