# Object Remover

Remove unwanted objects from images using AI.

## Description

Upload an image and specify the object to remove. Google Gemini 2.5 Flash Image (nano-banana) will intelligently remove the object and fill the space with realistic content that matches the surrounding area.

## Authentication

**Required**: x402 payment

This endpoint requires payment via the x402 protocol. See the [Setup](./setup.md) for setup instructions.

## Request

**Endpoint**: `POST /api/object-remover/remove`

**Content-Type**: `multipart/form-data`

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| image | file | Yes | Input image (JPEG, PNG, or WebP, max 10MB) |
| targetDescription | string | No | Description of the object to remove (e.g., "the person on the left", "the red car") |

## Response

**200 OK**

```json
{
  "imageUrl": "/outputs/uuid-here.png"
}
```

| Field | Type | Description |
|-------|------|-------------|
| imageUrl | string | Path to the processed image with object removed |

## Error Codes

| Status | Code | Description |
|--------|------|-------------|
| 400 | VALIDATION_ERROR | No image provided |
| 402 | PAYMENT_REQUIRED | x402 payment not completed |
| 413 | FILE_TOO_LARGE | File exceeds 10MB limit |
| 415 | UNSUPPORTED_FORMAT | File type not allowed (only JPEG, PNG, WebP) |
| 500 | INTERNAL_ERROR | AI generation failed |
| 504 | AI_GENERATION_TIMEOUT | AI request timed out |

## Examples

### Remove a specific object

```bash
npx x402-proxy -X POST \
  -F "image=@photo.jpg" \
  -F "targetDescription=the person on the left" \
  https://ps.codejar.net/api/object-remover/remove
```

### Remove watermark or text

```bash
npx x402-proxy -X POST \
  -F "image=@photo-with-watermark.jpg" \
  -F "targetDescription=the watermark in the corner" \
  https://ps.codejar.net/api/object-remover/remove
```

### Auto-detect and remove (removes most prominent object)

```bash
npx x402-proxy -X POST \
  -F "image=@photo.jpg" \
  https://ps.codejar.net/api/object-remover/remove
```

**Response:**
```json
{
  "imageUrl": "/outputs/550e8400-e29b-41d4-a716-446655440004.png"
}
```

## Use Cases

- **Photo Editing**: Remove unwanted objects, people, or distractions from photos
- **Watermark Removal**: Clean up images for professional use
- **Real Estate**: Remove personal belongings or vehicles from property photos
- **E-commerce**: Remove price tags, stickers, or unrelated items from product images
- **Travel Photos**: Remove tourists or unwanted elements from landmark photos
