Mastering Hair Preservation in Costume Swaps with Nano Banana 2

Nano Banana Editorialon 2 days ago

When creating fan art or concept variations, the most challenging aspect of image-to-image (i2i) editing is often maintaining the integrity of a character's identity. While changing outfits is straightforward, altering clothing without distorting the hairstyle or hair color can be difficult if the AI over-interprets the prompt. This tutorial focuses on using Nano Banana 2 to perform costume swaps where the primary goal is strict hair preservation. By leveraging precise masking and specific prompt engineering, you can achieve seamless transitions between different outfits while keeping the character's unique look intact.

Nano Banana 2 supports text-to-image and image-to-image workflows, making it a versatile tool for these creative tasks. However, it is important to remember that prompt instructions describe desired outcomes but do not guarantee identity, label, object, or typography preservation. Success relies heavily on how you guide the model through visual constraints rather than just textual descriptions.

Prerequisites for Precise Editing

Before attempting a complex costume swap, ensure you have the necessary setup to maximize control over the generation process. The foundation of this technique lies in understanding the capabilities of the specific model you are using. Google documents Nano Banana 2 as Gemini 3.1 Flash Image, which offers a balance of speed and quality suitable for detailed edits. For users seeking higher fidelity, Nano Banana Pro utilizes the Gemini 3 Pro Image model, though the core principles of masking remain consistent across versions.

You will need an original image of your character that clearly displays the hairstyle you wish to preserve. It is crucial to select an image where the hair is well-defined and distinct from the background. Additionally, familiarize yourself with the masking tools available within the Nano Banana interface. These tools allow you to designate specific areas of the image that should remain untouched during the generation process. Without accurate masking, the AI may inadvertently alter the hair texture or color when attempting to generate new clothing details.

Step-by-Step Workflow for Hair Preservation

To successfully execute a costume swap while protecting the hair, follow this structured workflow. Each step is designed to minimize the risk of unwanted changes to the character's head area.

  1. Upload and Analyze: Start by uploading your source image into the Nano Banana 2 editor. Carefully examine the lighting and angles of the hair to understand what needs to be preserved.
  2. Apply Inpainting Mask: Use the brush tool to create a mask around the character's hair. Ensure the mask covers the entire hairstyle, including any loose strands or bangs. You may also want to include the face and neck to prevent skin tone shifts that could affect the overall look. Leave the torso and limbs unmasked so the AI knows where to apply the new costume.
  3. Craft the Prompt: Write a prompt that explicitly describes the new outfit while reinforcing the existing hair attributes. For example, specify "character wearing a medieval knight armor" while adding negative constraints like "do not change hair color" or "keep original hairstyle." Remember that prompts are examples of desired outcomes and do not guarantee results.
  4. Adjust Strength Settings: Set the image-to-image strength to a moderate level. If the strength is too high, the AI might ignore the masked areas and regenerate the hair entirely. A lower strength ensures the underlying structure remains stable.
  5. Generate and Review: Run the generation process. Review the output to see if the hair has remained consistent. If minor artifacts appear, you may need to refine the mask or adjust the prompt wording.

Evaluating Results and Troubleshooting

Judging the success of your edit requires a critical eye. Look specifically at the transition points where the hair meets the new collar or shoulders. Any blurring or color bleeding indicates that the mask was insufficient or the prompt was too aggressive. If the hair color has shifted, try adding more specific descriptors to the prompt, such as "dark brown hair" or "blonde curls," depending on your original image.

If the costume looks disconnected from the body, check your mask edges. Hard edges can sometimes cause visible lines, while soft edges might bleed into the hair area. Experiment with different mask feathering settings to find the sweet spot. Another common issue is the loss of detail in the hair texture. This often happens when the generation strength is set too low, causing the AI to simply copy the original pixels without integrating the new context properly. In such cases, slightly increasing the strength while keeping the mask tight can help.

For users who encounter persistent issues with multiple reference inputs or sequential editing, note that Nano Banana 2 Lite is focused on speed and cost. It is not optimized for these advanced workflows. If your project requires complex iterations, consider using the standard Nano Banana 2 or Nano Banana Pro models instead. Always verify the specific capabilities of the model you are accessing, as availability and features can vary.

Crafting Effective Prompts

Creating a usable prompt is essential for guiding the AI toward your vision. Below is an example of a prompt structure you can adapt for your own projects. Please note that these are examples and do not guarantee identity preservation.

Example Prompt Structure: "A full-body shot of [Character Name] wearing [New Outfit Description], intricate details, realistic lighting. The character must retain their original [Hair Color] hair styled in [Specific Hairstyle]. Do not alter the facial features or hair texture. High resolution, sharp focus."

By combining this prompt with the masking technique described above, you increase the likelihood of a successful edit. The key is to be explicit about what should stay the same while describing what should change.

Try Nano Banana

Mastering these techniques takes practice, but with careful attention to masking and prompt construction, you can achieve professional-quality costume swaps that honor the original character design.