AI Lifestyle Crop
POST
/crop/lifestyleAI Lifestyle Crop in Crop.photo, is a dedicated feature aimed at optimizing lifestyle photos without altering their backgrounds. This API ensures ensures the object of focus - typically a product - is precisely aligned and sized using the advanced AI algorithms.
Example 1:
To resize the input image to a 1600x1200 dimension and with the below mentioned margins in pixels, use the API as follows:
curl --location 'https://us1-api.crop.photo/v1/crop/lifestyle' \
--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"
"minimum_margins": {
"top": 20,
"bottom": 20,
"left": 50,
"right": 0,
"unit": "px"
},
"output_dimension": "1600x1200",
"output_format": "jpeg",
"response_type": "url"
}
Example 2:
To resize the input image to 3000x2000 with the specified margins, use the API as follows:
curl --location 'https://us1-api.crop.photo/v1/crop/lifestyle' \
--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"
"minimum_margins": {
"top": "20",
"bottom": "20",
"left": "50",
"right": "0",
"unit": "px"
},
"output_dimension": "3000x2000",
"output_format": "jpeg",
"response_type": "url"
}
Request
Body Params application/json
minimum_margins
#/definitions/1948351required
Example
{
"image_url": "https://loremflickr.com/640/480/nightlife",
"minimum_margins": {
"top": 2021,
"bottom": 448,
"left": 789,
"right": 414,
"unit": "px"
},
"output_format": "webp",
"output_dimension": "81x5",
"response_type": "stream",
"ai_model": "SCENE_V1",
"analysis_hints": [
"sit"
]
}
Request samples
Responses
Success(200)
HTTP Code: 200
Content Type : Binaryapplication/octet-stream
ExampleBinary image data
Binary image data
Last modified: 3 months ago