image-inpainting
Mask-driven image inpainting on RunComfy via the `runcomfy` CLI. Routes to Tongyi MAI Z-Image Turbo Inpainting (the dedicated inpainting endpoint with mask, strength, and control-scale) and to identity-preserving edit models (Nano Banana 2 Edit, GPT Image 2 Edit, FLUX Kontext Pro) when a mask isn't available and the region must be described instead. Use for object removal, watermark removal, region replacement, blemish cleanup, and any controlled local edit where a binary mask defines the target area. Triggers on "inpaint", "inpainting", "image inpaint", "remove from image", "fill region", "mask-driven edit", "remove watermark", "remove object", "patch the photo", "fill the hole", or any explicit ask to edit a specific masked region of a still.
What this skill does
# Image Inpainting
Mask-driven region edits — remove objects, fill gaps, replace masked areas — on RunComfy via the `runcomfy` CLI. This skill routes to Z-Image Turbo Inpainting when a mask is available, and to instruction-driven edit models when the region must be described in prose.
[runcomfy.com](https://www.runcomfy.com/?utm_source=skills.sh&utm_medium=skill&utm_campaign=image-inpainting) · [Z-Image Inpainting](https://www.runcomfy.com/models/tongyi-mai/z-image/turbo/inpainting?utm_source=skills.sh&utm_medium=skill&utm_campaign=image-inpainting) · [CLI docs](https://docs.runcomfy.com/cli/introduction?utm_source=skills.sh&utm_medium=skill&utm_campaign=image-inpainting)
## Powered by the RunComfy CLI
```bash
# 1. Install (see runcomfy-cli skill for details)
npm i -g @runcomfy/cli # or: npx -y @runcomfy/cli --version
# 2. Sign in
runcomfy login # or in CI: export RUNCOMFY_TOKEN=<token>
# 3. Inpaint
runcomfy run tongyi-mai/z-image/turbo/inpainting \
--input '{"image": "...", "mask_image": "...", "prompt": "..."}' \
--output-dir ./out
```
CLI deep dive: [`runcomfy-cli`](https://www.skills.sh/agentspace-so/runcomfy-agent-skills/runcomfy-cli) skill.
---
## Pick the right model
Listed by precision of region targeting (mask-required first, then description-based).
**Z-Image Turbo Inpainting** — `tongyi-mai/z-image/turbo/inpainting` *(default — mask required)*
> Dedicated inpainting endpoint with mask, strength, and control-scale. Open-weights, sub-second to a few seconds.
> Pick for: precise region edits with a binary mask — object removal, watermark cleanup, full-region replacement.
> Avoid for: edits without a mask — use Nano Banana 2 Edit (description-based).
**Z-Image Turbo Inpainting LoRA** — [`tongyi-mai/z-image/turbo/inpainting/lora`](https://www.runcomfy.com/models/tongyi-mai/z-image/turbo/inpainting/lora?utm_source=skills.sh&utm_medium=skill&utm_campaign=image-inpainting)
> Inpainting endpoint with LoRA adapter support — apply a fine-tuned style during inpainting.
> Pick for: brand-style-locked inpainting (LoRA captures the look, mask defines the region).
> Avoid for: generic inpainting — use the base inpainting endpoint.
**Nano Banana 2 Edit** — `google/nano-banana-2/edit` *(description-based fallback)*
> Identity-preserving edit driven by spatial language ("the watermark in the bottom-right", "the cables overhead"). No mask required.
> Pick for: when no mask is available and the region can be described.
> Avoid for: precise pixel-level region edges — use Z-Image Inpainting.
**GPT Image 2 Edit** — `openai/gpt-image-2/edit`
> Multi-ref edit with layout-precise instructions; honors "remove only the X" directives.
> Pick for: complex prompt + reference composition where the masked region needs context from other images.
> Avoid for: simple single-image mask-driven jobs — use Z-Image Inpainting.
**FLUX Kontext Pro** — `blackforestlabs/flux-1-kontext/pro/edit`
> Single-instruction local edit with maximum preservation of everything else.
> Pick for: "keep everything except X" style local edits without a mask.
> Avoid for: explicit mask-driven workflows — use Z-Image Inpainting.
---
## Route 1: Z-Image Turbo Inpainting — default
**Model**: `tongyi-mai/z-image/turbo/inpainting`
**Catalog**: [Z-Image inpainting](https://www.runcomfy.com/models/tongyi-mai/z-image/turbo/inpainting?utm_source=skills.sh&utm_medium=skill&utm_campaign=image-inpainting)
### Schema
| Field | Type | Required | Notes |
|---|---|---|---|
| `prompt` | string | yes | What fills the masked region; describe preservation constraints for the surround |
| `image` | string | yes | Source image URL |
| `mask_image` | string | yes | **Grayscale mask URL** (white = inpaint, black = preserve) |
| `strength` | float | no | 0.3–0.6 for retouching, 0.7–1.0 for full replacement |
| `control_scale` | float | no | 0.6–0.9 typical |
| `aspect_ratio` | enum | no | W:H output ratio |
| `seed` | int | no | Reproducibility |
### Invoke
**Object removal (low strength):**
```bash
runcomfy run tongyi-mai/z-image/turbo/inpainting \
--input '{
"prompt": "Remove overhead cables; preserve rooflines and sky gradient; thin clean sky.",
"image": "https://your-cdn.example/street.jpg",
"mask_image": "https://your-cdn.example/cables-mask.png",
"strength": 0.5,
"control_scale": 0.8
}' \
--output-dir ./out
```
**Region replacement (high strength):**
```bash
runcomfy run tongyi-mai/z-image/turbo/inpainting \
--input '{
"prompt": "Replace busy backdrop with smooth light gray studio paper; mask background only.",
"image": "https://your-cdn.example/product.jpg",
"mask_image": "https://your-cdn.example/bg-mask.png",
"strength": 0.9
}' \
--output-dir ./out
```
### Prompting tips
- **A mask URL is required.** Grayscale, white = inpaint region, black = preserve. Slight blur on mask edges (1–3 px) blends better than a sharp binary edge.
- **Strength by intent**:
- `0.3–0.5` retouching / blemish cleanup
- `0.6–0.7` object replacement with style match
- `0.8–1.0` full region replacement
- **Name what stays outside the mask** in the prompt: `"preserve rooflines and sky gradient"`, `"match brick pattern and mortar tone"`.
- **Spatial labels still help** even with a mask: `"the left shelf"`, `"upper-right quadrant"` — disambiguates if the mask covers multiple objects.
---
## Route 2: Description-based fallback (no mask)
When you don't have a mask, use **Nano Banana 2 Edit** with spatial language. The model identifies the target region from your prompt:
```bash
runcomfy run google/nano-banana-2/edit \
--input '{
"prompt": "Remove the watermark in the bottom-right corner. Keep everything else exactly as in the input.",
"image_urls": ["https://your-cdn.example/photo.jpg"]
}' \
--output-dir ./out
```
For richer description-based edit, see [`image-edit`](https://www.skills.sh/agentspace-so/runcomfy-agent-skills/image-edit).
---
## Common patterns
### Watermark removal
- Mask-driven (Route 1, strength 0.5) if mask available
- Description-based (Route 2) if no mask: "Remove the watermark in the bottom-right corner. Keep everything else exactly."
### Background full-swap
- Mask the background → Route 1 with `strength: 0.9` and a description of the new background
### Object addition into a hole
- Mask the hole + describe the new object → Route 1 with `strength: 0.8`
### Brand-style-locked inpainting
- Use **Z-Image Inpainting LoRA** variant with a brand-style LoRA trained via [`/trainer`](https://www.runcomfy.com/trainer?utm_source=skills.sh&utm_medium=skill&utm_campaign=image-inpainting)
### Complex layout repositioning (move element from X to Y)
- Mask is hard to define cleanly → **GPT Image 2 Edit** with multi-ref + directional language. See [`image-edit`](https://www.skills.sh/agentspace-so/runcomfy-agent-skills/image-edit).
### What this skill doesn't do
- **Outpainting** (extending the canvas beyond the original): see [`image-outpainting`](https://www.skills.sh/agentspace-so/runcomfy-agent-skills/image-outpainting).
- **Video inpainting** (frame-by-frame mask edits): see [`video-inpainting`](https://www.skills.sh/agentspace-so/runcomfy-agent-skills/video-inpainting).
---
## Browse the full catalog
- [`best-image-editing-models` collection](https://www.runcomfy.com/models/collections/best-image-editing-models?utm_source=skills.sh&utm_medium=skill&utm_campaign=image-inpainting)
- [Z-Image base + LoRA variants](https://www.runcomfy.com/models/tongyi-mai/z-image/turbo?utm_source=skills.sh&utm_medium=skill&utm_campaign=image-inpainting)
Mask-creation tools (Photoshop, GIMP, segment-anything models) are upstream of this skill; the CLI consumes a mask URL but doesn't generate one.
---
## Exit codes
| code | meaning |
|---|---|
| 0 | success |
| 64 | bad CLI args |
| 65 | bad input JSON / schema mismatch |
| 69 | upstream 5xx |
| 75 | retryable: timeout / 429 |
| 77 | not signed in or token rejected |
FRelated in Image & Video
watch
IncludedWatch a video (URL or local path). Downloads with yt-dlp, extracts auto-scaled frames with ffmpeg, pulls the transcript from captions (or Whisper API fallback), and hands the result to Claude so it can answer questions about what's in the video.
physical-ai-defect-image-generation
IncludedUse when the user wants to orchestrate defect image generation, run associated setup, or handle outputs on OSMO. The Day 0 path handles cold-start with USD-to-ROI, image-edit augmentation, and AnomalyGen to create initial PCBA datasets. The Day 1 path performs inference and labeling on real images. This skill helps with first-time asset setup, creation of finetuning checkpoints, and configuring deployment. Trigger keywords: defect image generation, dig workflow, dig pipeline, defect image detection workflow, aoi pipeline, aoi anomalygen, usd2roi anomalygen, day 0 pcba, day 1 pcba, day 1 real-photo alignment, day 1 manual roi, metal surface anomaly, glass defect, anomalygen finetune, setup_pcb, setup_metal, setup_glass, setup_pretrained, dig setup, dig datasets, dig pretrained checkpoint, dig image-edit endpoint.
accelint-react-best-practices
IncludedReact performance optimization and best practices. ALWAYS use this skill when working with any React code - writing components, hooks, JSX; refactoring; optimizing re-renders, memoization, state management; reviewing for performance; fixing hydration mismatches; debugging infinite re-renders, stale closures, input focus loss, animations restarting; preventing remounting; implementing transitions, lazy initialization, effect dependencies. Even simple React tasks benefit from these patterns. Covers React 19+ (useEffectEvent, Activity, ref props). Triggers - useEffect, useState, useMemo, useCallback, memo, inline components, nested components, components inside components, re-render, performance, hydration, SSR, Next.js, useDeferredValue, combined hooks.
elevenlabs-agents
IncludedBuild conversational AI voice agents with ElevenLabs Platform using React, JavaScript, React Native, or Swift SDKs. Configure agents, tools (client/server/MCP), RAG knowledge bases, multi-voice, and Scribe real-time STT. Use when: building voice chat interfaces, implementing AI phone agents with Twilio, configuring agent workflows or tools, adding RAG knowledge bases, testing with CLI "agents as code", or troubleshooting deprecated @11labs packages, Android audio cutoff, CSP violations, dynamic variables, or WebRTC config. Keywords: ElevenLabs Agents, ElevenLabs voice agents, AI voice agents, conversational AI, @elevenlabs/react, @elevenlabs/client, @elevenlabs/react-native, @elevenlabs/elevenlabs-js, @elevenlabs/agents-cli, elevenlabs SDK, voice AI, TTS, text-to-speech, ASR, speech recognition, turn-taking model, WebRTC voice, WebSocket voice, ElevenLabs conversation, agent system prompt, agent tools, agent knowledge base, RAG voice agents, multi-voice agents, pronunciation dictionary, voice speed control, elevenlabs scribe, @11labs deprecated, Android audio cutoff, CSP violation elevenlabs, dynamic variables elevenlabs, case-sensitive tool names, webhook authentication
humanizer
IncludedHumanize AI-generated text by detecting and removing patterns typical of LLM output. Rewrites text to sound natural, specific, and human. Uses 28 pattern detectors, 560+ AI vocabulary terms across 3 tiers, and statistical analysis (burstiness, type-token ratio, readability) for comprehensive detection. Use when asked to humanize text, de-AI writing, make content sound more natural/human, review writing for AI patterns, score text for AI detection, or improve AI-generated drafts. Covers content, language, style, communication, and filler categories.
generating-mermaid-diagrams
IncludedSalesforce architecture diagrams using Mermaid with ASCII fallback. Use this skill when generating text-based diagrams for Salesforce architecture, OAuth flows, ERDs, integration sequences, or Agentforce structure. TRIGGER when: user says "diagram", "visualize", "ERD", or asks for sequence diagrams, flowcharts, class diagrams, or architecture visualizations in Mermaid. DO NOT TRIGGER when: user wants PNG/SVG image output (use generating-visual-diagrams), or asks about non-Salesforce systems.