# Marigold V2 Depth

> Estimate depth from a single image with Marigold V2, a diffusion-based depth model built on Qwen-Image-Edit, returning a colorized depth map.


## Overview

- **Endpoint**: `https://fal.run/fal-ai/marigold-v2`
- **Model ID**: `fal-ai/marigold-v2`
- **Category**: image-to-image
- **Kind**: inference
**Description**: Estimate monocular depth from a single image with Marigold V2 by Huawei Bayer Lab. The model runs one deterministic forward pass and returns a colorized depth visualization (Spectral colormap) as a PNG. By default, the output matches the input image's dimensions rounded to the nearest multiple of 16. Optionally set image_size as a preset or an explicit width and height: both must be multiples of 16, at most 2048 pixels per side, with an aspect ratio between 1:16 and 16:1. Input images are limited to 2048 x 2048 pixels. The seed only affects the VAE encoder's latent sampling; the same seed and image reproduce the same output.

**Tags**: depth, utility



## Pricing

Your request will cost **$0.03** per image. The output size does not change the price.

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_):
  Input image url.
  - Examples: "https://storage.googleapis.com/falserverless/example_inputs/dog.png"

- **`image_size`** (`ImageSize | Enum`, _optional_):
  Inference size as an explicit `{width, height}` object or a preset string (e.g. `"square_hd"`, `"landscape_4_3"`). Both dimensions must be multiples of 16 and no larger than 2048 pixels on either side, with an aspect ratio between 1:16 and 16:1. Defaults to the input image's dimensions rounded to the nearest multiple of 16.
  - One of: ImageSize | Enum
  - Examples: {"height":512,"width":512}

- **`seed`** (`integer`, _optional_):
  Random seed. Only affects the VAE encoder's latent sampling (the forward pass itself is a single deterministic step); the same seed and image reproduce the same output.



**Required Parameters Example**:

```json
{
  "image_url": "https://storage.googleapis.com/falserverless/example_inputs/dog.png"
}
```

**Full Example**:

```json
{
  "image_url": "https://storage.googleapis.com/falserverless/example_inputs/dog.png",
  "image_size": {
    "height": 512,
    "width": 512
  }
}
```


### Output Schema

The API returns the following output format:

- **`image`** (`Image`, _required_):
  The colorized (Spectral colormap) depth visualization.

- **`seed`** (`integer`, _required_):
  The seed used for the VAE encoder's latent sampling.



**Example Response**:

```json
{
  "image": {
    "url": "",
    "content_type": "image/png",
    "file_name": "z9RV14K95DvU.png",
    "file_size": 4404019,
    "width": 1024,
    "height": 1024
  }
}
```


## Usage Examples

### cURL

```bash
curl --request POST \
  --url https://fal.run/fal-ai/marigold-v2 \
  --header "Authorization: Key $FAL_KEY" \
  --header "Content-Type: application/json" \
  --data '{
     "image_url": "https://storage.googleapis.com/falserverless/example_inputs/dog.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/marigold-v2",
    arguments={
        "image_url": "https://storage.googleapis.com/falserverless/example_inputs/dog.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/marigold-v2", {
  input: {
    image_url: "https://storage.googleapis.com/falserverless/example_inputs/dog.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/marigold-v2)
- [API Documentation](https://fal.ai/models/fal-ai/marigold-v2/api)
- [OpenAPI Schema](https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/marigold-v2)

### fal.ai Platform

- [Platform Documentation](https://fal.ai/docs/documentation)
- [Python Client](https://fal.ai/docs/api-reference/client-libraries/python)
- [JavaScript Client](https://fal.ai/docs/api-reference/client-libraries/javascript)

### Other agent-readable surfaces

This file covers one model. To find anything else:

- [Platform overview](https://fal.ai/llms.txt): Entry points and representative endpoint IDs
- [Documentation index](https://fal.ai/docs/llms.txt): Every documentation page
- [Full documentation text](https://fal.ai/docs/llms-full.txt): The whole documentation inlined
- Any other model: `https://fal.ai/models/<endpoint-id>/llms.txt`
