Skip to main content

Cleans photographed documents for improved printing

Project description

print-clean

This script helps prepare photographed documents for printing:

Before:

before before

After:

after after

Installation

Install Python 3.9 or higher, then run:

pip install printclean

or

pip3 install printclean

Usage

printclean <path-to-image> [<path-to-another-image> ...] [--method threshold|gauss_blur] [--level value] [--lang <code1> <code2> ...]

You can provide one or more paths to image files. The script will clean them up and save the results in the same directory.

You can specify the cleanup method using the --method parameter. The available methods are threshold and gauss_blur, with the default being gauss_blur.

If the --method is set to threshold, you can optionally specify the threshold value for cleanup using the --level parameter. The value must be an integer between 0 and 255 (inclusive). Larger values produce images with fewer filled pixels. The default value is 10.

Additionally, you may specify the language(s) of your document using the --lang parameter. This can help the script improve perspective correction for the input image. Note that the script currently supports only simple rotations for perspective correction.

You can find the available languages and their corresponding codes here. Depending on your system, you may need to install the required language files for the Tesseract OCR engine: (Windows, Ubuntu, Mac OS).

The output image will be saved as a PNG file with the suffix -cleaned.

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

printclean-1.1.0.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

printclean-1.1.0-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file printclean-1.1.0.tar.gz.

File metadata

  • Download URL: printclean-1.1.0.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for printclean-1.1.0.tar.gz
Algorithm Hash digest
SHA256 c560d74423d70306d319e7338e731b92db3114cc974340678817cc367aa770a8
MD5 6970ab048ac4c722bbd210d1a3cdc51b
BLAKE2b-256 57b4e8daf103237b3d7f6765850cf6c07e01faf08c0ea89559903d30df668d96

See more details on using hashes here.

File details

Details for the file printclean-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: printclean-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for printclean-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5b478dd7e6736c3381c98640ddcdbb5b66d5053af87457b08a3d01a32a8b4b7d
MD5 f8aa6ef7606b1648071a8b617cb423f9
BLAKE2b-256 ac61b9d0c80b47f58f76e8dd8057443ea7d15c514be2e152972c9c13a1950b73

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