Image editing API: Inpainting with masks not working as expected
Sam OkwuMar 10, 2026
I'm trying to use the image edit endpoint to replace specific parts of an image using a mask, but the results are ignoring my mask area.
response = client.images.edit(
image=open("photo.png", "rb"),
mask=open("mask.png", "rb"),
prompt="A red sports car",
n=1,
size="1024x1024"
)
My mask is a PNG with the area to edit in transparent and the rest in black. But the entire image gets regenerated. Am I creating the mask wrong?
2.1k views12 replies28 likesSolved
4 Replies
Our monitoring shows the error rate peaked at 25% around 11am EST and has been gradually improving since.
Confirmed, back to normal on our end. Thanks for the quick resolution.
Log in to reply to this topic.