Model Overview
Flux image editing functionality is based on the advanced Flux Kontext Max model, capable of intelligent image editing based on text descriptions. Supports precise mask control, local file and online image inputs, and flexible aspect ratio output settings.🎯 Precise Editing
Using masks allows precise control of editing areas - white regions will be edited, black regions remain unchanged. Without masks, AI automatically decides editing areas.
Using masks allows precise control of editing areas - white regions will be edited, black regions remain unchanged. Without masks, AI automatically decides editing areas.
🌟 Core Features
- 🎭 Smart Editing: Intelligently modify image content based on text descriptions
- 🖼️ Mask Support: Precise control of editing areas, protect important content
- 📁 Flexible Input: Supports local files and online image URLs
- 📐 Multi-Ratio Output: Supports 7 aspect ratios for different needs
- 💰 Cost-Effective: Save 12.5% compared to official pricing, same quality
📋 Technical Specifications
| Feature | Flux Kontext Max | Description |
|---|---|---|
| LaoZhang API Price | $0.07/edit | Save 12.5% vs official |
| Official Price | $0.08/image | Original pricing |
| Input Formats | PNG, JPEG, WebP, GIF | Common image formats |
| File Size | Max 20MB or 20MP | Per image limit |
| Aspect Ratio Range | 3:7 to 7:3 | From ultra-narrow vertical to ultra-wide horizontal |
| API Method | OpenAI Compatible | Standard Images Edit API |
| Result URL | 10-minute validity | Download promptly |
💡 Cost Savings: Call Flux image editing through LaoZhang API, combined with exchange rate advantage and recharge bonus, save over 12.5% compared to official pricing!
🚀 Quick Start
Basic Example - Local Image Editing
📝 Parameter Details
Core Parameters
| Parameter | Type | Required | Description | Default |
|---|---|---|---|---|
model | string | Yes | Model name: flux-kontext-max | - |
image | file | Yes | Original image file (max 20MB or 20MP) | - |
prompt | string | Yes | Edit instruction describing desired changes | - |
mask | file | No | Mask image specifying edit area | - |
Parameters Passed via extra_body
| Parameter | Type | Range | Description | Default |
|---|---|---|---|---|
aspect_ratio | string | - | Output aspect ratio like “1:1”, “16:9” etc | ”1:1” |
seed | integer | 0-2147483647 | Random seed for reproducibility | Random |
safety_tolerance | integer | 0-2 | Content safety level, 0=strict, 2=lenient | 1 |
output_format | string | ”png”, “jpeg” | Output image format | ”png” |
🔄 Reproducibility: Using the same
seed value and identical other parameters yields consistent editing results. This is helpful for debugging and customer satisfaction testing.🎯 Professional Editing Techniques
1. Text Editing and Addition
Flux Kontext excels at handling text in images:2. Smart Context Preservation
Flux understands image context for natural edits:3. Character Consistency
🎯 Editing Scenarios
1. Background Replacement
2. Object Editing
3. Style Transformation
💡 Best Practices
1. Mask Usage Guide
Masks are PNG images where:- White (255,255,255): Areas to be edited
- Black (0,0,0): Areas to preserve
- Gray: Partial editing (blend between black and white)
2. Prompt Optimization
3. URL Management
⚠️ Important Notes
-
URL Validity:
- Edited image URLs are only valid for 10 minutes
- Download immediately after generation
- Implement retry logic for failed downloads
-
File Size Limits:
- Maximum 20MB per file
- Or maximum 20 megapixels
- Compress large images before uploading
-
Aspect Ratio:
- Supports 3:7 to 7:3 range
- Output may differ from input ratio
- System maintains ~1 megapixel total
-
Mask Requirements:
- Same dimensions as original image
- RGB or grayscale format
- White = edit, Black = preserve
-
Safety Tolerance:
- 0 = Strictest content moderation
- 1 = Balanced (recommended)
- 2 = Most lenient
🔍 FAQ
Q: Why do edited image URLs expire?
A: This is Flux official’s security design. All generated URLs automatically expire after 10 minutes for security and storage optimization.Q: Can I edit without a mask?
A: Yes! Without a mask, Flux AI intelligently determines which areas to edit based on your prompt. Masks are optional but provide more control.Q: What’s the difference between Flux Edit and Flux Generate?
A:- Edit: Modifies existing images based on prompts
- Generate: Creates new images from scratch
Q: How to create a mask?
A: Use any image editing software (Photoshop, GIMP, Python PIL) to create a PNG where white areas mark regions to edit.Q: Can I batch edit images?
A: Yes, but be mindful of the 10-minute URL expiration. Process and download each result immediately.Q: What’s the best aspect ratio?
A: Choose based on use case:1:1for social media16:9for presentations2:3for portraits7:3for banners
🔗 Related Resources
- Flux Image Generation - Create new images
- Complete Code Examples
- Pricing Calculator - Real-time pricing
- Online Demo - Test Flux editing
🎨 Pro Tip: Combine specific prompts with masks for maximum editing precision. Flux Kontext Max excels at understanding complex editing instructions!