---
name: flux-kontext-image-editing
description: "Instruction-based image editing with FLUX.1 Kontext — local edits, character consistency, multi-reference prompting via BFL API. Production FLUX.1 Kontext editing: instruction-driven local edits and inpainting that preserve unchanged regions, character/style consistency across iterative passes, and multi-image reference prompting. Covers the Black Forest Labs API (Pro/Max endpoints, async polling, aspect_ratio and seed control, safety_tolerance), the open-weight Kontext dev model in ComfyUI, prompt phrasing for surgical edits vs. global changes, and chaining edits without identity drift."
license: MIT
---

# FLUX Kontext Editor

Instruction-driven image editing built on FLUX.1 Kontext from Black Forest Labs. You hand it a source image plus a plain-language edit ("make the jacket red," "remove the person on the left," "put this logo on the mug"), and it returns a new image that changes only what you asked for while keeping composition, lighting, and faces intact. Built for developers wiring Kontext into pipelines, content teams iterating on product shots, and anyone who needs consistent characters across a sequence of edits.

## When to use it
- Local edits that must leave the rest of the frame untouched: swapping an object, changing a color, editing visible text, removing a background element.
- Keeping a character or product recognizable across several successive prompts (avatars, comic panels, ad variants).
- Style transfer or relighting where you describe the target rather than supplying a mask.
- Composing from multiple references — e.g. "place the subject from image 1 into the scene from image 2."

## How it works
The skill calls the BFL API. Editing requests go to `/v1/flux-kontext-pro` or `/v1/flux-kontext-max`; the source is passed as a base64 `input_image`, and additional references can be chained for multi-image prompting. The API is asynchronous: the create call returns a `polling_url` plus an `id`, and you poll until `status` becomes `Ready`, then read `result.sample` for the signed image URL (links expire, so download promptly). Supported controls include `prompt`, `aspect_ratio`, `seed` (reuse it to reproduce or iteratively refine the same result), `prompt_upsampling`, and `safety_tolerance`. The skill also documents a ComfyUI path using the Kontext nodes for local/queued workflows.

## Usage
```bash
curl -fsSL --create-dirs -o ~/.claude/skills/flux-kontext-image-editing/SKILL.md https://claudeskil.com/skills/flux-kontext-image-editing/SKILL.md
export BFL_API_KEY=your_key

# Then, in chat:
"Edit ./product.png with FLUX Kontext: change the bottle cap to matte black,
 keep everything else identical, aspect_ratio 1:1, seed 42"
```
Equivalent raw call:
```bash
curl -X POST https://api.bfl.ai/v1/flux-kontext-pro \
  -H "x-key: $BFL_API_KEY" -H "Content-Type: application/json" \
  -d '{"prompt":"change the cap to matte black","input_image":"<base64>","seed":42}'
# → poll the returned polling_url until status == "Ready"
```

## Tips & gotchas
- Be explicit about what should *stay* the same ("keep the same face, pose, and background") — Kontext respects negative-space instructions well and this prevents drift.
- Lock a `seed` while iterating; changing only the prompt with a fixed seed gives controllable, comparable edits.
- For text edits, quote the exact replacement string ("replace 'SALE' with 'SOLD'") rather than describing it.
- Result URLs are short-lived. Save `result.sample` to disk immediately after `Ready`.

## FAQ
**Pro vs Max?** Max trades higher cost for stronger prompt adherence and typography; Pro is faster and cheaper for routine local edits.

**Do I need to draw a mask?** No — Kontext is instruction-based, so you describe the region in words. Use ComfyUI nodes if you want explicit masking.

**Does chained editing degrade quality?** Some softening accumulates over many passes; re-anchor to the original source when possible instead of editing the editor's output repeatedly.
