DEV Community

Cover image for A Practical Prompt Pattern for AI Image Editing
AI iWeaver
AI iWeaver

Posted on

A Practical Prompt Pattern for AI Image Editing

How to structure image-editing instructions so the model knows what to change and what to preserve

AI image editors are getting easier to use, but vague prompts still produce unpredictable results.

I've found a simple pattern useful:

1. Identify the Target

Start by naming exactly what should change.

Instead of:

Make this better.

Try:

Replace the red mug beside the laptop.

2. Describe the Replacement

Next, define what should appear instead.

Replace the red mug beside the laptop with a small white ceramic vase containing white lilies.

3. Add Preservation Constraints

Now tell the model what it shouldn't touch.

Keep the laptop, desk, chair, background, framing, and lighting unchanged.

4. Add Visual Consistency

Finally, explain how the new element should fit the original image.

Match the existing window light, perspective, scale, and contact shadow.

The final prompt becomes:

Replace the red mug beside the laptop with a small white ceramic vase containing white lilies. Keep the laptop, desk, chair, background, framing, and lighting unchanged. Match the existing window light, perspective, scale, and contact shadow.

Why This Pattern Helps

The structure is basically:

TARGET → CHANGE → PRESERVE → MATCH

I've been testing this workflow with XPT AI Image Editor, which lets you upload an image and describe edits in natural language.

The same structure works for:

  • Background replacement
  • Clothing changes
  • Object replacement
  • Hairstyle experiments
  • Room redesign
  • Character variations
  • Style transformations

You don't need an enormous prompt.

You just need to separate the intended change from the parts of the image that should remain stable.

That small distinction can make prompt-based image editing much more predictable.

Top comments (0)