Skip to content

Commit 0f92b40

Browse files
committed
image edits method change
1 parent b9935f1 commit 0f92b40

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

articles/ai-services/openai/how-to/dall-e.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -259,22 +259,23 @@ Replace the following values:
259259
- `<api_version>` is the version of the API you want to use. For example, `2025-04-01-preview`.
260260

261261
**Required headers**:
262-
- `Content-Type`: `application/json`
262+
- `Content-Type`: `multipart/form-data`
263263
- `api-key`: `<your_API_key>`
264264

265265
**Body**:
266266

267267
The following is a sample request body. You specify a number of options, defined in later sections.
268268

269-
```json
270-
{
271-
"image": "<base64_encoded_image>",
272-
"prompt": "Add a beach ball in the center.",
273-
"model": "gpt-image-1",
274-
"size": "1024x1024",
275-
"n": 1,
276-
"quality": "high"
277-
}
269+
> [!IMPORTANT]
270+
> The Image Edit API takes multipart/form data, not JSON data. The example below shows sample form data that would be attached to a cURL request.
271+
272+
```
273+
-F "image[][email protected]" \
274+
-F 'prompt=Add a beach ball in the center'
275+
-F "model=gpt-image-1" \
276+
-F "size=1024x1024" \
277+
-F "n=1" \
278+
-F "quality=high"
278279
```
279280

280281
### Output
@@ -304,7 +305,7 @@ The *image* value indicates the image file you want to edit. It can be either a
304305

305306
#### Mask
306307

307-
The *mask* parameter is the same type as the main *image* input parameter. It defines the area of the image that you want the model to change, using fully transparent pixels (alpha of zero) in those areas. The mask can be a URL or base 64-encoded image data. It must be a PNG file and have the same dimensions as the image.
308+
The *mask* parameter is the same type as the main *image* input parameter. It defines the area of the image that you want the model to edit, using fully transparent pixels (alpha of zero) in those areas. The mask must be a base 64-encoded image. It must be a PNG file and have the same dimensions as the input image.
308309

309310

310311
#### [DALL-E 3](#tab/dalle-3)

0 commit comments

Comments
 (0)