Implement computer vision solutions 3.1 Design and implement image- and video-generation solutions

A retailer wants to replace only the background behind a product photo while keeping the…

Study guide skill: Configure image-editing workflows, including inpainting, mask-based edits, and prompt-driven modifications

Question B1-031

A retailer wants to replace only the background behind a product photo while keeping the product unchanged, using a GPT-image model in Foundry. What should the edit request include?

Select one answer.

  • A A video clip of the product and a remix ID
  • B Only a text prompt that describes the product and the new background
  • C The original image, a mask image of the same size that marks the area to change, and a prompt describing the new background ✓ Correct answer
  • D The original image and a negative prompt listing what to keep

Answer: C

GPT-image models support inpainting with a mask plus a prompt: you send the image, a mask that must be the same size as the input image, and a prompt for the masked region. A text-only prompt generates a new image instead of editing, and remix applies to Sora video, not image edits.

Deep dive

How it works

The Image Edit API changes an existing image based on a text prompt. The call is similar to an image generation call, except that you also send an input image. To change only part of the image, add a mask. The mask defines the area you want the model to edit, using fully transparent pixels (alpha of zero) in that area. It must be a PNG file with the same dimensions as the input image. For this scenario, you'd make the background transparent in the mask, leave the product opaque, and write a prompt describing the new background.

Some practical details. The edit endpoint is generally available for production use. It takes multipart/form data, not JSON. You can send up to 16 input images, each smaller than 50 MB and in PNG or JPG format. If the edit drifts in style or faces, the input_fidelity parameter controls how hard the model works to match the input's style and features, which lets you make subtle edits without changing unrelated areas. Input fidelity isn't supported by the gpt-image-1-mini model.

The other options, and when you'd use them

  • A video clip of the product and a remix ID: Remix belongs to Sora 2 video generation (preview), where it makes targeted changes to an existing video. A video job can start from a prompt with optional reference inputs or a remix ID. It's for video, not editing a photo.
  • Only a text prompt: Image generation creates images from text prompts. Without the original image there's nothing to preserve, so you'd get a new picture, not the same product.
  • The original image and a negative prompt list: The documented way to control where the edit happens is the mask. Use the prompt to describe what should appear in the masked area.

Exam tip

For partial image edits (inpainting), send the image, a PNG mask of the same size (transparent where you want the change) and a prompt, all as multipart form data.

References

Last reviewed:

Ready to test yourself? The quiz asks this and every other AI-103 question, with instant feedback. Practice this in a quiz →

All Computer vision questions · AI-103 study guide

Thanks for your feedback!