# Image I/O

### Input

Our API supports several options to provide source images that need to be processed.

#### HTTP(S) URL

URL of the input image should be from 1 to 512 characters. The image must be accessible by our system.

```json
{
    "input": "https://letsenhance.io/docs/assets/samples/burger.jpg"
}
```

#### &#x20;Image upload

Our API also supports the ability to upload image content directly. Just make sure that all respective headers are set. See [Upload API Reference](https://docs.claid.ai/image-editing-api/upload-api-reference) for more info.

#### Connected storage

You can connect [Cloud Storage](https://docs.claid.ai/storage-connectors) and use it as a source for images. Currently, our API supports AWS S3 and Google Cloud Storage.

After connecting your Cloud Storage, you can refer the storage name as an input.

```json
{
    "input": "storage://storage-name/path/image-name.jpg"
}
```

#### Input image file types

Our API supports the following image formats as inputs: BMP, GIF, JPEG, PNG, TIFF, WEBP, AVIF, and HEIC.

### Output

Configuration of result output is optional.&#x20;

By default, you may omit the output option from the request payload. In this case, our system stores the result in a temporary bucket with a lifespan of 24 hours and provides a public URL to the image.

Alternatively, you can use a connected [Cloud Storage](https://docs.claid.ai/storage-connectors): just configure the path to the folder where you want to store results.

#### Output image file types

The following image formats are supported for the output: JPEG, PNG, TIFF, WEBP and AVIF.

#### Basic and advanced output options

{% tabs %}
{% tab title="Basic Usage" %}

```json
{
    "output": "storage://storage-name/result-path/image-name.jpg"
}
```

{% endtab %}

{% tab title="Advanced Usage" %}

```json
"output": {
    "destination": "storage://storage-name/result-path/image-name.jpg",
    "format": "jpeg",
    "metadata": {
        "dpi": 300,
        "color_space": {
            "type": "CMYK",
            "color_profile": "ISO_Coated"
        }
    }
}
```

{% endtab %}

{% tab title="Advanced Format Usage" %}

```json
"output": {
    "destination": "storage://storage-name/result-path/image-name.jpg",
    "format": {
        "type": "jpeg",
        "quality": 85,
        "progressive": true
    }
}

```

{% endtab %}
{% endtabs %}

&#x20;See the full list of the advanced format-specific options below:

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

<table><thead><tr><th width="164">Name</th><th width="101">Type</th><th>Description</th></tr></thead><tbody><tr><td><mark style="color:purple;"><code>quality</code></mark></td><td><em>integer</em></td><td>Specifies the amount of JPEG lossy compression in the range 1 - 100. Defaults to <strong>85</strong>.</td></tr><tr><td><mark style="color:purple;"><code>progressive</code></mark></td><td><em>boolean</em></td><td>Progressive JPEG loads in a browser in successive waves until a clear picture is formed, thus improving the image loading speed. Used by default.</td></tr></tbody></table>
{% endtab %}

{% tab title="png" %}

<table><thead><tr><th width="163">Name</th><th width="102">Type</th><th>Description</th></tr></thead><tbody><tr><td><mark style="color:purple;"><code>compression</code></mark></td><td><em>string</em></td><td><p>Indicates compression effort that will be applied during the PNG image encoding. Should have one of the values:</p><ul><li><mark style="color:purple;"><code>fast</code></mark> is used to apply minimum compression resulting in a bigger image size but less processing time.</li><li><mark style="color:purple;"><code>best</code></mark> is used to apply maximum compression resulting in a smaller image size but more processing time.</li><li><mark style="color:purple;"><code>optimal</code></mark> is the <strong>default</strong> and used to balance between compression effort and processing time.</li></ul></td></tr></tbody></table>
{% endtab %}

{% tab title="tiff" %}

<table><thead><tr><th width="164">Name</th><th width="101">Type</th><th>Description</th></tr></thead><tbody><tr><td><mark style="color:purple;"><code>compression</code></mark></td><td>string,<br>object</td><td><p></p><p>The TIFF codec supports both lossless and lossy modes of operation, so you can select the one that is appropriate for your goals. Should have one of the values:</p><ul><li><mark style="color:purple;"><code>lossy</code></mark> is used to apply lossy compression to significantly reduce the image size in exchange for some loss of data, reducing the quality of an image. JPEG compression is used.</li><li><mark style="color:purple;"><code>{"type": "lossy", "quality": 1..100}</code></mark> is used to apply lossy compression and specify the amount of loss you are willing to accept. Defaults to <strong>75</strong>.</li><li><mark style="color:purple;"><code>lossless</code></mark> is used to apply lossless compression to preserve maximum image detail in exchange for a significantly increased file size. Lempel–Ziv–Welch (LZW) compression is used.</li></ul><p>By default, <mark style="color:purple;"><code>lossless</code></mark> is used if <mark style="color:purple;"><code>compression</code></mark> is not selected.</p></td></tr></tbody></table>
{% endtab %}

{% tab title="avif" %}

<table><thead><tr><th width="164">Name</th><th width="101">Type</th><th>Description</th></tr></thead><tbody><tr><td><mark style="color:purple;"><code>compression</code></mark></td><td>string,<br>object</td><td><p></p><p>The AVIF codec supports both lossless and lossy modes of operation, so you can select the one that is appropriate for your goals. Should have one of the values:</p><ul><li><mark style="color:purple;"><code>lossy</code></mark> is used to apply lossy compression to significantly reduce the image size in exchange for some loss of data, reducing the quality of an image.</li><li><mark style="color:purple;"><code>{"type": "lossy", "quality": 1..100}</code></mark> is used to apply lossy compression and specify the amount of loss you are willing to accept. Defaults to <strong>50</strong>.</li><li><mark style="color:purple;"><code>lossless</code> i</mark>s used to apply lossless compression to preserve maximum image detail in exchange for a significantly increased file size. </li></ul></td></tr></tbody></table>
{% endtab %}

{% tab title="webp" %}

<table><thead><tr><th width="164">Name</th><th width="101">Type</th><th>Description</th></tr></thead><tbody><tr><td><mark style="color:purple;"><code>compression</code></mark></td><td>string,<br>object</td><td><p></p><p>The WEBP format supports both lossless and lossy modes of operation, so you can select the one that is appropriate for your goals. Should have one of the values:</p><ul><li><mark style="color:purple;"><code>lossy</code></mark> is used to apply lossy compression to significantly reduce the image size in exchange for some loss of data, reducing the quality of an image.</li><li><mark style="color:purple;"><code>{"type": "lossy", "quality": 1..100}</code></mark> is used to apply lossy compression and specify the amount of loss you are willing to accept. Defaults to <strong>75</strong>.</li><li><mark style="color:purple;"><code>lossless</code> i</mark>s used to apply lossless compression to preserve maximum image detail in exchange for a significantly increased file size. </li></ul></td></tr></tbody></table>
{% endtab %}
{% endtabs %}

#### Color space

The API supports changing color space for an output image.

```json
"output": {
    "destination": "storage://storage-name/result-path/image-name.jpg",
    "metadata": {
        "color_space": "RGB"
    }
}
```

If you do not specify a color space or color profile when making a request, the API automatically takes care of preserving color space. For images in RGB, the API keeps the RGB color space and assigns the standard sRGB profile to the output. For images in CMYK or GRAY, the API keeps the original color space and also carries over any embedded color profile that was present in the input. This way, the output image stays visually consistent with the source image.

<table><thead><tr><th width="123.33333333333331">Name</th><th width="117">Type</th><th>Description</th></tr></thead><tbody><tr><td><mark style="color:purple;"><code>RGB</code></mark></td><td><em>string</em></td><td>Is the color space for digital images. Use the RGB color mode if your image is supposed to be displayed on any kind of screen.</td></tr><tr><td><mark style="color:purple;"><code>CMYK</code></mark></td><td><em>string</em></td><td>Is the color space for printed materials. Use CMYK for any image that will be physically printed, not viewed on a screen.</td></tr></tbody></table>

&#x20;For CMYK color space, you also can specify the color profile that will be applied to the image.&#x20;

```json
"output": {
    "destination": "storage://storage-name/result-path/image-name.jpg",
    "metadata": {
        "color_space": {
            "type": "CMYK",
            "color_profile": "ISO_Coated"
        }
    }
}
```

<table><thead><tr><th width="196.33333333333331">Name</th><th width="77">Type</th><th width="210">Description</th><th width="77">TAC *</th><th>Characterisation data</th></tr></thead><tbody><tr><td><mark style="color:purple;"><code>ISO_Coated</code></mark></td><td><em>string</em></td><td>Standard for glossy and matte coated paper (grades 1 and 2).</td><td>330%</td><td>Coated FOGRA39<br><em>ISO 12647-2:2004</em></td></tr><tr><td><mark style="color:purple;"><code>ISO_Uncoated</code></mark></td><td><em>string</em></td><td>Standard for uncoated white natural paper (grade 4).</td><td>300%</td><td>Uncoated FOGRA29<br><em>ISO 12647-2:2004</em></td></tr><tr><td><mark style="color:purple;"><code>USWeb_Coated</code></mark></td><td><em>string</em></td><td>Standard for glossy and matte coated paper in the United States (grades 1, 2, 3 and 4).</td><td>300%</td><td>SWOP2006 Coated3v2<br><em>CGATS TR003</em></td></tr><tr><td><mark style="color:purple;"><code>USWeb_Uncoated</code></mark></td><td><em>string</em></td><td>Standard for uncoated white natural paper in the United States (grade 4).</td><td>260%</td><td>GRACoL 2013 Uncoated<br><em>CGATS21-2-CRPC3</em></td></tr></tbody></table>

{% hint style="info" %}
\* "Total Area Coverage” – or TAC for short – refers to the amount of ink coverage called for in a given area of an image. It's calculated by summing the **C**yan, **M**agenta, **Y**ellow and Blac**k** percentages in that area.
{% endhint %}

{% hint style="warning" %}
Color space is only supported in <mark style="color:purple;">`JPEG`</mark> format.
{% endhint %}


---

# 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-i-o.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.
