Skip to main content

wia_scan 0.5.0

Project description

wia_scan

wia_scan

A simple utility for using document scanners that support Windows Image Acquisition (WIA) and is easy to install. If your scanner works using Windows Fax and Scan, there is a good chance it will work with this python script. This package allows you to create your own efficient scanning loop, or use the one the one already provided.

Use cases:

  • You have a flatbed scanner and you need to scan a lot of documents, thus you don't want to use Windows Fax and Scan tool as it can introduce quite some overhead. This utility allows you to only press a few keystrokes inbetween scans, while you may need to turn the page or change the paper since you don't have an automatic feeding scanner like I don't.
  • Support scanners in your own application on Windows using a simple Python dependency

Alternatives: Existing WIA libraries, but to my surprise the ones I found required quite old versions of Python, which I didn't want since I wanted to combine the scanning process with some modern Python packages.

Installation

pip install wia_scan

Alternative: From Source

Download this source and install flit uisng pip install flit and run the following command from the source folder

flit install

Usage

Command Line Interface

wia_scan <version>

Usage:
  wia_scan list_devices [-v]
  wia_scan single_side [--file=<output_file>] [--dpi=<dpi>] [--brightness=<brightness>] [--contrast=<contrast>] [--mode=<mode>] [-v] [--uid=<uid>] [-q]
  wia_scan many_flatbed [--out=<output_folder>] [-v]
  wia_scan --help

Options:
  -h --help                    Show this screen.
  --version                    Show version.
  -v --verbose                 Verbose output
  -q --quiet                   Quiet=no output
  --dpi=<dpi>                  Dots per inch; the higher this setting the higher the output resolution
  --brightness=<brightness>    Brightness setting for the scanner, goes from -1000 to 1000
  --contrast=<contrast>        Contrast setting for the scanner, goes from -1000 to 1000
  --mode=<mode>                RGB for colored or L for grayscale
  --file=<output_file>         Image output file
  --out=<output_folder>        Sanned images output folder

Library Usage - Custom Loop

Example: Scan many single sided documents from the same scanner while waiting for a single key press between scans:

from wia_scan import *

device = prompt_choose_device_and_connect()
for i in range(1000000):
    press_any_key_to_continue()
    pillow_image = scan_side(device=device, scan_profile=DEFAULT_SCAN_PROFILE)
	filename = f'{i}.jpeg'
    pillow_image.save(filename, subsampling=0, optimize=True,
					   progressive=True, quality=80)

License

wia_scan is distributed under the terms of the MIT license.

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

wia_scan-0.5.0.tar.gz (30.4 kB view details)

Uploaded Source

Built Distribution

wia_scan-0.5.0-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file wia_scan-0.5.0.tar.gz.

File metadata

  • Download URL: wia_scan-0.5.0.tar.gz
  • Upload date:
  • Size: 30.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.28.1

File hashes

Hashes for wia_scan-0.5.0.tar.gz
Algorithm Hash digest
SHA256 ad4eba4f8eb50b273a48a080e8f1d5252ff13b240e2eca8b8dfdd01f23563ffb
MD5 302435bf820b2cc4bfa8ee17e605107c
BLAKE2b-256 f1383fecac42db111a4c46031353db1e0cf41532cfbdfcae261b5e04f3aea37d

See more details on using hashes here.

File details

Details for the file wia_scan-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: wia_scan-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.28.1

File hashes

Hashes for wia_scan-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b469c339037e39c5bf16a1c1ffe78b5a409d483a7ddb7d9a21620acee4e294a5
MD5 42eb0bc81e62fd50c83729cec4997334
BLAKE2b-256 97a7fa6a94cd79c32191623b074c181bcccc14c42f115125ec256d3aa412585e

See more details on using hashes here.

Supported by

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