Skip to main content

Make a PDF look like it was printed and scanned

Project description

fakescan

Make a PDF look like it was printed on paper and scanned back.

Effects

  • Random per-page rotation (misaligned paper feed)
  • Vignette / corner darkening (scanner lamp falloff)
  • Gaussian noise (sensor grain)
  • Warm paper tint (cream/yellowish whites)
  • Uneven left-right illumination (scanner lamp gradient)
  • Slight blur (halftone + scanner softness)
  • Subtle contrast and sharpness reduction

Requirements

System dependency (provides pdftoppm):

# macOS
brew install poppler

# Ubuntu / Debian
sudo apt install poppler-utils

Installation

pip install fakescan

Usage

CLI

fakescan input.pdf                      # writes input_scanned.pdf
fakescan input.pdf output.pdf           # custom output name
fakescan input.pdf --dpi 150            # lower DPI = smaller file
fakescan input.pdf output.pdf --dpi 300 # high quality

Python API

from fakescan import make_printed_pdf

make_printed_pdf("input.pdf", "output.pdf", dpi=200)

Or apply effects to a single PIL image:

from PIL import Image
from fakescan import apply_printed_effect

img = Image.open("page.png")
scanned = apply_printed_effect(img, page_index=0)
scanned.save("page_scanned.png")

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

fakescan-0.1.0.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

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

fakescan-0.1.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file fakescan-0.1.0.tar.gz.

File metadata

  • Download URL: fakescan-0.1.0.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for fakescan-0.1.0.tar.gz
Algorithm Hash digest
SHA256 88c4c6bf4daea91d3a122aed24e0c5c597a9fc1fc46f15ff2fdceea6767efd5a
MD5 61209ef3089140f4bfc274ff5218006f
BLAKE2b-256 e701b49adac941391ddc434d2c5dedbb5c9c230e0c596d59c5b471dd894668ae

See more details on using hashes here.

File details

Details for the file fakescan-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: fakescan-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for fakescan-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 327d67abc322f876ebc65fa3fd9a571b7caa6e721d7cb3821df727e479611809
MD5 00b1070595c78cbbbef3b12f0cf29847
BLAKE2b-256 844c1743ccf36c1732741c02d866520b21ddf049a2f1ac3b4d22ec2ad495d069

See more details on using hashes here.

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