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-1.0.0.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

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

fakescan-1.0.0-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for fakescan-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d7269ecaebb2c38f410238dea47e1218ee6c3b57c3240ef71e4d9fc2bf217c43
MD5 983267e6ac65c26449709cb5751a8bf1
BLAKE2b-256 52e872df3022429f30aa2c731b0e994ef64ccd11a193296adbe7f26d9d644490

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for fakescan-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 120164dfdbeb1fb20029498170644a4d68b0451d0ae4d938ce3b9a5f5a595377
MD5 20b5ec72ec2ee87257b80e0ab29d72a2
BLAKE2b-256 3fd300377b819275444ec13e4d50f231e4e8879e7ce30a0893e7f09f716ed1bc

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