# Bria

> Structure Reference allows generating new images while preserving the structure of an input image, guided by text prompts. Perfect for transforming sketches, illustrations, or photos into new illustrations. Trained exclusively on licensed data for safe and risk-free commercial use.


## Overview

- **Endpoint**: `https://fal.run/fal-ai/bria/reimagine`
- **Model ID**: `fal-ai/bria/reimagine`
- **Category**: image-to-image
- **Kind**: inference


## Pricing

- **Price**: $0.04 per generations

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:


- **`prompt`** (`string`, _required_):
  The prompt you would like to use to generate images.
  - Examples: "A 2d illustration of a dog in a vibrant park"

- **`structure_image_url`** (`string`, _optional_):
  The URL of the structure reference image. Use "" to leave empty. Accepted formats are jpeg, jpg, png, webp. Default value: `""`
  - Default: `""`
  - Examples: "https://storage.googleapis.com/falserverless/bria/bria_reimagine_input.png"

- **`structure_ref_influence`** (`float`, _optional_):
  The influence of the structure reference on the generated image. Default value: `0.75`
  - Default: `0.75`
  - Examples: 0.15

- **`num_results`** (`integer`, _optional_):
  How many images you would like to generate. When using any Guidance Method, Value is set to 1. Default value: `1`
  - Default: `1`
  - Range: `1` to `4`

- **`seed`** (`integer`, _optional_):
  The same seed and the same prompt given to the same version of the model
  will output the same image every time.
  - Range: `0` to `2147483647`

- **`fast`** (`boolean`, _optional_):
  Whether to use the fast model Default value: `true`
  - Default: `true`

- **`num_inference_steps`** (`integer`, _optional_):
  The number of iterations the model goes through to refine the generated image. This parameter is optional. Default value: `30`
  - Default: `30`
  - Range: `20` to `50`

- **`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
{
  "prompt": "A 2d illustration of a dog in a vibrant park"
}
```

**Full Example**:

```json
{
  "prompt": "A 2d illustration of a dog in a vibrant park",
  "structure_image_url": "https://storage.googleapis.com/falserverless/bria/bria_reimagine_input.png",
  "structure_ref_influence": 0.15,
  "num_results": 1,
  "fast": true,
  "num_inference_steps": 30
}
```


### Output Schema

The API returns the following output format:

- **`images`** (`list<Image>`, _required_):
  The generated images
  - Array of Image
  - Examples: [{"url":"https://storage.googleapis.com/falserverless/bria/bria_reimagine_output.png","content_type":"image/png"}]

- **`seed`** (`integer`, _required_):
  Seed value used for generation.



**Example Response**:

```json
{
  "images": [
    {
      "url": "https://storage.googleapis.com/falserverless/bria/bria_reimagine_output.png",
      "content_type": "image/png"
    }
  ]
}
```


## Usage Examples

### cURL

```bash
curl --request POST \
  --url https://fal.run/fal-ai/bria/reimagine \
  --header "Authorization: Key $FAL_KEY" \
  --header "Content-Type: application/json" \
  --data '{
     "prompt": "A 2d illustration of a dog in a vibrant park"
   }'
```

### 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/bria/reimagine",
    arguments={
        "prompt": "A 2d illustration of a dog in a vibrant park"
    },
    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/bria/reimagine", {
  input: {
    prompt: "A 2d illustration of a dog in a vibrant park"
  },
  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/bria/reimagine)
- [API Documentation](https://fal.ai/models/fal-ai/bria/reimagine/api)
- [OpenAPI Schema](https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/bria/reimagine)

### 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)
