# Colors & Textures

The "/change\_color\_textures" endpoint utilizes sophisticated AI algorithms to modify the colors and textures of structural components, decor items, and furniture pieces within any given image. This feature is particularly useful for interior designers, architects, and homeowners looking to visualize various aesthetic options before making final decisions. By providing an intuitive interface for color and texture customization, it empowers users to creatively explore and implement design modifications, enhancing the overall appearance and feel of their spaces.

## ENDPOINT&#x20;

<mark style="color:green;">**`POST`**</mark>  <mark style="color:purple;">**`/change_color_textures`**</mark>

An API URL would be like <mark style="color:blue;"><https://homedesigns.ai/api/v2/change\\_color\\_textures></mark>

{% hint style="info" %} <mark style="color:blue;">This element seamlessly alters the colours and textures of the structural elements, decor, and furniture in the images.</mark>&#x20;
{% endhint %}

{% tabs %}
{% tab title="Request" %}
{% hint style="info" %} <mark style="color:blue;">An API request must be in the</mark> <mark style="color:orange;">**`form-data`**</mark> <mark style="color:blue;">format.</mark>
{% endhint %}

### Request

<table><thead><tr><th width="167">Parameters &#x26; Data Type</th><th width="164">Value</th><th>Description</th></tr></thead><tbody><tr><td><p><mark style="color:red;"><strong><code>design_type</code></strong></mark></p><p><mark style="color:green;"><code>string</code></mark></p></td><td>Interior, Exterior, Garden</td><td>Specifies the type of area you want to design. API users must specify whether they are designing an interior space, an exterior area, or a garden.  <strong>(Required Parameter)</strong></td></tr><tr><td><p><mark style="color:red;"><strong><code>image</code></strong></mark>  </p><p>file[ .jpg, .jpeg, .png] / base64 Image <mark style="color:green;"><code>string</code></mark></p></td><td>-</td><td>The image to be processed by the API. The image dimensions must be 512x512 pixels or greater for optimal results.                  <strong>(Required Parameter)</strong></td></tr><tr><td><mark style="color:red;"><strong><code>masked_image</code></strong></mark><br>file[ .jpg, .jpeg, .png] / base64 Image <mark style="color:green;"><code>string</code></mark></td><td>-</td><td>The image to be processed by the API. The image dimensions must be 512x512 pixels or greater for optimal results. <a href="https://homedesigns.ai/get-mask-image">Click Here</a> to generate a mask image <a href="https://youtu.be/2wmHz2ze0t4">Video Tutorial.</a>  <strong>(Required Parameter)</strong></td></tr><tr><td><p><mark style="color:red;"><strong><code>no_design</code></strong></mark> </p><p><mark style="color:green;"><code>integer</code></mark></p></td><td>Min - 1, Max - 4</td><td>Specifies the number of design variations you want the API to generate. The minimum is 1 and the maximum is 4. <strong>(Required Parameter)</strong></td></tr><tr><td><p><mark style="color:red;"><strong><code>prompt</code></strong></mark> </p><p> <mark style="color:green;"><code>null</code></mark>  or  <mark style="color:green;"><code>string</code></mark></p></td><td>Custom Prompt</td><td>An optional parameter that allows users to provide a descriptive guide for the AI, helping it understand the specific design changes desired. This could include details like the item to be modified (e.g., 'black table') and its material composition (e.g., 'made out of hardwood'), enabling more accurate and tailored design generation. (Prompt or color or materials are required.)</td></tr><tr><td><p><mark style="color:red;"><strong><code>color</code></strong></mark></p><p><mark style="color:green;"><code>null</code></mark>  or  <mark style="color:green;"><code>string</code></mark></p></td><td>White, Off White,  Cream, Ivory, Beige, Light Gray, Medium Gray, Charcoal Black, Taupe, Light Brown ..etc.</td><td>This parameter enables users to specify the color to be applied to the structural element, decor, or furniture in the image. Users can choose from a wide palette of colors, allowing for precise matching or the exploration of new color schemes to enhance the item's appearance in the design. (Prompt or color or materials are required.)</td></tr><tr><td><mark style="color:red;"><strong><code>materials</code></strong></mark><br><mark style="color:green;"><code>null</code></mark>  or  <mark style="color:green;"><code>string</code></mark></td><td>Fabrics, Glass, Wood, Stone, Metal, Ceramics and Porcelain, Plastics and Polymers, Paper and Cardboard, Natural Fibers, Composite Materials</td><td>This parameter allows users to select from a variety of materials to apply to the item being modified. Options include but are not limited to fabrics, glass, wood, and stone. Selecting a material helps the AI to accurately replicate the texture and look of the item as per the user's preference, ensuring a realistic modification. (Prompt or color or materials are required.)</td></tr><tr><td><mark style="color:red;"><strong><code>materials_type</code></strong></mark><br><mark style="color:green;"><code>null</code></mark>  or  <mark style="color:green;"><code>string</code></mark></td><td>Wallpaper, Cardboard, Kraft, Parchment, Foil embossed, Textured, Handmade paper, Recycled paper, Flocked paper, Metallic paper, Vellum, Linen paper, Watercolor paper, Matte, Glossy</td><td>A secondary parameter that provides further detail on the selected material. Depending on the primary material choice, this parameter allows users to specify the finish or texture, such as 'textured', 'foil embossed', 'handmade paper', 'recycled plastic', 'linen paper', or 'matte metallic'. This level of detail ensures that the modifications not only change the material but also accurately reflect its specific characteristics, adding depth and authenticity to the design</td></tr><tr><td><mark style="color:red;"><strong><code>object</code></strong></mark><br><mark style="color:green;"><code>string</code></mark></td><td>Required if prompt is Provided.</td><td>object names that are available in given image, [wall, floor, ceiling, etc.]</td></tr></tbody></table>
{% endtab %}

{% tab title="Errors" %}

### Parameters & Errors

<mark style="color:red;">**`image`**</mark>

<table><thead><tr><th width="289">Error Messages</th><th>Reason</th></tr></thead><tbody><tr><td>Image field required</td><td>Image not provided</td></tr><tr><td>Invalid image size. The image width and height must be 512x512 or greater than 512x512 pixels.</td><td>Image Size must be greater than 786X786.</td></tr><tr><td>Invalid image format. Only PNG, JPEG and JPG images are allowed.</td><td>Image Format not valid.</td></tr></tbody></table>

<mark style="color:red;">**`masked_image`**</mark>

<table><thead><tr><th width="289">Error Messages</th><th>Reason</th></tr></thead><tbody><tr><td>masked_image field required</td><td>masked_image not provided</td></tr><tr><td>Invalid image size. The image width and height must be 512x512 or greater than 512x512 pixels.</td><td>masked_image Size must be greater than 786X786.</td></tr><tr><td>Invalid image format. Only PNG, JPEG and JPG images are allowed.</td><td>masked_image Format not valid.</td></tr></tbody></table>

<mark style="color:red;">**`prompt/(color, materials, materials_type)`**</mark>

<table><thead><tr><th width="289">Error Messages</th><th>Reason</th></tr></thead><tbody><tr><td>prompt field required (if color, materials, materials_type are not provided)</td><td>Either prompt or color, materials, and materials_type must be provided.</td></tr></tbody></table>

<mark style="color:red;">**`color`**</mark>

<table><thead><tr><th width="289">Error Messages</th><th>Reason</th></tr></thead><tbody><tr><td>color field required (if prompt is not provided)</td><td>Either prompt or color, materials, and materials_type must be provided.</td></tr><tr><td>color value is not a valid enumeration member; permitted: White, Black, Grey, Blue, Red etc.</td><td>Color must be accurate from the provided suggesions.</td></tr></tbody></table>

<mark style="color:red;">**`materials`**</mark>

<table><thead><tr><th width="289">Error Messages</th><th>Reason</th></tr></thead><tbody><tr><td>materials field required (if prompt is not provided)</td><td>Either prompt or color, materials, and materials_type must be provided.</td></tr><tr><td>materials value is not a valid enumeration member; permitted: Fabrics, Glass, Wood, Stone, Metal, Ceramics and Porcelain, Plastics and Polymers, Paper and Cardboard, Natural Fibers, Composite Materials</td><td>materials must be accurate from the provided suggesions.</td></tr></tbody></table>

<mark style="color:red;">**`materials_type`**</mark>

<table><thead><tr><th width="289">Error Messages</th><th>Reason</th></tr></thead><tbody><tr><td>materials_type field required (if prompt is not provided)</td><td>color, materials, and materials_type are required. If you're not providing prompt.</td></tr><tr><td>materials_type should be in [Cotton, Linen, Silk, Velvet, Wool, Leather, Suede, Tweed, Chenille, Jacquard, Satin, Polyester, Nylon, Rayon, Cashmere]</td><td>materials_type must be accurate from the provided suggesions.</td></tr></tbody></table>

<mark style="color:red;">**`Object`**</mark>

<table><thead><tr><th width="289">Error Messages</th><th>Reason</th></tr></thead><tbody><tr><td>object field required</td><td>object not provided.</td></tr></tbody></table>
{% endtab %}

{% tab title="Response" %}

<pre class="language-json"><code class="lang-json"><strong>//Output should be in list of array depends on no of designs as shown below:
</strong>
{
    "input_image": "https://storage.googleapis.com/generativeartbucket/UserGenerations/cristian/APIUser/input-20240215-102806078081.png",
    "output_images": [
        "https://storage.googleapis.com/generativeartbucket/UserGenerations/cristian/APIUser/20240215-102806078081-1.png"
    ]
}
</code></pre>

{% endtab %}
{% endtabs %}

## How our Color and Texture API should work?

Here are some use cases of the Color and Texture modules API and how it will work. &#x20;

### Case 1: Changing Color Only

* **Payload Requirements:** Only pass the <mark style="color:red;">`color`</mark> parameter.
* **Exclude:** Do not pass <mark style="color:red;">`materials`</mark>, <mark style="color:red;">`materials_type`</mark>, and <mark style="color:red;">`prompt`</mark>.

### Case 2: Changing Materials Only

* **Payload Requirements:** Pass both <mark style="color:red;">`materials`</mark>and <mark style="color:red;">`materials_type`</mark>parameters.
* **Exclude:** Do not pass <mark style="color:red;">`color`</mark> and <mark style="color:red;">`prompt`</mark>.

### Case 3: Changing Materials with Specific Color

* **Payload Requirements:** Pass <mark style="color:red;">`color`</mark>, <mark style="color:red;">`materials`</mark>, and <mark style="color:red;">`materials_type`</mark>parameters.
* **Exclude:** Do not pass <mark style="color:red;">`prompt`</mark>.

### Custom Changes Using Prompt

If the desired <mark style="color:red;">`color`</mark>, <mark style="color:red;">`materials`</mark>, or <mark style="color:red;">`materials_type`</mark>is not available in the app, and you want to change part of an image, you can use the <mark style="color:red;">`prompt`</mark> parameter to handle this.

### Case 1: Custom Color Using Prompt

* **Example Prompt:** <mark style="color:red;">`barbie pink`</mark>
* **Note:** Using such colors is not recommended, but you can use the [paint visualizer](https://api.homedesigns.ai/homedesignsai-api-documentation/core-apis/paint-visualizer) feature if the image is of an interior type.

### Case 2: Custom Materials and Materials\_Type Using Prompt

* **Example Prompt:** <mark style="color:red;">`anthracite with white marble`</mark>

### Case 3: Custom Materials, Materials\_Type, and Specific Color Using Prompt

* **Example Prompt:** <mark style="color:red;">`grey anthracite with white marble`</mark>

## [What is Masked Image?](https://api.homedesigns.ai/homedesignsai-api-documentation/others/what-is-masked-image)
