image-editor
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseImage Editor
图片编辑器
Edit and transform existing images using text prompts with Google's Gemini 3 Pro model via fal.ai.
See for setup, Python patterns, and error handling.
references/fal-api.md借助fal.ai,通过Google的Gemini 3 Pro模型,使用文本提示词编辑和转换现有图片。
有关设置、Python使用模式及错误处理,请参阅。
references/fal-api.mdAPI Endpoint
API端点
fal-ai/gemini-3-pro-image-preview/editfal-ai/gemini-3-pro-image-preview/editParameters
参数
Required
必填参数
- (string): The editing instruction describing what changes to make
prompt - (array of strings): URLs of the images to edit (use
image_urlsfor local files)fal_client.upload_file()
- (字符串):描述所需修改内容的编辑指令
prompt - (字符串数组):待编辑图片的URL(本地文件可使用
image_urls上传获取)fal_client.upload_file()
Optional
可选参数
| Parameter | Type | Default | Options |
|---|---|---|---|
| integer | 1 | 1-4 |
| string | "auto" | "auto", "21:9", "16:9", "3:2", "4:3", "5:4", "1:1", "4:5", "3:4", "2:3", "9:16" |
| string | "png" | "jpeg", "png", "webp" |
| string | "1K" | "1K", "2K", "4K" |
| boolean | false | Returns data URI directly (no download needed) |
| boolean | true | Grounds editing in current web data |
| string | "6" | Always set to "6" for maximum creative freedom |
| integer | - | Fix seed for reproducible results |
| boolean | false | Restricts to 1 image per prompt round |
Note: defaults to "auto" for editing, which preserves the original image proportions.
aspect_ratio| 参数 | 类型 | 默认值 | 可选值 |
|---|---|---|---|
| 整数 | 1 | 1-4 |
| 字符串 | "auto" | "auto", "21:9", "16:9", "3:2", "4:3", "5:4", "1:1", "4:5", "3:4", "2:3", "9:16" |
| 字符串 | "png" | "jpeg", "png", "webp" |
| 字符串 | "1K" | "1K", "2K", "4K" |
| 布尔值 | false | 直接返回数据URI(无需下载) |
| 布尔值 | true | 基于当前网络数据进行编辑 |
| 字符串 | "6" | 建议设置为"6"以获得最大创作自由度 |
| 整数 | - | 设置固定种子以获得可复现的结果 |
| 布尔值 | false | 限制每轮提示词仅生成1张图片 |
注意:编辑场景下默认值为"auto",将保留原图比例。
aspect_ratioCLI Script
CLI脚本
bash
python3 scripts/fal_generate.py \
--endpoint edit \
--prompt "Add snow to this mountain scene" \
--image /path/to/mountain.jpg \
--output edited.pngbash
python3 scripts/fal_generate.py \
--endpoint edit \
--prompt "Add snow to this mountain scene" \
--image /path/to/mountain.jpg \
--output edited.pngTips
提示技巧
- Be specific about what changes you want: "make the sky sunset orange" is better than "change the sky"
- Use (the default) to preserve original image proportions
aspect_ratio: "auto" - Multiple images can be provided for context, style transfer, or combining elements
- Set for style-grounded edits ("make it look like a Monet painting")
enable_web_search: True - Always include for maximum creative flexibility
safety_tolerance: "6" - Upload local files with before passing to
fal_client.upload_file()image_urls
- 明确描述所需修改:比如“将天空改为日落橙”比“修改天空”效果更好
- 使用默认的来保留原图比例
aspect_ratio: "auto" - 可提供多张图片作为上下文,用于风格迁移或元素融合
- 设置可实现基于风格的编辑(例如“让它看起来像莫奈的画作”)
enable_web_search: True - 建议始终将设置为"6"以获得最大创作灵活性
safety_tolerance - 本地文件需先通过上传,再将获取的URL传入
fal_client.upload_file()image_urls