- Remove 257 redundant per-definition comment stubs across the package - Drop dead nonlocal declarations in autoslicer_detection.py - Document the swapped flag and swap_left_right in architecture docs - Remove unsupported 'legacy override' claims from autotune/runtime docs |
||
|---|---|---|
| docs | ||
| packaging/appimage | ||
| scanslicer | ||
| .dockerignore | ||
| .env.example | ||
| .gitignore | ||
| AGENTS.md | ||
| docker-compose.yml | ||
| Dockerfile | ||
| LICENSE | ||
| pyproject.toml | ||
| README.md | ||
| setup.py | ||
| THIRD_PARTY_NOTICES | ||
| uv.lock | ||
ScanSlicer
ScanSlicer is a desktop Qt application for extracting multiple photos from a flatbed scan image. It detects photo regions, lets you correct boxes manually, then saves perspective-corrected crops.
Inspired by PhotoSlicer by Francesco Vannini.
This repository keeps GNU GPL v3 licensing for compatibility with that upstream work.
What It Does
- Detects photo boxes from
.png,.jpg, and.jpegsource images. - Supports threshold-based and Canny-based detection pipelines.
- Provides manual correction tools (corner drag, edge drag, rotate, move, add/remove box).
- Saves only locked boxes, each as a perspective-corrected output image.
- Includes auto-tuning with feedback learning from your prior saved results.
- Works on Linux desktops over Wayland or X11.
Requirements
- Python
>=3.10 - Linux desktop session (for example KDE Plasma) over Wayland or X11
- System libraries required by Qt/OpenCV (see
Dockerfilefor a known-good package set)
Project dependencies (from pyproject.toml):
PySide6opencv-python-headlessnumpy
Quick Start
Run with uv
uv sync --frozen
uv run scanslicer
Open a specific input directory at launch:
uv run scanslicer /path/to/scans
Choose backend explicitly:
uv run scanslicer --backend wayland
uv run scanslicer --backend x11
Run with Python directly
python -m scanslicer
CLI
scanslicer [path] [--backend {auto,wayland,x11}]
path: optional startup directory containing scan images.--backend: display backend selection.autois default.
Typical Workflow
- Open an input directory.
- Verify output directory (defaults to the opened input directory).
- Click
Detect(or use auto detection triggered on image load). - Adjust boxes as needed.
- Lock boxes you want to export (or use lock-all).
- Choose save format (
jpgorpng) and quality/compression. - Click
Save images.
Only locked boxes are exported.
Runtime Behavior
- Detection and auto-tune run in background worker tasks (
QThreadPool) so UI stays responsive. - Status events are written to a session log file and reflected in the status bar.
- Detection results are cached (normal and filter preview) to avoid unnecessary re-processing when toggling filter preview.
Data and Config Files
Persistence paths depend on how ScanSlicer is run.
Non-container runs (uv run scanslicer, python -m scanslicer):
- Defaults:
~/.config/scanslicer/defaults.json - Named presets:
~/.config/scanslicer/presets.json - Auto-tune feedback:
~/.config/scanslicer/autotune-feedback.json - Session status log:
~/.config/scanslicer/status.log
If XDG_CONFIG_HOME is set, these are stored under $XDG_CONFIG_HOME/scanslicer/ instead.
Container runs:
- When running in container and
/workexists, these are stored under/work/.scanslicer/. - In the provided
docker-compose.yml, the current repository is mounted as/work, so these files appear in.scanslicer/inside the project directory on the host.
Environment variable overrides:
SCANSLICER_DEFAULTS_PATHSCANSLICER_PRESETS_PATHSCANSLICER_FEEDBACK_PATHSCANSLICER_STATUS_LOG_PATH
Docker Compose
The repo includes a GUI-oriented compose setup for Linux desktop use:
docker compose up --build
See .env.example and docker-compose.yml for required host UID/GID and Wayland/XDG settings.
AppImage Build
AppImage build scripts and recipe are in packaging/appimage/.
- Local:
bash packaging/appimage/build-appimage.sh - Dockerized build:
bash packaging/appimage/build-appimage-docker.sh
Detailed instructions: docs/appimage.md.
Documentation
docs/README.md- documentation indexdocs/user-guide.md- end-user operation guidedocs/architecture.md- code architecture and execution flowdocs/parameters.md- full detection parameter referencedocs/autotune.md- auto-tune and feedback internalsdocs/runtime-config.md- backend/environment and persistence pathsdocs/appimage.md- AppImage packaging detailsdocs/development.md- contributor-focused architecture/workflow notes
Repository Layout
scanslicer/ - Application source (UI, controllers, canvas, detection)
packaging/appimage/ - AppImage recipe and build scripts
Dockerfile - Runtime image
docker-compose.yml - GUI container runtime wiring
pyproject.toml - Python package metadata and dependencies