# Ideogram

> Ideogram Layerize takes an existing flat graphic, removes text, and returns structured text containers you can edit/recompose in html or json format.


## Overview

- **Endpoint**: `https://fal.run/fal-ai/ideogram/v3/layerize-text`
- **Model ID**: `fal-ai/ideogram/v3/layerize-text`
- **Category**: image-to-image
- **Kind**: inference
**Tags**: stylized, transform, typography



## Pricing

- **Price**: $0.09 per images

For more details, see [fal.ai pricing](https://fal.ai/pricing).

## API Information

This model can be used via our HTTP API or more conveniently via our client libraries.
See the input and output schema below, as well as the usage examples.


### Input Schema

The API accepts the following input parameters:


- **`image_url`** (`string`, _required_):
  URL of the flat graphic image to layerize. Must be JPEG, PNG, or WebP (max 10MB).
  - Examples: "https://v3.fal.media/files/lion/0qJs_qW8nz0wYsXhFa6Tk.png"

- **`prompt`** (`string`, _optional_):
  Optional prompt to guide the layerization.

- **`seed`** (`integer`, _optional_):
  Seed for the random number generator.

- **`font_file_h1_url`** (`string`, _optional_):
  URL of the font file to use for h1 text. Cannot be used with font_name_h1.

- **`font_name_h1`** (`string`, _optional_):
  Name of the font to use for h1 text. Cannot be used with font_file_h1_url.

- **`font_file_h2_url`** (`string`, _optional_):
  URL of the font file to use for h2 text. Cannot be used with font_name_h2.

- **`font_name_h2`** (`string`, _optional_):
  Name of the font to use for h2 text. Cannot be used with font_file_h2_url.

- **`font_file_body_url`** (`string`, _optional_):
  URL of the font file to use for body text. Cannot be used with font_name_body.

- **`font_name_body`** (`string`, _optional_):
  Name of the font to use for body text. Cannot be used with font_file_body_url.

- **`font_file_small_url`** (`string`, _optional_):
  URL of the font file to use for small text. Cannot be used with font_name_small.

- **`font_name_small`** (`string`, _optional_):
  Name of the font to use for small text. Cannot be used with font_file_small_url.

- **`sync_mode`** (`boolean`, _optional_):
  If `True`, the media will be returned as a data URI and the output data won't be available in the request history.
  - Default: `false`



**Required Parameters Example**:

```json
{
  "image_url": "https://v3.fal.media/files/lion/0qJs_qW8nz0wYsXhFa6Tk.png"
}
```


### Output Schema

The API returns the following output format:

- **`image`** (`File`, _required_):
  The background image with text removed.

- **`prompt`** (`string`, _required_):
  The prompt used for layerization. May differ from the input prompt if MagicPrompt expanded it.

- **`text_containers`** (`list<object>`, _optional_):
  Structured text containers with hierarchical text data (container -> items -> spans).
  - Array of object

- **`text_html`** (`string`, _optional_):
  Rendered overlay HTML for compositing text over the background image.

- **`image_layers`** (`list<object>`, _optional_):
  Image layers extracted from the design.
  - Array of object

- **`seed`** (`integer`, _required_):
  Seed used for the random number generator.
  - Examples: 123456



**Example Response**:

```json
{
  "image": {
    "url": "",
    "content_type": "image/png",
    "file_name": "z9RV14K95DvU.png",
    "file_size": 4404019
  },
  "prompt": "",
  "seed": 123456
}
```


## Usage Examples

### cURL

```bash
curl --request POST \
  --url https://fal.run/fal-ai/ideogram/v3/layerize-text \
  --header "Authorization: Key $FAL_KEY" \
  --header "Content-Type: application/json" \
  --data '{
     "image_url": "https://v3.fal.media/files/lion/0qJs_qW8nz0wYsXhFa6Tk.png"
   }'
```

### Python

Ensure you have the Python client installed:

```bash
pip install fal-client
```

Then use the API client to make requests:

```python
import fal_client

def on_queue_update(update):
    if isinstance(update, fal_client.InProgress):
        for log in update.logs:
           print(log["message"])

result = fal_client.subscribe(
    "fal-ai/ideogram/v3/layerize-text",
    arguments={
        "image_url": "https://v3.fal.media/files/lion/0qJs_qW8nz0wYsXhFa6Tk.png"
    },
    with_logs=True,
    on_queue_update=on_queue_update,
)
print(result)
```

### JavaScript

Ensure you have the JavaScript client installed:

```bash
npm install --save @fal-ai/client
```

Then use the API client to make requests:

```javascript
import { fal } from "@fal-ai/client";

const result = await fal.subscribe("fal-ai/ideogram/v3/layerize-text", {
  input: {
    image_url: "https://v3.fal.media/files/lion/0qJs_qW8nz0wYsXhFa6Tk.png"
  },
  logs: true,
  onQueueUpdate: (update) => {
    if (update.status === "IN_PROGRESS") {
      update.logs.map((log) => log.message).forEach(console.log);
    }
  },
});
console.log(result.data);
console.log(result.requestId);
```


## Additional Resources

### Documentation

- [Model Playground](https://fal.ai/models/fal-ai/ideogram/v3/layerize-text)
- [API Documentation](https://fal.ai/models/fal-ai/ideogram/v3/layerize-text/api)
- [OpenAPI Schema](https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/ideogram/v3/layerize-text)

### fal.ai Platform

- [Platform Documentation](https://docs.fal.ai)
- [Python Client](https://docs.fal.ai/clients/python)
- [JavaScript Client](https://docs.fal.ai/clients/javascript)
