Auto Resize & Align
POST
/crop/auto-resize-alignAuto resize and align in Crop.photo, seamlessly resize and align your products within the frame while replacing the background with given color or background image.
This feature guarantees a polished appearance for a diverse range of products, including shoes, beverages, and home decor, enhancing the overall visual presentation.
Maintaining a consistent eye level significantly improves the browsing experience across various aspect ratios on your online storefront. The Auto Resize & Align API ensures precise alignment and sizing of the focal object, typically a product.
Example 1:
To resize the input image to a 2000x3000 dimension and automatically align the product in the center with uniform 8% margins around it, use the API as follows:
curl --location 'https://us1-api.crop.photo/v1/crop/auto-resize-align' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json'
--header 'Authorization: Bearer :XXX-XXXX-API-KEY' \
--data '{
"image_url": "https://images.unsplash.com/photo-1599382266831-50a19097d81d?w=800&auto=format&fit=crop&q=60&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8MTB8fHJveWFsJTIwZW5maWVsZHxlbnwwfHwwfHx8MA%3D%3D",
"background": "#FFFFFF",
"preserve_edge_contact": true,
"output_format": "jpeg",
"output_dimension": "2000x3000",
"response_type": "url",
"margins": {
"minimum_margin": 8
}
}'
Request
Body Params application/json
margins
#/definitions/1948350optional
Example
Not configured
Request samples
Responses
Success(200)
HTTP Code: 200
Content Type : Binaryapplication/octet-stream
ExampleBinary image data
Binary image data
Last modified: 3 months ago