image-editor

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Image Editor

图片编辑器

Edit and transform existing images using text prompts with Google's Gemini 3 Pro model via fal.ai.
See
references/fal-api.md
for setup, Python patterns, and error handling.
借助fal.ai,通过Google的Gemini 3 Pro模型,使用文本提示词编辑和转换现有图片。
有关设置、Python使用模式及错误处理,请参阅
references/fal-api.md

API Endpoint

API端点

fal-ai/gemini-3-pro-image-preview/edit
fal-ai/gemini-3-pro-image-preview/edit

Parameters

参数

Required

必填参数

  • prompt
    (string): The editing instruction describing what changes to make
  • image_urls
    (array of strings): URLs of the images to edit (use
    fal_client.upload_file()
    for local files)
  • prompt
    (字符串):描述所需修改内容的编辑指令
  • image_urls
    (字符串数组):待编辑图片的URL(本地文件可使用
    fal_client.upload_file()
    上传获取)

Optional

可选参数

ParameterTypeDefaultOptions
num_images
integer11-4
aspect_ratio
string"auto""auto", "21:9", "16:9", "3:2", "4:3", "5:4", "1:1", "4:5", "3:4", "2:3", "9:16"
output_format
string"png""jpeg", "png", "webp"
resolution
string"1K""1K", "2K", "4K"
sync_mode
booleanfalseReturns data URI directly (no download needed)
enable_web_search
booleantrueGrounds editing in current web data
safety_tolerance
string"6"Always set to "6" for maximum creative freedom
seed
integer-Fix seed for reproducible results
limit_generations
booleanfalseRestricts to 1 image per prompt round
Note:
aspect_ratio
defaults to "auto" for editing, which preserves the original image proportions.
参数类型默认值可选值
num_images
整数11-4
aspect_ratio
字符串"auto""auto", "21:9", "16:9", "3:2", "4:3", "5:4", "1:1", "4:5", "3:4", "2:3", "9:16"
output_format
字符串"png""jpeg", "png", "webp"
resolution
字符串"1K""1K", "2K", "4K"
sync_mode
布尔值false直接返回数据URI(无需下载)
enable_web_search
布尔值true基于当前网络数据进行编辑
safety_tolerance
字符串"6"建议设置为"6"以获得最大创作自由度
seed
整数-设置固定种子以获得可复现的结果
limit_generations
布尔值false限制每轮提示词仅生成1张图片
注意:编辑场景下
aspect_ratio
默认值为"auto",将保留原图比例。

CLI Script

CLI脚本

bash
python3 scripts/fal_generate.py \
    --endpoint edit \
    --prompt "Add snow to this mountain scene" \
    --image /path/to/mountain.jpg \
    --output edited.png
bash
python3 scripts/fal_generate.py \
    --endpoint edit \
    --prompt "Add snow to this mountain scene" \
    --image /path/to/mountain.jpg \
    --output edited.png

Tips

提示技巧

  • Be specific about what changes you want: "make the sky sunset orange" is better than "change the sky"
  • Use
    aspect_ratio: "auto"
    (the default) to preserve original image proportions
  • Multiple images can be provided for context, style transfer, or combining elements
  • Set
    enable_web_search: True
    for style-grounded edits ("make it look like a Monet painting")
  • Always include
    safety_tolerance: "6"
    for maximum creative flexibility
  • Upload local files with
    fal_client.upload_file()
    before passing to
    image_urls
  • 明确描述所需修改:比如“将天空改为日落橙”比“修改天空”效果更好
  • 使用默认的
    aspect_ratio: "auto"
    来保留原图比例
  • 可提供多张图片作为上下文,用于风格迁移或元素融合
  • 设置
    enable_web_search: True
    可实现基于风格的编辑(例如“让它看起来像莫奈的画作”)
  • 建议始终将
    safety_tolerance
    设置为"6"以获得最大创作灵活性
  • 本地文件需先通过
    fal_client.upload_file()
    上传,再将获取的URL传入
    image_urls