# finegrain eraser

> Finegrain Eraser removes any object selected with a bounding box—along with its shadows, reflections, and lighting artifacts—seamlessly reconstructing the scene with contextually accurate content.


## Overview

- **Endpoint**: `https://fal.run/fal-ai/finegrain-eraser/bbox`
- **Model ID**: `fal-ai/finegrain-eraser/bbox`
- **Category**: image-to-image
- **Kind**: inference
**Tags**: utility, editing



## Pricing

Your request will cost $0.09 with Express, $0.18 with Standard, and $0.27 with Premium.

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 image to edit
  - Examples: "https://v3.fal.media/files/elephant/IKqKIxDfRDK8fzeETCveO_erase_example01.jpg"

- **`box_prompts`** (`list<BoxPromptBase>`, _required_):
  List of bounding box coordinates to erase (only one box prompt is supported)
  - Array of BoxPromptBase

- **`mode`** (`ModeEnum`, _optional_):
  Erase quality mode Default value: `"standard"`
  - Default: `"standard"`
  - Options: `"express"`, `"standard"`, `"premium"`

- **`seed`** (`integer`, _optional_):
  Random seed for reproducible generation
  - Range: `0` to `999`



**Required Parameters Example**:

```json
{
  "image_url": "https://v3.fal.media/files/elephant/IKqKIxDfRDK8fzeETCveO_erase_example01.jpg",
  "box_prompts": [
    {}
  ]
}
```

**Full Example**:

```json
{
  "image_url": "https://v3.fal.media/files/elephant/IKqKIxDfRDK8fzeETCveO_erase_example01.jpg",
  "box_prompts": [
    {}
  ],
  "mode": "standard"
}
```


### Output Schema

The API returns the following output format:

- **`image`** (`File`, _required_):
  The edited image with content erased
  - Examples: {"url":"https://v3.fal.media/files/penguin/PpROj5BGoWMj0H6wb11aG_output.jpg"}

- **`used_seed`** (`integer`, _required_):
  Seed used for generation



**Example Response**:

```json
{
  "image": {
    "url": "https://v3.fal.media/files/penguin/PpROj5BGoWMj0H6wb11aG_output.jpg"
  }
}
```


## Usage Examples

### cURL

```bash
curl --request POST \
  --url https://fal.run/fal-ai/finegrain-eraser/bbox \
  --header "Authorization: Key $FAL_KEY" \
  --header "Content-Type: application/json" \
  --data '{
     "image_url": "https://v3.fal.media/files/elephant/IKqKIxDfRDK8fzeETCveO_erase_example01.jpg",
     "box_prompts": [
       {}
     ]
   }'
```

### 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/finegrain-eraser/bbox",
    arguments={
        "image_url": "https://v3.fal.media/files/elephant/IKqKIxDfRDK8fzeETCveO_erase_example01.jpg",
        "box_prompts": [{}]
    },
    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/finegrain-eraser/bbox", {
  input: {
    image_url: "https://v3.fal.media/files/elephant/IKqKIxDfRDK8fzeETCveO_erase_example01.jpg",
    box_prompts: [{}]
  },
  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/finegrain-eraser/bbox)
- [API Documentation](https://fal.ai/models/fal-ai/finegrain-eraser/bbox/api)
- [OpenAPI Schema](https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/finegrain-eraser/bbox)

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