AI Uncrop
AI Uncrop reconstructs the missing parts of the main subject using only the visible portion.
If the edges of the main subject are clipped, they are seamlessly extended to restore the full form.
To uncrop an image, set the argument uncrop.mode
to the value ai.auto
and removeBackground
to true
:
(original image)
(uncropped image)
AI Uncrop works automatically:
there’s no need to specify new dimensions or which edges to uncrop
when no edges are cropped, the main subject will not be modified (i.e. AI Uncrop will be a no-op)
If you want to give it a try, here's the code to reproduce the example above:
curl --request POST \
--url https://image-api.photoroom.com/v2/edit \
--header 'Content-Type: multipart/form-data' \
--header 'x-api-key: YOUR_API_KEY_HERE' \
--form imageFile=@/path/to/image.png \
--form uncrop.mode=ai.auto \
--form removeBackground=true
removeBackground
may not be set to false: AI Uncrop always has to be combined with background removal.
The API will later start enforcing this.
Additional Parameters
uncrop.seed
uncrop.seed
If you make several calls to the Image Editing API with the same image, you will notice that it will generate a different uncropped subject every time.
In order to reduce the randomness, you can set a fixed value for the seed that the API's random generator will use. The value of the argument uncrop.seed
can be any positive integer.
If you provide a value for uncrop.seed
, then the API should produce similar-looking subject uncroppings for the same image.
Last updated
Was this helpful?