Authorization: Bearer ********************
.png
, .jpg
, .jpeg
and .webp
, etc. Ensure the URL points directly to a compatible image file.transparent
- Removes the background from the image, allowing for transparency. Note that only PNG
and WebP
file formats support transparent backgrounds. Ensure to specify one of these formats if you opt for a transparent background.white
- Sets the background color to white. This is the default setting, suitable for contexts where a neutral background is preferred.{#hex_code}
- Allows setting the background to any custom color by providing a hex color code. For example, #FF5733
for a vibrant orange background.{image_url}
- Uses an image as the background by specifying its URL. Ensure the URL is accessible and the image format is compatible with your requirements.none
- Keep original background. Note: this option is not supported in all the APIs. Please read the documentation and try the APIs before using them in productions.none
is only supported in the body-parts
API and not in the auto-resize-align
API.match_to_original
- Keep original image dimension.trim_to_subject
- Note: Only supported in the /crop/lifestyle
API. Keep subject dimensions with all the given margins around it.WidthxHeight
- Resize the image to given width and height. Like 1600x1600stream
- The response is streamed back in the same request. This option is optimal for immediate processing or display of the data without the need for a separate download step.url
- The response will be provided as a signed S3 URL. This method will be supported in the future and is ideal for cases where the response needs to be accessed multiple times or shared.left
, right
, or center
. By default, it is center
.horizontal_alignment
is set to left
or right
. Specifies the margin as a percentage of the subject's size, controlling the distance from the subject to the selected side. Default value is 0%.top
, bottom
, or center
. By default, or if this property is left empty, it is center
.vertical_alignment
is set to top
or bottom
. Specifies the margin as a percentage of the subject's size, controlling the distance from the subject to the selected side. Default value is 0%.{
"image_url": "https://acme.s3.aws.com/image.png",
"background": "white",
"preserve_edge_contact": "true",
"output_format": "auto",
"output_dimension": "1080x1080",
"response_type": "stream",
"margins": {
"horizontal_alignment": "center",
"horizontal_margin": 0,
"vertical_alignment": "center",
"vertical_margin": 0,
"minimum_margin": 8
}
}
curl --location --request POST 'https://us1-api.crop.photo/v1/crop/auto-resize-align' \
--header 'Content-Type: application/json' \
--data-raw '{
"image_url": "https://acme.s3.aws.com/image.png",
"background": "white",
"preserve_edge_contact": "true",
"output_format": "auto",
"output_dimension": "1080x1080",
"response_type": "stream",
"margins": {
"horizontal_alignment": "center",
"horizontal_margin": 0,
"vertical_alignment": "center",
"vertical_margin": 0,
"minimum_margin": 8
}
}'