# Inpainting with the Draw Mask Canvas

This guide provides a detailed walkthrough for using the powerful inpainting features of the AI Generation Job. Inpainting allows you to regenerate a *specific part* of an image, which is perfect for fixing small errors, adding new details, or completely changing an object within a texture. This is all done using the `IMG2IMG` workflow and the integrated **Draw Mask** view.

## 1. Understanding the Inpainting View

The inpainting process is handled within the **Input** viewport. It combines a standard texture input with a special drawing canvas.

#### **Switching to Draw Mask View**

1. First, select an `IMG2IMG` workflow (e.g., `IMG2IMG.json`).
2. In the **TextureInputs** category, provide a texture to the **Img2Img INPUT** slot. This will be the image you draw on.
3. Above the input viewport, you will see a segmented control for the view mode. Click on **"Draw Mask"** to enter the interactive canvas.

<figure><img src="/files/aS1maDDzx8k0TPShyuCP" alt=""><figcaption></figcaption></figure>

In this view, the Img2Img input texture is used as the background. You can now draw directly on it to create your inpainting mask. The masked area will be shown with a semi-transparent red overlay.

## 2. The Brush Options Toolbar

When you are in the Draw Mask view, a toolbar appears at the top of the canvas, giving you full control over your brush.

<figure><img src="/files/Akicmzxuc8eDGcm3RJO4" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/35rLKkLvU5oQ7QLU0XXe" alt=""><figcaption></figcaption></figure>

* **Type:** Choose your brush style.
  * **Regular:** A standard, circular brush.
  * **Spray:** A spray-paint effect that places multiple dots within the brush radius.
* **Size:** Controls the overall radius of your brush.
  * **Shortcut:** Use the **Mouse Wheel** to change the brush size.
* **Feather:** Controls the softness of the brush edge. A higher value creates a smoother blend.
  * **Shortcut:** Hold **Shift + Mouse Wheel** to change the feather amount.
* **Density (Spray Only):** Controls how many dots are placed with each application of the spray brush.
* **Splatter (Spray Only):** Controls the size of the individual dots within the spray.
* **Clear Mask:** A button that instantly erases the entire mask, filling it with black.

#### **Drawing and Erasing**

* **Draw (Add to Mask):** Hold the **Left Mouse Button** to draw on the canvas. This will paint white into the mask, which appears as a red overlay. The AI will only regenerate these areas.
* **Erase (Remove from Mask):** Hold the **Right Mouse Button** to erase parts of your mask. This paints black into the mask, removing the red overlay.

## 3. Step-by-Step Inpainting Guide

Let's walk through a complete example: adding ivy on top of a brick wall texture.

1. **Select Workflow and Input:**
   * Choose the `IMG2IMG.json` workflow.
   * Drag your brick wall texture into the **Img2Img INPUT** slot.
2. **Enter Draw Mask View:**
   * Click the **"Draw Mask"** button in the input viewport's mode selector.
3. **Draw Your Mask:**
   * Use the brush tools to draw a path where you want the ivy to grow. Use the **Left Mouse Button** to paint the area. Don't worry about being perfect; an organic shape is often better.
4. **Enable Inpainting and Set Prompt:**
   * In the **IMG2IMG** category in the Details panel, check the box for **Enable Inpaint**.
   * In the **Positive Prompt**, describe what should appear *inside the masked area*. For example: `(masterpiece, best quality), lush green ivy climbing the wall, detailed leaves, overgrown`.
5. **Adjust Denoise:**
   * For inpainting, a higher **KSampler\_Denoise** value (e.g., `0.7` to `1.0`) is often best, as it gives the AI more freedom to create the new object from scratch.
6. **Generate:**
   * Click the main "Generate" button. The AI will process the image, replacing only the area you masked with ivy that matches your prompt.

<figure><img src="/files/2rOeQVqgdmy8vTO3DYGr" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.shadersource.io/assets-and-plugins/texture-tools/how-to-use-5.4+/ai-generation-job-overview/inpainting-with-the-draw-mask-canvas.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
