> For the complete documentation index, see [llms.txt](https://docs.claid.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.claid.ai/image-editing-api/image-operations/restorations.md).

# Restorations

Image restorations are one of the most important operations to perform with Claid API. You can choose from a wide range of AI-powered neural networks to <mark style="color:purple;">`decompress`</mark>, <mark style="color:purple;">`upscale`</mark>, and <mark style="color:purple;">`polish`</mark> images for different processing workflows.

## Upscale <a href="#upscale" id="upscale"></a>

The <mark style="color:purple;">`upscale`</mark> operation allows you to improve the overall quality of an image by rendering out new pixels. The upscale operation works along with [Resizing](/image-editing-api/image-operations/resizing.md) through numeric or percentage values for upscaling.  &#x20;

Upscaling is turned off by default. It can be defined by setting the <mark style="color:purple;">`upscale`</mark> object to one of the following upscaling methods below.

{% hint style="info" %}
The lower the image resolution is the less information it has, making the upscaling more difficult. We recommend you to try different upscaling methods to increase the chances of finding consistent, quality results.
{% endhint %}

#### Properties

<table><thead><tr><th width="240.16507345606317">Name</th><th width="150">Type</th><th width="358.37336504161715">Description</th></tr></thead><tbody><tr><td><mark style="color:purple;"><code>smart_enhance</code></mark></td><td><em>string</em></td><td>Used on small low quality product, real estate and food images.</td></tr><tr><td><mark style="color:purple;"><code>smart_resize</code></mark></td><td><em>string</em></td><td>Used on high-quality images and photos with barely readable text. </td></tr><tr><td><mark style="color:purple;"><code>digital_art</code></mark></td><td><em>string</em></td><td>Used on drawings, illustrations, paintings, cartoons, anime, etc.</td></tr><tr><td><mark style="color:purple;"><code>faces</code></mark></td><td><em>string</em></td><td>Used on images containing people</td></tr><tr><td><mark style="color:purple;"><code>photo</code></mark></td><td><em>string</em></td><td>Used on photos of people, nature, architecture, etc. taken with phones or digital cameras.</td></tr></tbody></table>

#### **Request example for Upscale:**

This code sample combines the use of `restorations` and `resizing` operations. For more details, see [Resizing](/image-editing-api/image-operations/resizing.md).

{% tabs %}
{% tab title="Smart Enhance" %}

```json
"operations": {
    "restorations": {
        "upscale": "smart_enhance"
    },
    "resizing": {
        "width": "200%",
        "height": "200%"
    }
}
```

![](/files/fCTeB4V5ScqaVMImELEI)
{% endtab %}

{% tab title="Smart Resize" %}

```json
"operations": {
    "restorations": {
        "upscale": "smart_resize"
    },
    "resizing": {
        "width": "200%",
        "height": "200%"
    }
}
```

![](/files/XpCdch3g7HIIcDDwx9dT)
{% endtab %}

{% tab title="Photo" %}

```json
"operations": {
    "restorations": {
        "upscale": "photo"
    },
    "resizing": {
        "width": "200%",
        "height": "200%"
    }
}
```

![](/files/9FduEpV8iITw3dfVW3Xl)
{% endtab %}

{% tab title="Faces" %}

```json
"operations": {
    "restorations": {
        "upscale": "faces"
    },
    "resizing": {
        "width": "200%",
        "height": "200%"
    }
}
```

![](/files/p7RrID3EVxM2w6ZLuFaS)
{% endtab %}

{% tab title="Digital Art" %}

```json
"operations": {
    "restorations": {
        "upscale": "digital_art"
    },
    "resizing": {
        "width": "200%",
        "height": "200%"
    }
}
```

![](/files/KI8Pby6Kf5v6khEuczDb)
{% endtab %}
{% endtabs %}

**Tip:** Click on the image to inspect it closer.

### Decompress

The decompress operation allows you to remove distortion and artifacts caused by image compression. It can be used in conjunction with the <mark style="color:purple;">`upscale`</mark> operation to prepare an image for upscaling.

Decompress is turned off by default. It can be configured by setting the <mark style="color:purple;">`decompress`</mark> object to either <mark style="color:purple;">`moderate`</mark> or <mark style="color:purple;">`strong`</mark>, depending on how heavily compressed images are. If you are not sure whether to apply a decompression – you can choose auto-select mode by setting the <mark style="color:purple;">`decompress`</mark> object to <mark style="color:purple;">`auto`</mark>.

**Possible values:**

| Value      | Type     | Description                                                 |
| ---------- | -------- | ----------------------------------------------------------- |
| `moderate` | *string* | Removes JPEG artifacts from the image.                      |
| `strong`   | *string* | Removes JPEG artifacts more aggressively than moderate.     |
| `auto`     | string   | Automatically detects and removes JPEG artifacts if needed. |

{% tabs %}
{% tab title="Moderate" %}

```json
"operations": {
  "restorations": {
    "decompress": "moderate"
  }
}
```

![](/files/UIclfdesYgMWisAhaMO3)
{% endtab %}

{% tab title="Strong" %}

```json
"operations": {
  "restorations": {
    "decompress": "strong"
  }
}
```

![](/files/ILBujnC7YJim5RZwdZ7K)
{% endtab %}

{% tab title="Auto" %}

```json
"operations": {
  "restorations": {
    "decompress": "auto"
  }
}
```

<figure><img src="/files/mYEr8pFXG8feSAHz3f1B" alt=""><figcaption></figcaption></figure>
{% endtab %}
{% endtabs %}

### Polish

The polish operation allows you to redraw image parts making them sharper, yet keeping the original structure. It can be used individually, or in conjunction with the [#upscale](#upscale "mention") (we recommend [#smart-enhance](#smart-enhance "mention") upscale) operation to make the image look even sharper and more realistic.&#x20;

{% hint style="warning" %}
`polish` operation currently has size limitations: the target image size must not exceed 16 MP (e.g., 4096 x 4096 pixels, 5000 x 3500 pixels). Our team is working on increasing max size.
{% endhint %}

#### Request example of polishing an image:

```json
"operations": {
  "restorations": {
    "polish": true
  }
}
```

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