skills/skillxiv-v0.0.2-claude-opus-4.6/complex-image-editing/SKILL.md
Decompose complex image editing instructions into simpler sub-tasks with automatically generated control guidance. Handles multi-object edits, preserves identity of surrounding regions, and eliminates manual mask creation.
npx skillsauth add ADu2021/skillXiv complex-image-editingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Editing images based on complex instructions requires more than direct pixel manipulation. When a user says "make the building taller and the sky more dramatic," the system must understand that these are two separate edits targeting different objects, generate precise boundaries for each, and apply appropriate transformations without bleeding into adjacent regions. X-Planner solves this by decomposing complex instructions into manageable sub-tasks, automatically generating the masks and control signals that guide editing models.
The core challenge is that complex instructions are indirectly specified and often target multiple objects. Current approaches either require users to manually provide masks or fail when identity preservation matters—editing one object corrupts its surroundings.
X-Planner operates as a three-stage pipeline that separates planning from execution:
By treating masking as a learned task conditioned on edit type, the system generates tighter masks for texture edits and dilated masks for shape changes—each adapted to the specific editing goal.
Start by analyzing a complex instruction and decomposing it into sub-tasks:
from xplanner.decomposer import InstructionDecomposer
from xplanner.masker import MaskGenerator
decomposer = InstructionDecomposer(model="gpt-4-vision")
# Complex instruction that targets multiple objects implicitly
instruction = "Make the car red, remove the traffic cone, and brighten the road"
# Decompose into atomic sub-instructions
sub_tasks = decomposer.decompose(
instruction=instruction,
image=image
)
# Output:
# [
# {"text": "change the car color to red", "target": "car", "type": "color_change"},
# {"text": "remove the traffic cone", "target": "traffic_cone", "type": "deletion"},
# {"text": "brighten the road surface", "target": "road", "type": "lighting_change"}
# ]
For each sub-task, generate a specialized mask conditioned on the edit type:
masker = MaskGenerator()
for sub_task in sub_tasks:
edit_type = sub_task["type"]
# Generate mask adapted to edit type
mask = masker.generate_mask(
image=image,
target_description=sub_task["text"],
edit_type=edit_type,
# Different masks for different edits:
# - "texture" or "color_change": tight mask (exact object)
# - "shape" or "size": dilated mask (include context)
# - "deletion": precise boundary
# - "global": full image mask
)
# Validate mask covers the target
assert masker.validate_coverage(mask, sub_task["target"])
sub_task["mask"] = mask
For insertion tasks, predict bounding boxes since existing detectors can't hallucinate objects not in the original image:
from xplanner.spatial import BoundingBoxPredictor
predictor = BoundingBoxPredictor()
insertion_tasks = [t for t in sub_tasks if t["type"] == "insertion"]
for task in insertion_tasks:
# Predict where new object should appear
bbox = predictor.predict(
image=image,
instruction=task["text"],
context_objects=get_visible_objects(image)
)
# Bbox provides spatial guidance to editing model
task["bbox"] = bbox
Apply the sub-tasks iteratively using a compatible editing model:
from xplanner.executor import ImageEditor
editor = ImageEditor(backend="ultarEdit") # or InstructPix2Pix
result_image = image.copy()
# Apply sub-tasks sequentially
for i, sub_task in enumerate(sub_tasks):
# Get mask and optional spatial guidance
mask = sub_task["mask"]
bbox = sub_task.get("bbox", None)
# Edit using specified mask and guidance
result_image = editor.edit(
image=result_image,
instruction=sub_task["text"],
mask=mask,
spatial_guidance=bbox,
preserve_identity=True # Keep regions outside mask unchanged
)
# Validate edit quality
assert editor.validate_quality(result_image, result_image_prev)
return result_image
Use this approach for:
Avoid X-Planner for:
| Edit Type | Mask Strategy | Example | |-----------|---------------|---------| | Color change | Tight mask (exact object boundary) | "Make the car blue" | | Shape change | Dilated mask (object + buffer) | "Make the building taller" | | Style transfer | Full region mask | "Make the road surface glossy" | | Deletion | Precise boundary | "Remove the traffic cone" | | Insertion | Bounding box guidance | "Add a tree near the building" | | Global edit | Full image mask | "Brighten the entire scene" |
| Parameter | Typical Range | Guidance | |-----------|---------------|----------| | Mask dilation | 0-30 pixels | Larger for shape edits, smaller for color | | Confidence threshold | 0.5-0.9 | Higher = more selective masks | | Iteration count | 1-5 steps | More iterations for complex edits, but slower | | Model backbone | GPT-4V, Claude | Larger models decompose better |
"Beyond Simple Edits: X-Planner for Complex Instruction-Based Image Editing" - arXiv:2507.05259
testing
Uses flow maps as look-ahead operators to enable principled reward-guided diffusion by predicting trajectory endpoints at any denoising step. Deploy when applying rewards or preferences to diffusion trajectories with meaningful gradients throughout generation.
testing
Train language models where each expert learns independently on closed datasets, enabling flexible inference with selective data inclusion or exclusion. 41% performance improvement while allowing users to opt out of specific data sources without retraining.
data-ai
Understand how token generation flexibility in diffusion LMs paradoxically constrains reasoning, as models exploit ordering flexibility to avoid uncertain tokens, and apply simplified approaches that preserve parallel decoding benefits. Use when optimizing diffusion-based language models for reasoning tasks.
devops
Enable LLM agents to improve continuously during deployment by constructing structured experience libraries through self-reflection on successes and failures—achieving 23% improvement on reasoning without gradient-based parameter updates or external training.