Skip to content

krites remove

Description

Remove an unwanted object — a stray guest, a distraction, an exit sign — by inpainting a masked region and recording it as a reversible removal on the frame's edit record (0008 §5; R-RM-1). krites marks the region you name with --region, an inpainting provider fills it, and the filled patch is cached beside the shoot; the removal is baked into pixels only on krites export. krites proposes; the original is never touched.

How it stays non-destructive. The generative fill runs once, here, and materialises to a small patch raster under .krites/removals/<frame>/ — the delta the model produced, nothing more (0008 Q2). The edit record references it by path (R-ND-2); export composites the cached patch with a pure, deterministic paste (R-EXP-4) — it never re-runs the model. Undo a removal with krites reset, which clears the record and prunes the orphaned patches. Removals are never written to XMP — Camera-Raw can't represent them, so they live only in krites' own export (0006 R-XMP-1b).

Where it sits in the bake. Removals composite first, on the original frame, before straighten → crop → look (0008 §5.2):

removals → straighten → crop → look

So the fill is leveled, cropped and graded along with everything else, and its mask — defined in original-frame coordinates — survives any later geometry edit.

Local-first / privacy. The inpaint runs through a pluggable Inpainter provider, chosen from config and off by default (0001 §5). Two local backends ship behind the same seam (0008 §4), fetched and checksum-verified on first use and run on-device through ONNX Runtime:

  • lama (default) — LaMa big-lama, the reference-quality eraser. Runs the mask on a context-padded 512 crop.
  • migan — MI-GAN, a fast, tiny (28 MB) secondary. The pipeline model owns its own crop/resize/blend geometry; krites composites only the filled pixels back, so unmasked pixels stay byte-identical.

A cloud backend is a planned opt-in that would disclose before any pixels leave the machine (R-PRIV-2). This command is excluded from the MCP tool surface — it produces pixels, so it is CLI-only (R-MCP-2).

Enable it in config (off by default):

Key Meaning Default
remove.enabled Turn object removal on false
remove.backend Inpaint backend: lama or migan lama
remove.execution_provider cpu or coreml (Apple Silicon; falls back to CPU) cpu
remove.library_path Path to libonnxruntime binding default
remove.model Override the model path (else the backend's pinned model is fetched) (pinned)
remove.margin Context padding around the mask before the 512 crop (LaMa only) 0.5
remove.timeout Per-inpaint deadline 120s

Licence note. Both backends' weights are trained on the Places2 dataset (non-commercial / no-redistribution); whether weights inherit training-data terms is legally unsettled. LaMa is Apache-2.0, MI-GAN is MIT — but the pinned MI-GAN artefact is a re-host with no LICENSE (a self-export is a hardening TODO). All fine for private self-hosted use; see NOTICE.md and 0008 §4.1 before commercial distribution.

Usage

krites remove <frame> --region <x,y,w,h> [flags]

Name exactly one frame. The shoot is taken from --shoot, or the current working directory if omitted (R-SCOPE-1). The --region is a normalised rectangle — fractions of the frame in [0,1], origin top-left — that must lie within the frame.

Flags

Flag Description Default
--shoot Shoot directory to scope to the current directory
--region Region to remove as normalised x,y,w,h (fractions of the frame, origin top-left) (required)
--output Output format: text or json text

Run krites remove --help for the authoritative, always-current flag set.

Examples

Remove an object from the middle-left of a keeper (once a backend is enabled):

krites remove IMG_2043.JPG --region 0.30,0.25,0.20,0.40

Undo every removal (and other edits) on that frame:

krites reset IMG_2043.JPG