# Post Processing

> Create chromatic aberration by shifting red, green, and blue channels horizontally or vertically with customizable shift amounts.


## Overview

- **Endpoint**: `https://fal.run/fal-ai/post-processing/chromatic-aberration`
- **Model ID**: `fal-ai/post-processing/chromatic-aberration`
- **Category**: image-to-image
- **Kind**: inference
**Tags**: stylized, transform



## Pricing

- **Price**: $0.001 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 image to process
  - Examples: "https://storage.googleapis.com/falserverless/web-examples/post-process/postpro-input.jpg"

- **`red_shift`** (`integer`, _optional_):
  Red channel shift amount
  - Default: `0`
  - Range: `-20` to `20`

- **`red_direction`** (`RedDirectionEnum`, _optional_):
  Red channel shift direction Default value: `"horizontal"`
  - Default: `"horizontal"`
  - Options: `"horizontal"`, `"vertical"`

- **`green_shift`** (`integer`, _optional_):
  Green channel shift amount
  - Default: `0`
  - Range: `-20` to `20`

- **`green_direction`** (`GreenDirectionEnum`, _optional_):
  Green channel shift direction Default value: `"horizontal"`
  - Default: `"horizontal"`
  - Options: `"horizontal"`, `"vertical"`

- **`blue_shift`** (`integer`, _optional_):
  Blue channel shift amount
  - Default: `0`
  - Range: `-20` to `20`

- **`blue_direction`** (`BlueDirectionEnum`, _optional_):
  Blue channel shift direction Default value: `"horizontal"`
  - Default: `"horizontal"`
  - Options: `"horizontal"`, `"vertical"`



**Required Parameters Example**:

```json
{
  "image_url": "https://storage.googleapis.com/falserverless/web-examples/post-process/postpro-input.jpg"
}
```

**Full Example**:

```json
{
  "image_url": "https://storage.googleapis.com/falserverless/web-examples/post-process/postpro-input.jpg",
  "red_direction": "horizontal",
  "green_direction": "horizontal",
  "blue_direction": "horizontal"
}
```


### Output Schema

The API returns the following output format:

- **`images`** (`list<Image>`, _required_):
  The processed images with chromatic aberration effect
  - Array of Image
  - Examples: [{"url":"https://v3.fal.media/files/tiger/KZJQ66Ebe9FCMNA28hX-m_cebbce060fd34aeb99c8c5531b6b63bc.png"}]



**Example Response**:

```json
{
  "images": [
    {
      "url": "https://v3.fal.media/files/tiger/KZJQ66Ebe9FCMNA28hX-m_cebbce060fd34aeb99c8c5531b6b63bc.png"
    }
  ]
}
```


## Usage Examples

### cURL

```bash
curl --request POST \
  --url https://fal.run/fal-ai/post-processing/chromatic-aberration \
  --header "Authorization: Key $FAL_KEY" \
  --header "Content-Type: application/json" \
  --data '{
     "image_url": "https://storage.googleapis.com/falserverless/web-examples/post-process/postpro-input.jpg"
   }'
```

### 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/post-processing/chromatic-aberration",
    arguments={
        "image_url": "https://storage.googleapis.com/falserverless/web-examples/post-process/postpro-input.jpg"
    },
    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/post-processing/chromatic-aberration", {
  input: {
    image_url: "https://storage.googleapis.com/falserverless/web-examples/post-process/postpro-input.jpg"
  },
  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/post-processing/chromatic-aberration)
- [API Documentation](https://fal.ai/models/fal-ai/post-processing/chromatic-aberration/api)
- [OpenAPI Schema](https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/post-processing/chromatic-aberration)

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