# De-Pixelation

Remove pixelation from images to enhance quality using AI.

## Description

Upload a pixelated image and automatically enhance it to produce a high-resolution, clear version. The AI removes pixelation artifacts while preserving all details and textures, making the image look naturally detailed and sharp.

## Authentication

**Required**: x402 payment

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

## Request

**Endpoint**: `POST /api/depixelation/depixelate`

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

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| image | file | Yes | Input image (JPEG, PNG, or WebP, max 10MB) |
| prompt | string | No | Custom instructions for de-pixelation |

## Response

**200 OK**

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

| Field | Type | Description |
|-------|------|-------------|
| imageUrl | string | Path to the de-pixelated 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 |

## Examples

### Remove pixelation from image

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

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

## Use Cases

- **Photo Enhancement**: Restore pixelated images to high quality
- **Archive Recovery**: Enhance old or low-resolution photos
- **Social Media**: Improve quality of compressed images
- **E-commerce**: Enhance product images for better presentation