raven-image --margin: clear edges pinned during diffusion #1
Loading…
Reference in a new issue
No description provided.
Delete branch "clear-edge-margin"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Follow-ups chat-s7094-7098 and chat-s7101-7102 (Meta: keep edges clear by construction).
Mechanism.
--margin PCTreplaces the empty latent with a flat--bgimage encoded by the graph's own VAE, under aSetLatentNoiseMaskthat is 0 on the band (16 px latent grid) and 1 inside. ComfyUI's sampler re-imposes the masked-out latent at every step (RePaint-style), so no custom node is needed and nothing deploys to Raven. Post-render the client measures the band against its own decoded backdrop (the VAE shifts saturated colours), repaints it exactly, reports per-side content cleared, exits 65 if more than--max-clip% was content.--alphakeys connected backdrop to transparent.Measured (1024^2, 6%, same seed/ref, one render each): Aqua seed 2203 corner seaweed 33% of band -> 0.33% pinned; Kiko desk case 31% -> 0.43%. No visible degradation; residue is subject touching the seam. Images: /opt/commons/handoff/raven-ref-edit-20261111/clear-edge/.
Cost/limits. Renders are not slower (28-70 s, queue-dependent). Hard key leaves a fringe on saturated colours; enclosed backdrop stays opaque; band is a rectangle; subject cannot be told to stay off the seam, only reported. Native vs post-render cutout: cutout alone must delete 31-33% of the band (cuts the subject flat); native avoids it.
Tests:
python3 tests/test-raven-image.py127/127.🤖 Generated with Claude Code
Soul gate (three passes, each a separate agent that did not write the code; huginn could not take a verdict because kiko-body has no cut_report for this repo, so the record is here).
Pass 1 on
d0596fd: falsified promise 2 (median backdrop promoted a band of content: all-red render with --bg white exited 0), tests survived 7 mutations, no --size/interior validation, -n lost exit 65, no CRC/size caps. Pass 2 on00794e4: fixed 1,3,4; BG_TOL, caps, decoder refusals still unpinned. Pass 3 on7b5d8ba: found my deletion of the pixel cap let a 232-1 IHDR allocate 12 GB; cap restored with a test that fails when it is removed. Pass 3 re-run ondd3d432: 159/159, 232-1 and 2**21 headers refuse cleanly at 24 MB, verdict MERGE.Known, documented: a flat band within 48 levels of --bg passes (the VAE shifts saturated colours up to ~30); the bounded decompress is an unpinned resource guard; an unreadable render leaves any older file at that path in place.
Shipped by Kiko (steward) on this Soul gate; why: Meta wants clear edges by construction, and the pin is core ComfyUI nodes so nothing deploys to Raven.