Note:
-
All operations are optional
-
At least one valid object in
assets
for a valid request -
At least one valid object in
operations
must be specified for a valid request -
Operations must be listed in the order in which they should be performed. Example,
redeye_remove
must be listed beforebg_remove
. -
When requesting multiple Operations on a image asset, we recommend the following order of precedence to get the best results:-
- Remove Red-eye
- Apply Autofix
- Remove Background
- Add Background
- Add Graphics
- Add Border
Additional Notes:
-
If background is provided then canvas is not required and vice-versa, if both are provided then canvas will take precedence and will be placed on top of background
-
Border will be scaled up / down with respect to the asset, background (or) canvas if available. The order of precedence would be if background (or) canvas then it takes first preference followed by asset
-
Background does not support position attribute (i.e) background is always set to fit
-
Asset positioning works only if there is a background (or) canvas, When positioning the asset make sure the boundaries (width, height) are within the background (or) canvas [ width/height of asset + x/y of asset position < width/height of background or canvas ]
JSON Data
{
"assets": [
{
"ASSET_ID_1": {
"options": {
"canvas": {
"size": {
"width": 1000,
"height": 1000
},
"color": "#ffffff"
},
"size": {
"width": 500,
"height": 500
},
"crop": {
"left": 0,
"top": 0,
"right": 200,
"bottom": 300
},
"position": {
"x": 0,
"y": 0
},
"disposition": {
"add_as_conversion": true,
"create_asset": false,
"conversion_name": "image-graphics"
}
}
}
},
{
"ASSET_ID_2": {
"options": {
"canvas": {
"size": {
"width": 1000,
"height": 1000
},
"color": "#ffffff"
},
"size": {
"width": 500,
"height": 500
},
"crop": {
"left": 0,
"top": 0,
"right": 200,
"bottom": 300
},
"position": {
"x": 0,
"y": 0
},
"disposition": {
"add_as_conversion": false,
"create_asset": true,
"metadata": {
"inherit": true,
"src_asset_id": "ASSET_ID_2",
"inherit_fields": ["siteID", "venueID"],
"data": {
"key1": "value1",
"key2": "value2"
},
},
"mode": "APPEND",
"data_schema_id": 1
}
}
}
}
],
"operations": [
{
"redeye_remove": {
"options": {
"threshold": 0.5
}
}
},
{
"bg_remove": {
"options": {
"mode": "portrait",
"strength": "medium",
"remove_artifacts": true
}
}
},
{
"autofix": {
"options": {
"mode": "auto"
}
}
},
{
"bg_add": {
"options": {
"color": "#ffffff",
"image_id": "IMAGE_ASSET_ID",
"mode": "as-is",
"size": {
"width": 1000,
"height": 1000
},
}
}
},
{
"border_add": {
"options": {
"image_id": "IMAGE_ASSET_ID"
}
}
},
{
"graphics_add": {
"graphics": [
{
"type": "image",
"options": {
"image_id": "IMAGE_ASSET_ID",
"position": {
"x": 0,
"y": 0
},
"size": {
"width": 100,
"height": 100
}
}
},
{
"type": "image",
"options": {
"image_id": "IMAGE_ASSET_ID",
"position": {
"x": 0,
"y": 0
},
"size": {
"width": 100,
"height": 100
}
}
}
]
}
}
]
}
Example Requests
Remove Background for an asset and add it as a conversion
{
"assets": [
{
"ff4b207c2094489399238d52126a0a88": {
"options": {
"disposition": {
"add_as_conversion": true,
"conversion_name": "image-graphics"
}
}
}
}
],
"operations": [
{
"bg_remove": {
}
}
]
}
Remove Background for an asset and add it as a new asset
{
"assets": [
{
"ff4b207c2094489399238d52126a0a88": {
"options": {
"disposition": {
"create_asset": true
}
}
}
}
],
"operations": [
{
"bg_remove": {
}
}
]
}