Overview
Unlike image generation which creates from scratch, image editing takes an existing image and transforms it. You provide the source image and describe the changes you want.Editing techniques
Inpainting
Inpainting replaces a specific region of an image. You provide a mask indicating which area to modify.- Remove unwanted objects from photos
- Replace backgrounds
- Add or modify specific elements
Outpainting
Outpainting extends an image beyond its original borders. The AI generates content that seamlessly continues the existing image.- Expand images for different aspect ratios
- Add context around a subject
- Create panoramic versions of photos
Style transfer
Transform the visual style of an image while preserving its content.- Create artistic versions of photos
- Match images to brand aesthetics
- Generate variations with different moods
Choosing a model
Models vary in their editing capabilities:| Model | Strengths | Notes |
|---|---|---|
gemini-3-pro-image | Versatile editing, good at following instructions | Handles most editing tasks well |
gpt-image-1.5 | Precise edits, text-aware | Excellent at preserving unmasked regions |
flux.2-max | Style transfer, artistic edits | Strong aesthetic transformations |
Writing editing prompts
Editing prompts differ from generation prompts. Be specific about what to change and what to preserve.Focus on the change
Describe the modification, not the entire image:Reference the original
When helpful, reference elements in the source image:Specify preservation
Tell the model what to keep:Working with masks
Masks control which regions the model can modify. A mask is an image where:- White pixels = areas to edit
- Black pixels = areas to preserve
Creating masks
You can create masks using:- Image editing software (Photoshop, GIMP, Figma)
- Programmatic tools (PIL/Pillow, OpenCV)
- AI-based segmentation
Mask tips
Feather edges for natural blending
Feather edges for natural blending
Hard mask edges can create visible seams. Apply a slight blur to mask edges for smoother transitions.
Include context in the mask
Include context in the mask
Make masks slightly larger than the object you’re editing. This gives the model context for seamless blending.
Match mask dimensions
Match mask dimensions
The mask must be the same dimensions as the source image, or the API will reject the request.
Image formats
Lumenfall accepts images as:- Base64-encoded data - Include the image directly in the request
- URLs - Reference publicly accessible images
Cost estimation
Use dry run mode to estimate costs before editing. Add?dryRun=true to any request to get a cost estimate without executing it. See the Cost estimation API reference for details and response format.
Best practices
Start with high-quality sources
Start with high-quality sources
Editing works best with clear, high-resolution source images. Low-quality inputs produce low-quality outputs.
Make incremental edits
Make incremental edits
For complex changes, edit in steps. Change one element at a time rather than everything at once.
Test with small regions first
Test with small regions first
When inpainting, start with a small masked area to test. Expand the mask once you’re happy with the results.
Keep original images
Keep original images
Always preserve your source images. Editing is not always reversible, and you may want to try different approaches.