Background Removal
Last updated
Was this helpful?
Last updated
Was this helpful?
On the basis of the core functionalities of the Background Removal API product (see ‘Smart background removal API Introduction’), the background removal results can be manually refined and adjusted through the editor, including the proportion of the main body, background color, canvas size, etc., such as to meet the diversified needs of users.
· Customizing canvas size and background color
· Flexible adjustment of subject scale, size, and position
· Manual refinement tools to optimize background removal results
· Ability to add text, stickers, and other design elements
The pricing of each capability in the Workbench is consistent with the corresponding API product. Charges are based on prepaid resource packages per product, and you may purchase resource packages on demand according to the actual situation. Resource packs are valid for 1 year and are currently non-refundable.
· Editor products and API products are independent of each other, and their resource packages are not interchangeable. For example, if you need both the Image Translation API and the Image Translation Editor, please purchase both packages separately.
· In the editor, charges only occur when ‘Generate’ button is clicked. Before billing, a confirmation will be presented to the integrator (see the Editor Integration Guide for configuration details).
Integration instructions and code examples can be found in the Editor Integration Guide.
In particular, as stated in the ‘Embedding the Editor Static Page’ section of the Editor Integration Guide, the capability routing and input parameters required for the construction of the src field are as follows.
'https://editor.d.design/editor/index.html/#/cutout'
Depending on the content that the integrator wishes to present when opening the editor page, different input parameters can be selected.
All parameters are optional. If none are filled in, the editor will display the initial state upon opening the page. Users can then upload images and other operations within the editor to complete the generation task.
imageUrl
String
No
Image URL.
Image requirements:
No larger than 3000x3000 pixels;
Size no more than 10MB;
Supports png, jpeg, jpg, bmp, webp formats.
const cutoutParam = { apiHost: 'aibcn', imageUrl: 'https://next-ubanner.oss-cn-beijing.aliyuncs.com/ALIWOOD_TEMPLATE/2020-06-03/test/test1.jpg', }; // Processed into a string that can be concatenated const payloadString = encodeURIComponent(JSON.stringify(cutoutParam));
// Tool page URL const sceneURL = 'https://editor.d.design/editor/index.html/#/cutout';
// Concatenated into the final link
const iframeURL = ${sceneURL}?payload=${payloadString}
;
📢Note:Ensure that the field name of payloadString matches the corresponding field name in the server-provided page API.
Integrator can obtain result data in two ways: (1) Event listener; (2) Manual trigger. See the ‘Result Retrieval’ section in the Editor Integration Guide for detailed implementation.
Error messages are uniformly returned via API. Please kindly refer to the Editor Integration Guide for the returned data structure. Error codes are shown as follows.
Capability
Error Codes (errCode)
Description
Background removal
cutout-imageLoadFail
The image failed to load, please click Regenerate.
The integrator can customize error message based on the errCode to be sent to the user.
Example: