# 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](https://docs.claid.ai/image-editing-api/image-operations/resizing) 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](https://docs.claid.ai/image-editing-api/image-operations/resizing).

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

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

![](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FDoQE5oZM8JuNHyC32Bcw%2FRestorations%20-%20Upscale%20-%20Smart%20Enhance.png?alt=media\&token=19ffcfcc-70f3-4965-ab54-d54c92f7e96b)
{% endtab %}

{% tab title="Smart Resize" %}

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

![](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FlkIKC9A5KqCs6ILDogkF%2FRestorations%20-%20Upscale%20-%20Smart%20Resize.png?alt=media\&token=b3d78dfc-7e72-4cc7-8570-abddecf6effd)
{% endtab %}

{% tab title="Photo" %}

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

![](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FvXKXbjaVQBqel2gA8bRw%2FRestorations%20-%20Upscale%20-%20Photo.png?alt=media\&token=4e0f3d23-cddd-4494-9726-e9311b8e9401)
{% endtab %}

{% tab title="Faces" %}

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

![](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FzktP52W6qsgP60mZy2Ts%2FRestorations%20-%20Upscale%20-%20Faces.png?alt=media\&token=55201493-bf89-4709-a01d-e83c1e1d629d)
{% endtab %}

{% tab title="Digital Art" %}

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

![](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FFAGj51JVeZYnRlUTO7K4%2FRestorations%20-%20Upscale%20-%20Digital%20Art.png?alt=media\&token=16ca8dbe-9f64-4d44-89db-613485edf0aa)
{% 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"
  }
}
```

![](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2F7o7FFHmBtr0cazZMEERP%2FRestorations%20-%20Decompress%20-%20Moderate.png?alt=media\&token=0eb1bd9a-6136-4891-ae5d-e4c61e82889b)
{% endtab %}

{% tab title="Strong" %}

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

![](https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2F9FyvcMB6XdikJlbod24u%2FRestorations%20-%20Decompress%20-%20Strong.png?alt=media\&token=fa1cca94-9f11-4824-b8e6-ad58650ebf35)
{% endtab %}

{% tab title="Auto" %}

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

<figure><img src="https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FOC8vjUxsZNUlVmjNoGl1%2FRestorations%20-%20Decompress%20-%20Conditional.png?alt=media&#x26;token=0f5d4b39-f345-45ad-a906-4b90580744cc" 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="https://1549088094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrPciCr3QshdCGkhkBgKD%2Fuploads%2FsCM9QWGLvh7boT1lUIzx%2FRestorations%20-%20Polishing.png?alt=media&#x26;token=0a1dc0e8-1b17-4709-b635-77283ef9197f" 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.claid.ai/image-editing-api/image-operations/restorations.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.
