# Photo Colorizer

Colorize black and white photos using AI.

## Description

Upload a black and white photo and automatically apply natural, realistic colors to produce a full-color image. The AI preserves the original composition and details while adding authentic skin tones, accurate clothing colors, and realistic environment hues.

## Authentication

**Required**: x402 payment

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

## Request

**Endpoint**: `POST /api/photo-colorizer/colorize`

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

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| image | file | Yes | Black and white input photo (JPEG, PNG, or WebP, max 10MB) |

## Response

**200 OK**

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

| Field | Type | Description |
|-------|------|-------------|
| imageUrl | string | Path to the colorized image |

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

## Example

```bash
npx x402-proxy -X POST \
  -F "image=@black-and-white-photo.jpg" \
  https://ps.codejar.net/api/photo-colorizer/colorize
```

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

## Use Cases

- **Historical Photos**: Bring old black and white family photos to life with realistic colors
- **Archival Work**: Colorize historical archive images for modern presentations
- **Creative Projects**: Add color to monochrome photography for artistic purposes
- **Educational Content**: Make vintage photographs more engaging for educational materials
