Skip to content
aalleviPublic

About

scancut + Scan Studio: cut scanned drawings out of flatbed scans as transparent PNGs, real edges only. A macOS app to check and fix every edge, drive the scanner (SANE, 48-bit), and use SAM 3 / Apple Vision. Beta.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

scancut · Scan Studio

Cuts scanned drawings out of flatbed scans, one transparent PNG per sheet, and gives you a window to check and fix every edge.
Beta 0.11 · macOS

Scan Studio editor: two drawings on grid paper found on one scan, each outlined as its own part

▶ One-minute video tour (MP4)

I scan lots of drawings and sketchbook pages and wanted the paper out of the scan with its real edge: fibres, tears and punch holes included, nothing painted in. scancut does that automatically for every scan that lands in a folder. Scan Studio is the window around it: you can see what was cut, fix it by hand or with an AI model, and drive the scanner.

Features

  • Automatic cutting: drop scans in ~/Scans/inbox; each sheet comes out as its own transparent PNG, straightened, with punch holes made transparent. Several sheets on one scan are split apart.

  • Only real pixels: cutouts change transparency only. Originals are never touched, cutouts never overwritten (a changed one gets (2)).

  • Editor: points, polygon, rectangle, lasso, brush and a Photoshop-style Magic Wand (new, add, subtract, intersect), with history. It also has a densitometer, a loupe and a histogram.

  • Engines: the classic lid-colour cut, Otsu threshold, exact paper formats from a corner, Apple Vision, Meta SAM 3 (optional) and your own Python scripts.

  • Library: every scan, part, cut and text lives in one catalog (Library.DocuLib, SQLite) with checksums, history and snapshots, browsed like Eagle: sources and cuts by series and place, no folder tree. Each part's characteristics are stored once: change the outline, rotation, name or text anywhere and its cut and every view follow. Move files in… puts originals and cuts inside the library as lossless JPEG XL (same pixels, checked; about 40% of a TIFF). To cut lists the sources still waiting, and ⌘J opens the next one.

    Library › Sources: the scans of a few series, each with its cuts; the selected one on the right with its place, archive status and files

  • Objects: parts that are the same piece of paper (front and back, a double page, a drawing scanned in two goes) are joined as one object, without copying anything. Among the cuts it is one tile; opened, its sides are shown one after the other or side by side.

    Library › Cuts: each cut with its source; the front and back of the same drawing are one tile

    An object: front and back of the same sheet, side by side; the face drawn on one side shows through on the other

  • Text: Apple Vision or a local model (GLM-OCR, Qwen3-VL, LightOnOCR) reads the parts; the text stays editable, with versions, and is written into each cut's metadata. The reader's whole output is kept, and the side-by-side view puts each line where it is on the page.

    A typewritten page (Olivetti Studio 44) read by Unlimited-OCR: the page, the text placed side by side, and the editable text

  • Scanning: scan areas, 48-bit colour, page-by-page sessions (Space or a timer) through SANE; each page is filed into the library at once.

  • Cut: PNG or lossless JPEG XL, 16-bit kept, true size (dpi) and colour profile carried over, text in the metadata, lossless 90° rotation (from any thumbnail's menu, in the background), multipage TIFF or PDF, optional Eagle import.

  • Batch: detect, cut, read, turn or join many sources at once; jobs run in the background, the thumbnail being worked on spins and the ones waiting show a clock.

Install

You need macOS 13 or later, the Xcode command-line tools (xcode-select --install) and Python 3.10 or later (brew install python). Apple silicon is recommended for SAM 3.

git clone https://github.com/aallevi/scancut.git
cd scancut
./install.sh --agent --tools
Option What it does
(none) Python environment in .venv, Apple Vision helpers, Scan Studio in ~/Applications
--agent Also cut every scan that lands in ~/Scans/inbox (a LaunchAgent, runs in the background)
--tools Also the Homebrew tools: SANE scanner driver, ExifTool, JPEG XL
--root DIR Use another scans folder instead of ~/Scans
--python PATH Use an existing Python that has numpy, OpenCV, Pillow and tifffile

Run it again after git pull. Everything optional can also be added later from the app, under Studio › Add-ons.

SAM 3 (optional)

Add-ons installs Ultralytics with one click. The model itself (3.5 GB) is licence-gated by Meta: request access on huggingface.co/facebook/sam3. Once access is granted, paste a read token in Add-ons and download. You can also download sam3.pt yourself and leave it in ~/Downloads; it is found there.

Studio › Add-ons: optional tools, SAM 3 and background-removal models, each with its install line

Usage

  1. Scan into ~/Scans/inbox: with Image Capture, your scanner's own app, or from the Scanners page. Grey card behind white paper gives the cleanest edges.
  2. The agent files each scan in originals/<series>/ and writes the cuts to cut/<series>/ (inside Library.DocuLib once the files are moved in). Scans it is unsure about also appear under To check.
  3. In Scan Studio, open a scan to see its parts. Press Detect to try another engine, fix edges with the tools on the left, and Cut (⌘S). From then on the cuts follow their parts.
  4. Library shows sources, cuts and texts; Check proves every file and cut is where the catalog says and unchanged.

The series is the file name without its final number: sketchbook 12.png goes to sketchbook/.

Shortcut
V · H (or Space) · A select · pan · edit points
P · M · L · W · B polygon · rectangle · lasso · Magic Wand · brush
X, or ⌥ while clicking swap add / cut
⌘-click · ⇧-click · ⌃-click add a part · add a range · cut only this part
O · G · C cut view · loupe · compare engines
⌘Z · ⇧⌘Z · ⌘S · ⌘0 · ⌘1 undo · redo · cut · fit · actual pixels

Magic Wand on pink paper: Add, Subtract or Intersect with a tolerance, the engines on the right

From a terminal, without the window:

.venv/bin/python3 -I studio.py detect originals/sketchbook --engine classic --export
.venv/bin/python3 -I scancut.py ~/Scans        # one run of the agent by hand

More

  • STUDIO.md: engines, how edits are stored, the local API, testing.
  • docs/LIBRARY.md: the library: what it stores, the one-source rule, files inside.
  • docs/DATABASE.md: the database map: tables, parts as items, texts, the archive (Directus) alignment.
  • CLAUDE.md: how the automatic cut works, step by step, and the rules it keeps.

Licence

MIT, see LICENSE. Optional parts keep their own licences and are installed by you, never bundled: Ultralytics (AGPL-3.0), SAM 3 (Meta's SAM licence), SANE, ExifTool, libjxl.

About

scancut + Scan Studio: cut scanned drawings out of flatbed scans as transparent PNGs, real edges only. A macOS app to check and fix every edge, drive the scanner (SANE, 48-bit), and use SAM 3 / Apple Vision. Beta.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages