# Enhance lighting and colors

Image lighting, colors and contrast can be also enhanced. It can be done with 3 types of enhancements: light, color and white\_balance.

```json
{
    "enhancements": ["light", "color", "white_balance", "exposure_correction"]
}
```

Those types of enhancements can be parametrized further.

```json
    "light_parameters": {
        "type": "contrast", // "hdr_light" | "hdr_light_advanced"
        "level": 0.8
    },

    "color_parameters": {
        "type": "contrast", // "hdr_light" | "hdr_light_advanced",
        "level": 0.8
    },

    "white_balance_parameters": {
        "level": 0.8
    }
```

### Types of light and colors algorithms

Let's check the various combinations of light algorithms enhancements.

Our input image:

<figure><img src="https://2652559519-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3i5YcUkcXyIsWHIhRO2d%2Fuploads%2Fp4YBSzAfZw1grBHmX2mD%2Fbride-1486004_1920.jpg?alt=media&#x26;token=0b7d0ce9-f838-41f1-9b48-f6426aeea4a8" alt=""><figcaption></figcaption></figure>

The results of 3 light enhancement types.

{% tabs %}
{% tab title="hdr\_light\_andvanced" %}

```json
{
    "url": "https://deep-image.ai/api-example3.jpg",
    "enhancements": ["light"],
    "light_parameters": {
        "type": "hdr_light_advanced",
        "level": 1
    }
}
```

<figure><img src="https://2652559519-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3i5YcUkcXyIsWHIhRO2d%2Fuploads%2F9nUCQYKtZ20qHQhGEINV%2Fbride-1486004_1920-light-100%25.jpg?alt=media&#x26;token=e943e0c7-31ef-4f7a-af57-f49f2166755a" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="hdr\_light" %}

```json
{
    "url": "https://deep-image.ai/api-example3.jpg",
    "enhancements": ["light"],
    "light_parameters": {
        "type": "hdr_light",
        "level": 1
    }
}
```

<figure><img src="https://2652559519-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3i5YcUkcXyIsWHIhRO2d%2Fuploads%2FqczpHW2T8NlJE8EuXUfY%2Fbride-1486004_1920-enhance_light.jpg?alt=media&#x26;token=3b756a6c-97b3-4351-b2ae-89c5d72df762" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="contrast" %}

```json
{
    "url": "https://deep-image.ai/api-example3.jpg",
    "enhancements": ["light"],
    "light_parameters": {
        "type": "contrast",
        "level": 1
    }
}
```

<figure><img src="https://2652559519-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3i5YcUkcXyIsWHIhRO2d%2Fuploads%2FwprTBt0K4szEwFfDKwwc%2Fbride-1486004_1920-enhance_light_contrast.jpg?alt=media&#x26;token=fa10632a-360b-4281-baa0-b980cbc3f2be" alt=""><figcaption></figcaption></figure>
{% endtab %}
{% endtabs %}

The input image which is little bit desaturated.

<figure><img src="https://2652559519-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3i5YcUkcXyIsWHIhRO2d%2Fuploads%2FvYdWOuObGCcMdBZMOeDQ%2Fbride-1486004_1920-enhance_light-des.jpg?alt=media&#x26;token=4cdd06af-2e74-4584-bfae-6f1e0798aa56" alt=""><figcaption></figcaption></figure>

The results of color enhancements

{% tabs %}
{% tab title="hdr\_light\_andvanced" %}

```json
{
    "url": "https://deep-image.ai/api-example3.jpg",
    "enhancements": ["color"],
    "color_parameters": {
        "type": "hdr_light_advanced",
        "level": 1
    }
}
```

<figure><img src="https://2652559519-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3i5YcUkcXyIsWHIhRO2d%2Fuploads%2Fm5JdHwSPwrsL3TMjQ5RX%2Fbride-1486004_1920-enhance_light-des-light-1%25_color-100%25.jpg?alt=media&#x26;token=c37a72ce-c728-4ea1-b71e-f74b7bec014f" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="hdr\_light" %}

```json
{
    "url": "https://deep-image.ai/api-example3.jpg",
    "enhancements": ["color"],
    "color_parameters": {
        "type": "hdr_light",
        "level": 1
    }
}
```

<figure><img src="https://2652559519-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3i5YcUkcXyIsWHIhRO2d%2Fuploads%2Fmaq5GxHPoEGoI9VkT3Ve%2Fbride-1486004_1920-enhance_light-des-enhance_light_color-100%25.jpg?alt=media&#x26;token=f7ef51bb-f30b-414e-85a8-f1e2cc658352" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="contrast" %}

```json
{
    "url": "https://deep-image.ai/api-example3.jpg",
    "enhancements": ["color"],
    "color_parameters": {
        "type": "contrast",
        "level": 1
    }
}
```

<figure><img src="https://2652559519-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3i5YcUkcXyIsWHIhRO2d%2Fuploads%2FRwMBIyACw8LMJBoEfQ5O%2Fbride-1486004_1920-enhance_light-des-enhance_light_contrast_color-100%25.jpg?alt=media&#x26;token=baa949b7-f6dc-4678-ad1a-e92317e63dc7" alt=""><figcaption></figcaption></figure>
{% endtab %}
{% endtabs %}

Combining all together.

{% tabs %}
{% tab title="hdr\_light\_andvanced" %}

```json
{
    "url": "https://deep-image.ai/api-example3.jpg",
    "enhancements": ["light","color"],
    "light_parameters": {
        "type": "hdr_light_advanced",
        "level": 1
    },
    "color_parameters": {
        "type": "hdr_light_advanced",
        "level": 1
    }
}
```

<figure><img src="https://2652559519-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3i5YcUkcXyIsWHIhRO2d%2Fuploads%2F0c6iR7d498KhxWSb3x2Q%2Fbride-1486004_1920-upscaled_x2_light-100%25_color-100%25.jpg?alt=media&#x26;token=b77e6a63-ba16-4ca8-ab98-82c5ac546960" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="hdr\_light" %}

```json
{
    "url": "https://deep-image.ai/api-example3.jpg",
    "enhancements": ["light","color"],
    "light_parameters": {
        "type": "hdr_light",
        "level": 1
    },
    "color_parameters": {
        "type": "hdr_light",
        "level": 1
    }
}
```

<figure><img src="https://2652559519-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3i5YcUkcXyIsWHIhRO2d%2Fuploads%2F4EMNCWrUvh9Gr5B5sPx7%2Fbride-1486004_1920-upscaled_x2_enhance_light_color-100%25.jpg?alt=media&#x26;token=8c64e95a-9413-4c45-bc2c-ac967ac15272" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="contrast" %}

```json
{
    "url": "https://deep-image.ai/api-example3.jpg",
    "enhancements": ["light","color"],
    "light_parameters": {
        "type": "contrast",
        "level": 1
    },
    "color_parameters": {
        "type": "contrast",
        "level": 1
    }
}
```

<figure><img src="https://2652559519-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3i5YcUkcXyIsWHIhRO2d%2Fuploads%2FrvKkp9k1WeKYfIFGm2L5%2Fbride-1486004_1920-upscaled_x2_enhance_light_contrast_color-100%25.jpg?alt=media&#x26;token=6eeefc8a-1932-41fa-8270-3eafe1a4d9dc" alt=""><figcaption></figcaption></figure>
{% endtab %}
{% endtabs %}

### White balance correction

White balance can be also automatically fixed if it went wrong with camera's settings.

<figure><img src="https://2652559519-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3i5YcUkcXyIsWHIhRO2d%2Fuploads%2FWYHoWBuEdbHD2iXtT0rN%2F4987720360_4334b28e5f_o%20(1)-1.jpg?alt=media&#x26;token=ead6da5d-027e-44a5-9bb2-370b369c1aa1" alt=""><figcaption></figcaption></figure>

```json
{
    "enhancements": ["white_balance"]
}
```

<figure><img src="https://2652559519-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3i5YcUkcXyIsWHIhRO2d%2Fuploads%2FJ0myNPD9m8Bk3Nw3veV6%2F4987720360_4334b28e5f_o%20(1)-1-.jpg?alt=media&#x26;token=1a720d6a-9a7c-4feb-9bf0-81f362d489cf" alt=""><figcaption></figcaption></figure>

### Exposure correction

Exposure can be corrected with "**exposure\_correction**" enhancement type. This algorithm works different than previous "**light**" enhancement. It corrects image globally with amending its with gamma correction.

```json
    "enhancements": ["exposure_correction"]
```

<figure><img src="https://2652559519-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3i5YcUkcXyIsWHIhRO2d%2Fuploads%2FmWe6ehxHfmL7wlh5Y9WL%2Fimage.png?alt=media&#x26;token=15b297d8-5690-4c7a-8a0f-9b8c7af2c8f0" alt=""><figcaption><p><a href="https://deep-image.ai/api-example3.jpg">https://deep-image.ai/api-example3.jpg</a> exposure corrected</p></figcaption></figure>
