Skip to content

fNBU/slidify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

slidify

Turn photos of handwritten slides into a clean black-on-white 16:9 PDF.

Per image: auto-rotate upright, crop to 16:9 around the ink (keeps all text in frame, including anything past the four corner guide-dots), posterize to black text on white, then assemble a multi-page PDF in the order the files are given.

Usage

uv run slidify.py *.jpeg -o slides.pdf

Dependencies (numpy, pillow, scipy) are declared in a PEP 723 header at the top of slidify.py, so uv run installs them automatically — nothing to set up, nothing installed system-wide.

Images are processed in the order listed on the command line. A shell glob sorts lexically, which matches the signal-...jpeg, signal-..._002.jpeg, ... numbering. To control order, list files explicitly.

Options

  • -o, --output — output PDF path (default slides.pdf).
  • --png-dir DIR — also write per-slide PNGs into DIR.
  • --rotate DEG — force a fixed rotation (degrees CCW) instead of auto.
  • --ink-threshold N — how much darker than local paper counts as ink (default 26). Lower if faint pencil is dropped; raise if paper noise shows.
  • --margin F — breathing room around the ink as a fraction (default 0.06).
  • --dpi N — PDF resolution (default 200).

How it works

  1. Rotate. Portrait photos are rotated 90° CCW to landscape; already- landscape images are left alone. Override with --rotate.
  2. Crop to 16:9. The ink bounding box (all handwriting + the corner dots) is found, given a margin, expanded to exactly 16:9, and clamped inside the image. Driving the crop from the ink extent guarantees no text is cut off.
  3. Posterize. The paper background is estimated with a large Gaussian blur and subtracted, cancelling uneven lighting; the remaining darkness is ramped so ink goes black and paper goes white.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages