# Enhancing documents

### Using image edit generation models

Generative document upscaling can enhance legibility and recover fine details from low‑resolution scans, improving OCR accuracy, searchability, and archival quality while reducing manual cleanup. It also enables consistent formatting across batches and can adaptively sharpen text, diagrams, and stamps better than traditional interpolation. However, it may introduce hallucinated artifacts, alter original content fidelity, or over‑smooth important marks, which is risky for legal or compliance contexts. The results can be biased by the training data and are sensitive to input quality, and the process can be compute‑intensive, requiring careful validation and human review for critical documents.

Having such small document image

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

```json
{
    "url": "https://s3.eu-central-1.amazonaws.com/deep-image.ai/api-examples/tax-office-233345_1280-small.jpg",
    "preset": "enhance_document"
}
```

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

### Using text\_x4 upscale model

"text\_x4" is a model that is specifically optimized for upscaling and enhancing images containing text. This feature is ideal for images such as documents, scanned text, or any visuals with embedded text that require high readability and clarity after upscaling. Using advanced AI models trained on text-focused data, this endpoint allows you to upscale images while preserving and enhancing text details, making text sharper and easier to read at higher resolutions.

Usage:

```json
{
    "url": "https://s3.eu-central-1.amazonaws.com/deep-image.ai/api-examples/tax-office-233345_1280-small.jpg",
    "width": "400%",
    "upscale_parameters": {
        "type": "text_x4"
    }
}
```

and the result

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

While using normal upscale effect is:

<figure><img src="/files/5UTEk1EEPSQZRcxE8H6d" 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://documentation.deep-image.ai/common-usecases/enhancing-documents.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.
