AI Item Removal Mask
Submit Item Removal Mask Order
Kindly bear in mind that this feature is currently available. However, to activate it, please reach out to noshad@aihomedesign.com.
Overview
The Item Removal Mask service allows users to remove unwanted objects from an image by applying a mask. Users can mask areas of an image and submit it for processing. This document outlines the API endpoints required for fetching the latest masked image, applying manual masks, and submitting the final image.
Workflow
Retrieve the latest masked image.
Apply masking by brushing the image and submitting the masked version.
Submit the final masked image.
Retrieve the updated masked image for verification.
Finalize order
Front-End Implementation Guide for Item Removal Mask
The front-end implementation involves using a canvas to allow users to brush over areas they want to remove. The brushed image must then be sent to the back-end API in the correct format to ensure accurate processing.
Check out example code for Front-End Canvas Implementation from here.
Image Handling
Load the latest masked image from the Retrieve the Latest Masked Image.
Display the image on an HTML5 canvas to allow user interaction.
Ensure that the size of the canvas matches the original image size to maintain accurate alignment.
Brushing Requirements
Users should be able to brush over the image to mark areas for removal.
The brush color must be
#7878CD
(a specific shade of blue).The brushed strokes should be opaque, meaning the marked areas will be clearly visible.
Exporting the Masked Image
Once the user finishes brushing, generate a masked image as a PNG file.
The PNG must have the exact same dimensions as the original image to ensure perfect overlap.
Only the brushed areas should be visible on the PNG, with the rest of the image being transparent.
Sending the Masked Image to the Back End
Convert the canvas to a PNG file.
Send the masked PNG file to the API Submit the Final Masked Image.
API Endpoints
Retrieve the Latest Masked Image
GET https://api.aihomedesign.com/v1/order/{order_id}/last-temp-image
Fetches the latest version of the masked image. This allows users to view the most recent changes before making additional edits.
Request Parameters:
order_id
: This should match theorder_id
returned by the Image Upload API.
Headers
x-api-key*
{your_api_key_here}
Response
Apply Manual Mask
POST https://api.aihomedesign.com/v1/order/manual-mask
Uploads a masked image where unwanted items have been selected for removal.
Request Body
Ensure that your request body is in Form Data the format.
mask
: This must be the binary file of the masked partorder_id
: This should match theorder_id
returned by the Image Upload API.
Headers
x-api-key*
{your_api_key_here}
Response
The maskId
will be required in future versions. For now, it can be ignored, and only the most recent mask image will be used.
Submit the Final Masked Image
POST https://api.aihomedesign.com/v1/order
Submit the final masked image for processing.
Request Body
Ensure that your request body is in RAW-JSON the format.
order_id
: This should match theorder_id
returned by the Image Upload API.service_name
: this value is fixed and must be "service-item-removal-mask"
Headers
x-api-key*
{your_api_key_here}
Response
Retrieve the Updated Masked Image
GET https://api.aihomedesign.com/v1/order/{order_id}/last-temp-image
Fetches the updated masked image after submission to confirm the final result.
Request Parameter:
order_id
: This should match theorder_id
returned by the Image Upload API.
Headers
x-api-key*
{your_api_key_here}
Response
Finalize Order
POST https://api.aihomedesign.com/v1/order/done
Finalize order to save selected result into order
Request Parameter:
order_id
: This should match theorder_id
returned by the Image Upload API.image_id
: This should match theimage_id
returned by the Last Temp Image API
Headers
x-api-key*
{your_api_key_here}
Response
Last updated