AI Uncrop

Overview

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)

circle-info

AI Uncrop is different from AI Expand: AI Uncrop focuses specifically on the main subject of the image.

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 'x-api-key: YOUR_API_KEY_HERE' \
  --form imageFile=@/path/to/image.png \
  --form uncrop.mode=ai.auto \
  --form removeBackground=true \
  --output result-ai-uncrop.png

Try it now!

circle-exclamation

Which resolutions are supported?

By default, AI Uncrop will produce outputs at a resolution of 1K (1024x1024).

Output resolutions of 2K and 4K are available for Enterprise plans:

(original image)
(default 1K output)
(4K output)
circle-info

Make sure to click on the images to see them in full resolution.

If you're interested to use 2K or 4K resolution, please contact our team to book a demoarrow-up-right.

Book a demo

Additional Parameters

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?