Principle:Googleapis Python genai Image Editing
| Knowledge Sources | |
|---|---|
| Domains | Computer_Vision, Image_Processing |
| Last Updated | 2026-02-15 00:00 GMT |
Overview
A technique for modifying existing images based on text instructions, optionally guided by reference images and masks.
Description
Image Editing applies text-guided modifications to existing images. Unlike image generation (which creates from scratch), editing preserves the original image structure while applying targeted changes. Edits can be guided by: a raw reference image (the source image to modify), a mask reference image (specifying which regions to edit), and a text prompt (describing the desired modification). Supported edit modes include inpainting (filling masked regions), outpainting (extending image boundaries), and style transfer. This enables precise image manipulation without manual pixel editing.
Usage
Use image editing when you need to modify specific aspects of an existing image: changing backgrounds, adding/removing objects, changing styles, or filling in masked regions. Provide a clear edit instruction as the prompt, the source image as a RawReferenceImage, and optionally a mask as a MaskReferenceImage to target specific regions.
Theoretical Basis
Text-guided image editing conditions the diffusion process on both the source image and the text instruction:
Where:
- I_src is the source image
- M is the optional edit mask
- c is the text instruction encoding
- The denoising process preserves unmasked regions while generating new content in masked areas