Prompt Chain

Enhance Image Fidelity for Precise Edits

Cookbook demonstrating OpenAI's input_fidelity parameter for image editing that preserves faces, logos, and fine details when generating or modifying images.

Works with openai

91
Spark score
out of 100
Updated 3 months ago
Version 1.0.0
Models

Add to Favorites

Why it matters

Leverage high input fidelity in image generation to preserve distinctive features from input images, enabling precise edits for faces, logos, and branding.

Outcomes

What it gets done

01

Preserve facial features accurately during image editing.

02

Maintain branding consistency by accurately rendering logos and design elements.

03

Perform precise item edits, removals, or additions without altering unrelated areas.

04

Retouch fashion and product details with high fidelity for e-commerce.

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/oai-generateimageswithhighinputfidelity | bash

Steps

Steps in the chain

01
Set-up

Set up your environment to use the input_fidelity parameter with the Image API and Responses image generation tool.

02
Precise editing

Use high input fidelity to make subtle edits to an image without altering unrelated areas. Ideal for controlled, localized changes such as item edits, element removal, or element addition.

03
Item edit

Change isolated elements in an image (e.g., swap a mug color) while leaving everything else untouched using high input fidelity.

04
Remove item

Cleanly remove an isolated element from an image without changing the rest of the picture using high input fidelity.

05
Add item

Seamlessly insert new objects into a scene using high input fidelity.

06
Face preservation

Use high input fidelity to preserve faces far more accurately than in standard mode. Apply this for image editing, personalization, and photo merging while keeping people recognizable.

07
Image editing

Edit your photos while preserving facial features using high input fidelity.

08
Avatar

Create avatars that still look like the original person across different backgrounds or styles using high input fidelity.

09
Combine multiple pictures with faces

When working with multiple faces from different photos, combine all needed faces into a single composite image before sending the request to preserve high fidelity.

10
Branding consistency

Use high input fidelity to maintain brand identity in generated images, ensuring logos and unique design elements remain true to original assets.

11
Marketing assets

Generate banners or social posts that include your brand logo without distortion using high input fidelity.

12
Mockups

Place your logo or other brand assets into templates or lifestyle scenes without unintended changes using high input fidelity.

13
Product photography

Change a product's background for different campaigns while keeping the product's details crisp using high input fidelity.

14
Fashion & Product Retouching

Edit outfits or product details without compromising realism. Use high input fidelity to ensure fabric textures, patterns, and logos remain consistent.

15
Outfit variations

Change the color or style of clothing on a model photo using high input fidelity while preserving other details.

Overview

Generate images with high input fidelity

What it does

This cookbook demonstrates how to use the `input_fidelity` parameter in OpenAI's Image API and Responses image generation tool to preserve distinctive features from input images during generation and editing.

How it connects

Use this cookbook when you need to make controlled, localized changes to images while preserving specific visual elements like faces, logos, brand elements, fabric textures, or product details. Avoid it when preservation of specific details is not critical or when token budget is a primary concern, as high input fidelity consumes more image input tokens than the default setting.

Source README

Generate images with high input fidelity

This cookbook shows how you can leverage the input_fidelity parameter, available in the Image API and the Responses image generation tool, to preserve distinctive features from the input.

Setting input_fidelity="high" is especially useful when editing images with faces, logos, or any other details that require high fidelity in the output.

If you're not already familiar with image generation using the OpenAI API, we recommend starting with our introductory image generation cookbook.

Set-up

Precise editing

High input fidelity allows you to make subtle edits to an image without altering unrelated areas. This is ideal for controlled, localized changes.

Example use cases:

  • Item edits: Change isolated elements (e.g., swap a mug color) while leaving everything else untouched.
  • Element removal: Cleanly remove an isolated element without changing the rest of the picture.
  • Element addition: Seamlessly insert new objects into a scene.

Item edit

Remove item

Add item

Face preservation

When using high input fidelity, faces are preserved far more accurately than in standard mode. Use this when you need people to remain recognizable across edits.

Example use cases:

  • Image editing: Edit your photos while preserving facial features.
  • Personalization: Create avatars that still look like the original person across different backgrounds or styles.
  • Photo merge: Combine faces from multiple pictures into one image.

Note: Currently, while all input images are preserved with high fidelity, only the first one you provide is preserved with extra richness in texture. When working with multiple faces from different photos, try combining all needed faces into a single composite image before sending the request (see the example below).

Image editing

Avatar

Combine multiple pictures with faces

Branding consistency

Sometimes, maintaining brand identity in generated images is essential. High input fidelity ensures that logos and other unique design elements remain true to the original assets.

Example use cases:

  • Marketing assets: Generate banners or social posts that include your brand logo without distortion.
  • Mockups: Place your logo or other brand assets into templates or lifestyle scenes without unintended changes.
  • Product photography: Change a product’s background for different campaigns while keeping the product's details crisp.

Marketing assets

Mockups

Product photography

Fashion & Product Retouching

E-commerce and fashion often require editing outfits or product details without compromising realism. High input fidelity ensures fabric textures, patterns, and logos remain consistent.

Example use cases:

  • Outfit variations: Change the color or style of clothing on a model photo.
  • Accessory addition: Add jewelry, hats, or other accessories to a model photo without altering their pose or face.
  • Product extraction: Show the same product or outfit in new settings while keeping details intact.

Outfit variations

Accessory addition

In this example, we'll combine 2 input images. The image containing the face should be provided as the first input as more details are retained from the first image.

Product extraction

Wrapping up

In this guide, we covered how to enable high input fidelity to better preserve important visual details from input images.

Use the example use cases above as inspiration, and try the parameter with your own images to see where high input fidelity makes the biggest difference.

Keep in mind that high input fidelity consumes more image input tokens than the default. Also, while all input images are processed with high input fidelity, the first image in the list preserves the finest detail and richest texture, which is especially important for faces.

Happy building!

Step 1: Set-up

Set up your environment to use the input_fidelity parameter with the Image API and Responses image generation tool.

Step 2: Precise editing

Use high input fidelity to make subtle edits to an image without altering unrelated areas. Ideal for controlled, localized changes such as item edits, element removal, or element addition.

Step 3: Item edit

Change isolated elements in an image (e.g., swap a mug color) while leaving everything else untouched using high input fidelity.

Step 4: Remove item

Cleanly remove an isolated element from an image without changing the rest of the picture using high input fidelity.

Step 5: Add item

Seamlessly insert new objects into a scene using high input fidelity.

Step 6: Face preservation

Use high input fidelity to preserve faces far more accurately than in standard mode. Apply this for image editing, personalization, and photo merging while keeping people recognizable.

Step 7: Image editing

Edit your photos while preserving facial features using high input fidelity.

Step 8: Avatar

Create avatars that still look like the original person across different backgrounds or styles using high input fidelity.

Step 9: Combine multiple pictures with faces

When working with multiple faces from different photos, combine all needed faces into a single composite image before sending the request to preserve high fidelity.

Step 10: Branding consistency

Use high input fidelity to maintain brand identity in generated images, ensuring logos and unique design elements remain true to original assets.

Step 11: Marketing assets

Generate banners or social posts that include your brand logo without distortion using high input fidelity.

Step 12: Mockups

Place your logo or other brand assets into templates or lifestyle scenes without unintended changes using high input fidelity.

Step 13: Product photography

Change a product's background for different campaigns while keeping the product's details crisp using high input fidelity.

Step 14: Fashion & Product Retouching

Edit outfits or product details without compromising realism. Use high input fidelity to ensure fabric textures, patterns, and logos remain consistent.

Step 15: Outfit variations

Change the color or style of clothing on a model photo using high input fidelity while preserving other details.

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.