← Back to Blog
Prompting • Oct 21, 2026

AI image editing prompts: Preserve identity and lighting

Build AI image editing prompts that preserve identity, geometry, composition, and lighting while changing backgrounds, products, outfits, text, or logos.

Preserve identity and lighting by giving the model an explicit contract: name the one allowed change, list facial and scene features to protect, choose whether original illumination stays or changes, and specify necessary shadows or reflections. Send the source image with that instruction, compare the result, then correct one issue per follow-up. This is the core pattern behind useful AI image editing prompts for portraits, products, and backgrounds; vague requests leave too much to infer.

Build a five-part edit contract

The AI image prompt recipes make this distinction visible: one background recipe preserves subject lighting and pose, while an identity recipe protects character identity and facial features. Convert that distinction into five explicit controls:

  1. Allowed edit: Name the only element the model may change.
  2. Identity lock: Protect facial geometry, expression, hairstyle, skin tone, and distinguishing marks.
  3. Scene lock: Preserve pose, camera angle, crop, clothing, and object geometry unless instructed otherwise.
  4. Lighting rule: State whether to retain the original illumination or relight the subject for the destination.
  5. Integration rule: Define consistent contact shadows, cast shadows, reflections, and color spill only where visible.

Use this prompt skeleton:

Source of truth: Use the uploaded image as the sole identity reference.
Allowed edit: [name the exact change].
Identity lock: Keep facial geometry, expression, hairstyle, skin tone, and distinguishing marks unchanged.
Scene lock: Preserve pose, camera angle, crop, clothing, and object geometry unless named.
Lighting rule: [preserve the existing light] or [match the destination light].
Integration: Require consistent shadows, reflections, and color spill only where visible.
Do not change: Any unlisted person, product, text, or scene feature.

Fill every placeholder before submission. The instruction-based recipe examples reinforce the same approach: describe concretely what changes and what must remain intact.

Decide whether lighting is preserved or relit

Preserving identity and preserving lighting overlap, but they are not identical. Facial structure can remain fixed while illumination changes. The recipe collection lists entries for both preserving subject lighting and matching new lighting, and the blog's Lighting Match recipe calls for blue and pink light on the face. Choose one objective before writing the prompt.

Preserve the original lighting

Use this version when the subject's existing light must remain visually unchanged:

Replace only the background with a clean, pale studio wall. Preserve facial geometry, expression, hairstyle, skin tone, clothing, pose, crop, camera angle, and the original key-light direction, softness, contrast, and color temperature. Add only a restrained contact shadow that agrees with the existing light. Do not relight the face.

Relight for a new environment

Use this version when the subject should look naturally placed in the destination scene:

Replace only the background with a rainy cyberpunk street at night. Preserve the person's facial geometry, expression, hairstyle, skin tone, pose, clothing, and camera angle. Update illumination on the face and clothing to match blue and pink signs, using one consistent shadow direction. Do not add or remove objects.

If the original illumination must remain, use the first version and explicitly forbid face relighting. If environmental integration is the goal, use the second version. In both cases, the identity lock protects facial structure while the lighting rule controls how illumination affects it.

Adapt the contract for common edits

A background replacement prompt, product image editing prompt, and portrait edit can share this structure even though their protected features differ.

Background and product replacement

For a product image editing prompt, define geometry and product markings as protected:

Place the exact product on a white seamless background with a soft natural shadow. Preserve its geometry, proportions, surface colors, label spelling, and camera angle. Add no props and make no packaging changes.

Keep a face unchanged during an outfit edit

For a keep face unchanged AI edit, or a preserve identity AI image edit, localize the allowed material change:

Change only the jacket to red leather. Keep the face, hair, body, pose, hands, camera angle, crop, background, and lighting unchanged. Preserve the garment boundaries and do not alter any other object.

Text and logo placement

The recipe collection lists both complex text rendering and multi-image fusion capabilities. For an AI image prompt for text and logos, specify the exact wording, visual style, placement, scale, perspective, and role of each reference image:

Use Image 1 as the product reference and Image 2 as the logo reference. Preserve the logo's exact spelling, symbol proportions, and colors. Place it on [surface] at [location and scale], aligned with the product perspective and matched to the scene lighting. Change nothing else.

Check every character after generation rather than assuming that a detailed typography instruction produced the intended result.

Use the pattern across cloud and local workflows

The official Gemini image-generation documentation shows a text instruction and a base64 image supplied through the input parameter. It also describes multi-turn conversation as the recommended way to iterate on images and shows previous_interaction_id for follow-up edits. Begin with the full contract, then use a narrow correction such as: Keep the current background; correct only the contact shadow.

The prompt library gives values such as seed=42, steps=30, guidance=4.0, and strength=0.6 as starting points for compatible open-model pipelines and explicitly says they are not Gemini API parameters. A local API client does not make Nano Banana a local model: the cited January 2026 recipe describes Nano Banana 2 as closed and cloud-hosted. For offline editing, run those open-model starting points in a supported offline alternative rather than passing them to the Gemini API as undocumented fields.

Review one variable at a time

  1. Identity: Compare facial geometry, expression, hairstyle, skin tone, and distinguishing marks.
  2. Composition: Check pose, crop, camera angle, object boundaries, and unrequested additions.
  3. Lighting: Compare direction, softness, contrast, color, shadows, and reflections.
  4. Text: Verify wording, capitalization, font style, placement, and logo proportions character by character.

If one check fails, do not merely repeat preserve identity. Name the violated feature, identify the single permitted correction, and send that as a focused follow-up. Prompt constraints guide the edit, but checking the rendered result remains part of the workflow. For related workflow questions, see the Nano Banana FAQ.

Sources