Image Inpainting
Edit specific parts of an existing image using .GENInpaint().
Basic Usage
Texture2D edited = await sourceTexture
.GENInpaint("Add a red car in the center")
.ExecuteAsync();Input Types
Texture2D + Instruction
Texture2D texture = Resources.Load<Texture2D>("Scene");
Texture2D edited = await texture
.GENInpaint("Replace sky with sunset")
.ExecuteAsync();Sprite + Instruction
Sprite sprite = Resources.Load<Sprite>("Character");
Texture2D edited = await sprite
.GENInpaint("Add a sword in right hand")
.ExecuteAsync();ImagePrompt
File Input
Configuration
Model Selection
With Mask
Specify which areas to edit (provider-dependent):
Common Use Cases
1. Object Removal
2. Object Addition
3. Background Replacement
4. Style Transfer (Selective)
5. Repair/Fix
Unity Integration Examples
Example 1: Screenshot Editor
Example 2: Texture Touchup Tool
Example 3: Dynamic Scene Editing
Example 4: Character Customization
Example 5: Batch Processing
Instruction Tips
✅ Good Instructions
❌ Bad Instructions
Provider Support
OpenAI DALL-E 2
Note: DALL-E 3 does not support inpainting. Use DALL-E 2 or image-to-image instead.
Limitations
Square Images Only: Most providers require square input images
Size Limits: Input images may be resized to fit model requirements
Quality: Edits may not perfectly match original style
Provider-Specific: Different providers have different capabilities
Best Practices
✅ Do
Use clear, specific instructions
Prepare images in supported formats
Start with smaller edits
Test instructions with sample images
Cache results when appropriate
❌ Don't
Use extremely high-resolution images (they'll be resized)
Make multiple major edits in one instruction
Expect pixel-perfect results
Forget to validate output
Error Handling
Next Steps
Image to Image - Full image transformation
Text to Image - Generate new images
Last updated