Skip to main content

Uncrop

Uncrop API

To generate new extensions of your picture, you can use the API available at https://clipdrop-api.co/uncrop/v1.

The request must be an http POST and its body must be a multipart/form-data that has one images file & several text fields:

  • a required image_file is the original image to process.
    • The original image should be a JPG, PNG or WebP, with a maximum resolution of 10 megapixels and a max file size of 30 Mb.
  • an optional extend_left integer field corresponding to the number of pixels to add to the left of the image, maximum of 2k, defaults to 0.
  • an optional extend_right integer field corresponding to the number of pixels to add to the right of the image, maximum of 2k, defaults to 0.
  • an optional extend_up integer field corresponding to the number of pixels to add at the top of the image, maximum of 2k, defaults to 0.
  • an optional extend_down integer field corresponding to the number of pixels to add at the bottom of the image, maximum of 2k, defaults to 0.
  • an optional seed integer field between 0 and 100_000. Setting the seed makes the result deterministic (ie you will always get the same output).
note

You can set negative values for any of the extend parameters if you need to crop the image.

In case of success:

  • the response mime-type is image/jpeg and the response image is the uncropped JPEG image.
  • the response headers will include a x-remaining-credits property to tell you how many credits you have left and a x-credits-consumed property to tell you how many credits were consumed by your request.

In case of an error:

  • the response mime-type is application/json, error type is indicated by the response status code and details are in the json body, ie
{ "error": "No api key provided" }

Authentication

Requests are authenticated with an API key, that you will find in your account page.

If your key has leaked, you can revoke it and request a new one in your account page.

Credits

1 successful uncrop API call = 1 credits.

Once logged in, you can claim 100 free Clipdrop APIs credits that you can use for development and debugging purposes. Once the 100 credits have been consumed, further calls will be rejected.

If you need more credits, you can purchase more credits via the following link.

Quota / Rate limiting

By default, each API key has a limit of 60 requests per minute for the uncrop API. Please let us know if you'd like higher values.

Examples

curl -X POST https://clipdrop-api.co/uncrop/v1 \
-H 'x-api-key: YOUR_API_KEY' \
-F 'image_file=@image.jpg' \
-F 'extend_left="120"' \
-F 'extend_down="-50"' \
-o result.png

Responses

The body will contain the result image file.

Support

Any question ? Contact us at contact@clipdrop.co or join the Slack community.