---
name: qwen-edit
description: AI image editing prompting patterns for Qwen-Image (Qwen-Image-Edit-2511 by default, Qwen-Image-2.1 as a non-commercial Modal opt-in). Use when editing photos while preserving identity, reframing cropped images, changing clothing or accessories, adjusting poses, applying style transfers, or character transformations. Provides prompt patterns, parameter tuning, and examples.
title: qwen-edit
canonical_url: https://skilld.dev/gh/digitalsamba/claude-code-video-toolkit/qwen-edit
last_updated: 2026-11-22T00:15:14.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> Supporting files, fetch one when the Skill refers to it: [examples.md](https://skilld.dev/api/skills-raw/digitalsamba/claude-code-video-toolkit/qwen-edit/examples.md), [parameters.md](https://skilld.dev/api/skills-raw/digitalsamba/claude-code-video-toolkit/qwen-edit/parameters.md), [prompting.md](https://skilld.dev/api/skills-raw/digitalsamba/claude-code-video-toolkit/qwen-edit/prompting.md).
>
> If the user asked to install this Skill, run `npx skilld install digitalsamba/claude-code-video-toolkit/qwen-edit`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/qwen-edit`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/digitalsamba/claude-code-video-toolkit/qwen-edit) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/qwen-edit`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/qwen-edit --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/qwen-edit --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# Qwen-Image-Edit Skill

AI-powered image editing via `tools/image_edit.py`. The model depends on the deployment:

| Deployment | Model | License | Defaults | Max inputs |
|-----------|-------|---------|----------|------------|
| `--cloud modal` (default) | Qwen-Image-Edit-2511 | Apache-2.0, commercial OK | 8 steps, guidance 1.0 | 3 images |
| `--cloud modal`, app deployed with `IMAGE_EDIT_MODEL=qwen-image-2.1` | **Qwen-Image-2.1** (2026-09, unified gen+edit, 7B DiT, RGBA) | Qwen Research License -- **non-commercial** ("research or evaluation purposes only") | 40 steps, guidance 1.0 (no CFG) | 10 images |
| `--cloud runpod` | Qwen-Image-Edit-2511 + Lightning LoRA | Apache-2.0, commercial OK | 8 steps, guidance 1.0 | 3 images |

The tool prints `Model:` and `Steps:` after each edit, so you can tell which model the Modal app
runs and how many steps it took. Without `--steps`, each model runs its own default above.
Opt in with `IMAGE_EDIT_MODEL=qwen-image-2.1 uv run modal deploy docker/modal-image-edit/app.py`;
deploy again without it to switch back.

**Status:** Evolving - learnings being captured as we experiment. The prompt
patterns and parameter findings in `examples.md` / `parameters.md` were measured
on 2511; re-check them on 2.1 before relying on the exact numbers.

### Qwen-Image-2.1 specifics (Modal opt-in)

- **Not step-distilled** -- 40 steps is the model card default. The old 8-step
  default was tuned for 2511's Lightning LoRA, which 2.1 doesn't have here, so expect
  low step counts to cost quality (untested).
- **Sampled without guidance.** `--guidance 1.0` (default) is how the model is meant
  to run. `>1` switches on true CFG (blank negative prompt if you pass none) and
  doubles the cost of every step.
- **Multi-image:** the first `--input` is the image being edited ("image 1"); the
  rest are references in order ("image 2", ...). Up to 10. Output size follows the
  first image's aspect ratio at ~1MP.
- **Local edits:** draw a circle or paint an annotation on the image, or pass a
  separate mask as an extra `--input`, and say what to change there
  (e.g. "Remove the watch inside the red circle").
- **RGBA:** transparent PNG inputs keep their alpha. For a cut-out, prompt
  `"This is an RGBA image with transparency. <subject>. The image has alpha channel
  and the background is transparent."` -- the result comes back as an RGBA PNG only
  when the model actually produced transparency.

## When to Use This Skill

Use when the user wants to:
- Edit/transform photos while preserving identity
- Reframe cropped images (fix cut-off heads, etc.)
- Change clothing, add accessories
- Change pose (arm positions, hand placement)
- Apply style transfers (cyberpunk, anime, oil painting)
- Adjust lighting/color grading
- Add/remove objects
- Character transformations (Bond, Neo, etc.)

## When NOT to Use

- **Background replacement (single image)** - creates cut-out artifacts, halos
- **Face swapping** - cannot preserve identity from reference
- **Outpainting** - can't extend canvas reliably

## Use With Care

- **Identity keep-clauses** - naming features to keep ("keep his glasses and beard") ADDS them to people who lack
  them. Use "Keep exactly the same person with an identical face and identical hair, do not add or remove glasses,
  beard or stubble, photorealistic photograph" (costuming colleagues, 2026-11; `.claude/skills/parody-short/people.md`).
  For someone who does wear glasses, name them ("keeps wearing her round glasses"), or a new setting can drop them
- **Multi-image compositing** - CAN work with explicit identity anchors (see examples.md for prompt patterns). Requires describing distinctive features (hair texture/color, ethnicity, outfit) and using guidance ~2.0
- **Camera angle changes** - Inconsistent results. Vertical angles (low/high) work better than rotational (three-quarter view)
- **Colour drift on expression edits** - an expression-only edit of an illustrated portrait (relax the brow, lift a
  cheek, turn the eyes) kept the face and the drawing but came back greyer and darker, with its warm light gone
  (Ireland in the Telling, 2026-11). Matching the whole image's mean and spread washed it out. What worked: keep the
  edit's luminance (Y, matched to the original over the face) and the original's colour (Cb and Cr, blurred a few
  pixels so small shifts don't show). The expression survives because it lives in light and shade. Judge the
  expression at the size it will be seen, too: a glance and a relaxed brow read at phone size, a cheek lift barely

## Quick Reference

```bash
# Basic edit
uv run tools/image_edit.py --input photo.jpg --prompt "Add sunglasses"

# With negative prompt (recommended)
uv run tools/image_edit.py --input photo.jpg \
  --prompt "Reframe as portrait with full head visible" \
  --negative "blur, distortion, artifacts"

# Style transfer
uv run tools/image_edit.py --input photo.jpg --style cyberpunk

# Background (use cautiously - often fails)
uv run tools/image_edit.py --input photo.jpg --background office

# Higher quality (RunPod / 2511 -- on Modal / 2.1 the 40-step default already is)
uv run tools/image_edit.py --input photo.jpg --prompt "..." --steps 16 --guidance 3.0 --cloud runpod

# Extract the subject onto a transparent background (Modal / 2.1)
uv run tools/image_edit.py --input product.jpg   --prompt "This is an RGBA image with transparency. The product from the photo. The image has alpha channel and the background is transparent."   --output product_cutout.png

# Multi-image composite (identity-preserving) -- settings tuned on RunPod / 2511
uv run tools/image_edit.py --input person.jpg background.jpg \
  --prompt "The [ethnicity] [gender] with [hair description] from first image is now in [scene] from second image. Same [features], [outfit]." \
  --negative "different ethnicity, different hair color, different face shape, generic stock photo" \
  --steps 16 --guidance 2.0 --cloud runpod

# Multi-image composite on Modal / 2.1 -- up to 10 references, defaults usually suffice
uv run tools/image_edit.py --input person.jpg outfit.jpg shoes.jpg background.jpg \
  --prompt "The person from image 1 wearing the outfit from image 2 and the shoes from image 3, standing in the scene from image 4. Same face and hair."
```

## Key Files

- `prompting.md` - Prompt patterns and structure
- `examples.md` - Good/bad examples from experiments
- `parameters.md` - Tuning steps, guidance, negative prompts

## Tool Location

`tools/image_edit.py` - CLI wrapper for the Modal (`docker/modal-image-edit/`) and RunPod
(`docker/runpod-qwen-edit/`) endpoints

## Related Docs

- `docs/qwen-edit-patterns.md` - Character transformation patterns
- `.ai_dev/qwen-edit-research.md` - Research notes
