> ## Documentation Index
> Fetch the complete documentation index at: https://docs.geekai.co/llms.txt
> Use this file to discover all available pages before exploring further.

# 图片编辑

### 图片编辑

图片编辑和以图生图类似，你可以通过传入图片+文本提示对指定图片进行编辑，示例代码如下：

```bash theme={null}
curl --location --request POST 'https://geekai.co/api/v1/images/edits' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $GEEKAI_API_KEY' \
--data '{
    "model": "gpt-image-2",
    "prompt": "修复这张破损的照片",
    "image": "https://static.geekai.co/storage/2025/04/02/broken-picture.jpg"
}'
```

多张图片可以通过字符串数组传递：

```bash theme={null}
curl --location --request POST 'https://geekai.co/api/v1/images/edits' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $GEEKAI_API_KEY' \
--data '{
    "model": "gpt-image-2",
    "prompt": "修复这张破损的照片",
    "images": ["https://static.geekai.co/storage/2025/04/02/broken-picture.jpg"]
}'
```

### 表单上传

如果你需要上传本地图片进行编辑，可以使用 `multipart/form-data` 的方式进行表单上传：

```bash theme={null}
curl --location --request POST 'https://geekai.co/api/v1/images/edits' \
--header 'Authorization: Bearer $GEEKAI_API_KEY' \
--form 'model="gpt-image-2"' \
--form 'prompt="修复这张破损的照片"' \
--form 'image=@/path/to/your/local/image.jpg'
```

多张图片的表单上传方式如下：

```bash theme={null}
curl --location --request POST 'https://geekai.co/api/v1/images/edits' \
--header 'Authorization: Bearer $GEEKAI_API_KEY' \
--form 'model="gpt-image-2"' \
--form 'prompt="将第一张图中的面料应用至第二张图的服装上，图片比例按照第二张图的来"' \
--form 'images[]=@/path/to/your/local/image1.jpg' \
--form 'images[]=@/path/to/your/local/image2.jpg'
```

更多图片编辑 API 参数细节，请参考[画图 API 手册](https://docs.geekai.co/cn/api/image)。
