AI HomeDesign API Docs
  • introduction
    • Getting Started
    • API Key
    • How to Use the API Key?
    • Step-by-Step Guide
  • API Endpoints
    • Getting Started with API Endpoints
    • Image Upload
    • Submit Order
      • AI Virtual Staging
      • AI Interior Design
      • AI Image Enhancement
      • AI Day to Dusk
      • AI Item Removal
      • AI Item Removal Mask
    • Get Spaces
    • Get Widgets and Items
    • Get Order Details
    • Generated Image Webhook
    • Upscale Download Webhook
    • Code Examples
      • Mask Canvas
    • Postman Workspace
  • Usage Limits and Policies
    • Rate Limit
  • Support and Contact
    • Help & Support
    • FAQs
Powered by GitBook
On this page
  • Overview
  • Workflow
  • Front-End Implementation Guide for Item Removal Mask
  • API Endpoints
  • Retrieve the Latest Masked Image
  • Apply Manual Mask
  • Submit the Final Masked Image
  • Retrieve the Updated Masked Image
  • Finalize Order
  1. API Endpoints
  2. Submit Order

AI Item Removal Mask

Submit Item Removal Mask Order

PreviousAI Item RemovalNextGet Spaces

Last updated 2 months ago

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 .

  1. Image Handling

    1. Load the latest masked image from the Retrieve the Latest Masked Image.

    2. Display the image on an HTML5 canvas to allow user interaction.

    3. Ensure that the size of the canvas matches the original image size to maintain accurate alignment.

  2. Brushing Requirements

    1. Users should be able to brush over the image to mark areas for removal.

    2. The brush color must be #7878CD (a specific shade of blue).

    3. The brushed strokes should be opaque, meaning the marked areas will be clearly visible.

  3. Exporting the Masked Image

    1. Once the user finishes brushing, generate a masked image as a PNG file.

    2. The PNG must have the exact same dimensions as the original image to ensure perfect overlap.

    3. Only the brushed areas should be visible on the PNG, with the rest of the image being transparent.

  4. Sending the Masked Image to the Back End

    1. Convert the canvas to a PNG file.

    2. 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 the order_id returned by the Image Upload API.

Headers

Key
Value

x-api-key*

{your_api_key_here}

Response

{
   "image_id": string,
   "url": string
}
{
    "error": string,
    "key": string
}

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": binary,
    "order_id": string
}
  • mask: This must be the binary file of the masked part

  • order_id: This should match the order_id returned by the Image Upload API.

Headers

Key
Value

x-api-key*

{your_api_key_here}

Response

{
    "maskId": string
}
{
    "error": string,
    "key": string
}

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": string,
    "service_name": "service-item-removal-mask"
}
  • order_id: This should match the order_id returned by the Image Upload API.

  • service_name: this value is fixed and must be "service-item-removal-mask"

Headers

Key
Value

x-api-key*

{your_api_key_here}

Response

{    
    "order_id": string,
    "image_id": string,
    "eta": integer
}
{    
    "error": string,
    "key": integer
}

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 the order_id returned by the Image Upload API.

Headers

Key
Value

x-api-key*

{your_api_key_here}

Response

{    
    "image_id": string,
    "url": string
}
{    
    "error": string,
    "key": integer
}

Finalize Order



Finalize order to save selected result into order

Request Parameter:

  • order_id: This should match the order_id returned by the Image Upload API.

  • image_id: This should match the image_id returned by the Last Temp Image API

Headers

Key
Value

x-api-key*

{your_api_key_here}

Response

{    
    "message": "order done successfully"
}
{    
    "error": string,
    "key": integer
}

POST

here
https://api.aihomedesign.com/v1/order/done