4.1 KiB
Pictor Domi — core (public)
Pictor (Latin: painter) is the Domi snipping tool, PDF workbench and image toolbox.
This repository is the public, MPL-2.0 core (https://gitea.marek-novak.cz/mnovak/Pictor-public; the brief
calls it pictor-core): pure Rust, no network, no UI. The Windows app lives in the private Pictor repo
(https://gitea.marek-novak.cz/mnovak/Pictor, the brief's pictor) and depends on this one by git tag,
never by a local path. The brief and roadmap are in the app repo, docs/roadmap.md; the day pages are there too
(docs/01_v1.md).
Layout
crates/raster decode (with pixel and size caps), encode, convert, crop, rotate, resize, batch presets,
compress to a target size; HEIC/HEIF through the Windows Imaging Component (OS codec, Windows only)
crates/pdf pdfium (render, text, search, outline, forms, page ops, merge/split, image <-> pdf, flatten,
unlock) + lopdf (annotations, stamps, redaction rebuild, encryption, metadata); docs/FORMATS.md
crates/meta read and strip EXIF / GPS / XMP / IPTC from images, document info and XMP from PDFs
crates/qr QR payloads (text, URL, Wi-Fi, contact), PNG and SVG, centre logo (level forced to H)
crates/save atomic save: temp file + flush + rename, the .bak, the <name>-edited.pdf naming
crates/worker pictor-worker.exe: the only process that parses outside files (JSON lines on stdin/stdout,
docs/FORMATS.md); the app spawns it in a Job Object with a memory cap and kills it on a time cap
scripts/ fetch-pdfium.ps1 (pinned release + sha256 -> third_party/pdfium/), deps.mjs (DEPENDENCIES.md table)
fixtures-fetch/ fetch.ps1: sha256-pinned hostile corpora -> fixtures/fetched/ (never in git)
docs/ FORMATS.md (formats, the worker protocol), DEPENDENCIES.md (every crate and its licence)
Direction: worker → pdf, raster, meta, qr, save; pdf → meta, raster. The library crates never spawn processes,
open sockets or touch the registry.
Commands
powershell -File scripts/fetch-pdfium.ps1 # pdfium.dll -> third_party/pdfium/bin (tests need it)
powershell -File fixtures-fetch/fetch.ps1 # optional extra hostile corpora; the generated ones need nothing
cargo test --workspace # all mandatory tests (PDFIUM_DYNAMIC_LIB_PATH overrides the dll folder)
node scripts/deps.mjs # regenerate the crate table in docs/DEPENDENCIES.md; exits 1 on a
# licence outside the allowed set
On the dev machine CARGO_HOME=F:\C-Drive-Migration\future-caches\cargo (C: is off limits) — already set.
Rules
- Commits:
[<crate>] <Feature>: <description>, e.g.[pdf] Redaction: drop the struct tree. - No AI attribution in commits or PRs, ever: no
Co-Authored-By, no session links, no "Generated with". - No binaries in git: pdfium and corpora are fetched by sha256-pinned scripts.
- Licence rule: a new crate is recorded in
docs/DEPENDENCIES.md(with its licence) before it is used. Allowed: MIT, Apache-2.0, BSD, Zlib, MPL-2.0 (and their no-deal equivalents listed there), or an OS codec. Anything else: stop and report.node scripts/deps.mjsmust exit 0. - Hostile input: every outside file is parsed only inside
pictor-worker, with caps (pixels, bytes, time, memory). Library functions take explicitLimits; no unbounded allocation from a size read out of a file. - Tests first where the risk is (redaction, hostile PDFs and images, metadata, save safety, QR round trip).
- Branch → PR on Gitea (token in
$GITEA_TOKEN, never echoed; pushed through git's environment config) → self-review in the PR body → merge--no-ff→ push →git rev-parse HEAD origin/maintwice the same → tagvX.Y.Z(the app pins tags).
Known traps
- pdfium is not thread-safe: pdfium-render's
thread_safefeature serialises calls; onePdfiumper process. - pdfium's own save copies unreferenced objects of the original file: anything that must disappear (redaction)
is written by lopdf after
prune_objects, never by pdfium.