CannyEdit: Selective Canny Control and Dual-Prompt Guidance for Training-free Image Editing

Weiyan Xie, Han Gao, Didan Deng, Kaican Li, April Hua Liu, Yongxiang Huang, Nevin L. ZhangSubmission to ICLR 2026 · Withdrawn

TL;DR

CannyEdit is a training-free framework for diffusion transformer (DiT) models that solves the delicate trade-off between text adherence, context fidelity, and boundary seamlessness in local image editing. By applying structural Canny guidance only to unedited regions and routing attention between local and global text prompts, it enables high-fidelity additions, replacements, and removals—even when guided by imprecise masks or single-point hints from a Vision-Language Model (VLM).

What Problem Does This Paper Address?

Region-based image editing typically forces a painful compromise:

  1. Context Fidelity: Keeping untouched areas identical to the original.
  2. Text Adherence: Accurately synthesizing new objects specified by the prompt.
  3. Editing Seamlessness: Blending edited and unedited boundaries without visible seams or cropping artifacts.

Existing training-free approaches built on Multi-Modal Diffusion Transformers (MM-DiTs) like FLUX either inject source features too aggressively (destroying text adherence) or apply rigid mask-based latent replacement (e.g., KV-Edit), which breaks spatial interdependencies and causes jarring boundary artifacts. Meanwhile, modern end-to-end instruction-based models (such as FLUX.1 Kontext or Qwen-Image-Edit) lack fine-grained spatial control, frequently ignoring designated sizes or locations.

Methods

Built atop FLUX.1-[dev] and a lightweight FLUX-Canny-ControlNet (0.74B parameters), CannyEdit introduces a training-free pipeline without modifying model weights:

Source Image ──> FireFlow Inversion ──> Cache ControlNet Features (Z̃'I)
                                                    │
                                   [Selective Masking: (1 - E)]
                                                    │
Target Prompts ──> Dual-Prompt Attention ──> Denoising Steps ──> Seamless Output
  1. Selective Canny Control: During an initial inversion pass (using FireFlow), Canny ControlNet features are cached. During generation, these structural layout features are injected only into unedited background regions via an edit mask $E$: $$Z_I \leftarrow Z_I + \beta \cdot (1 - E) \odot \text{conv}(\tilde{Z}'_I)$$ This structurally anchors the background while granting total generative freedom to the edited area.

  2. Dual-Prompt Attention Guidance: Modifies the transformer’s attention layers using structured masks:

  3. Local Prompt: Guides target edit tokens for fine-grained object fidelity.
  4. Global Target Prompt: Interacts across all image tokens to maintain scene lighting and contextual consistency.
  5. Boundary Attention: Boundary background tokens are allowed to attend to the edit region, enabling smooth, natural visual transitions across edges.
  6. Progressive Mask Refinement: For object additions without clean masks, users (or a VLM) can simply provide a coordinate point. The model initiates generation with a distance-based soft mask, clusters cross-attention maps mid-generation ($t_{\text{refine}}$), and uses SAM 2 to automatically segment the emerging object for refined edge control.

Datasets

  • RICE-Bench (Real Image Complex Editing Benchmark): A newly curated benchmark containing 80 real and photorealistic synthetic scenes categorized into complex addition (30), replacement (25), and removal (25) tasks featuring multi-object interactions.
  • RICE-Bench-Add2: A dedicated 40-sample subset designed for simultaneous multi-object additions in a single forward pass.
  • PIE-Bench: An established benchmark for localized image editing used to evaluate background preservation and text alignment.

Key Insights and Ideas

  • Soft structural priors beat hard latent copying: Rigidly overwriting latent tokens at mask boundaries creates harsh seams. Enforcing structural edge constraints through a ControlNet exclusively on background regions preserves composition without breaking the diffusion field’s continuity.
  • Bidirectional boundary attention eliminates seams: Allowing boundary background pixels to "see" the generated object allows shadows, reflections, and contact edges to render naturally into the background.
  • Decoupling reasoning from execution: Instead of forcing an image model to interpret complex instructions, pairing frontier VLMs (as high-level planners/locators) with CannyEdit (as a deterministic spatial executor) significantly outperforms end-to-end models on complex tasks.

Key Results

  • Seamless Realism: In a 137-participant user study, human experts identified CannyEdit outputs as AI-generated only 42.0% of the time when paired with real photos (indistinguishable from chance, $p \approx 50\%$), compared to 82.0%–89.1% for baselines like BrushEdit and KV-Edit.
  • RICE-Bench Superiority: On single-object additions, CannyEdit achieved a Perceptual Realism (PR) score of 96.41 and Text Adherence (TA) of 28.12, outperforming KV-Edit (PR: 65.61, TA: 17.25) and PowerPaint-FLUX (PR: 84.88, TA: 24.34).
  • Spatial Precision: In mask-guided sizing experiments, CannyEdit achieved an Intersection-over-Union (IoU) of 0.89 against user-specified target regions, far exceeding FLUX.1 Kontext (0.68) and Qwen-Image-Edit (0.34).
  • Efficiency: Takes ~29 seconds per $512 \times 512$ edit on an NVIDIA A100 GPU—substantially faster than Qwen-Image-Edit (~74s).

Limitations and Future Work

  • Free-form Global Editing: The framework is explicitly engineered for localized additions, replacements, and removals; it does not handle non-localized transformations (e.g., identity-preserving character pose changes across the whole scene).
  • Uncontrolled Edit Geometry: While the background has structural Canny enforcement, the interior edit patch relies purely on text guidance. The authors propose adding local control signals (e.g., user-specified pose or depth maps inside the mask) in future work.
  • VLM Dependency: In instruction-based pipelines, execution quality depends on the upstream VLM correctly predicting location points. The authors suggest investigating smaller, specialized VLMs fine-tuned via SFT and RL for local visual grounding.

Summary updated

Abstract

Recent advances in text-to-image (T2I) models have enabled training-free regional image editing by leveraging the generative priors of foundation models. However, existing methods struggle to balance text adherence in edited regions, context fidelity in unedited areas, and seamless integration of edits. We introduce ***CannyEdit***, a novel training-free framework that addresses this trilemma through two key innovations. First, *Selective Canny Control* applies structural guidance from a Canny ControlNet only to the unedited regions, preserving the original image's details while allowing for precise, text-driven changes in the specified editable area. Second, *Dual-Prompt Guidance* utilizes both a local prompt for the specific edit and a global prompt for overall scene coherence. Through this synergistic approach, these components enable controllable local editing for object addition, replacement, and removal, achieving a superior trade-off among text adherence, context fidelity, and editing seamlessness compared to current region-based methods. Beyond this, CannyEdit offers exceptional flexibility: *it operates effectively with rough masks or even single-point hints in addition tasks*. Furthermore, the framework can seamlessly integrate with vision-language models *in a training-free manner* for complex instruction-based editing that requires planning and reasoning. Our extensive evaluations demonstrate CannyEdit's strong performance against leading instruction-based editors in complex object addition scenarios.
BibTeX
@misc{xie2025cannyedit,
  author = {Weiyan Xie and Han Gao and Didan Deng and Kaican Li and April Hua Liu and Yongxiang Huang and Nevin L. Zhang},
  title = {{CannyEdit: Selective Canny Control and Dual-Prompt Guidance for Training-free Image Editing}},
  year = {2025},
  eprint = {2508.06937},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2508.06937},
}
Figure