# Operations (sample payloads)

## Main operations

### Resize Image

Resize an image to specified dimensions with various fit modes.
**Sample Input**

```json
{
    "image": {
        "name": "product-photo.jpg",
        "url": "https://example.com/files/product-photo.jpg",
        "mime_type": "image/jpeg",
        "expires": 1762300800
    },
    "width": 500,
    "height": 500,
    "fit": "contain",
    "background": "#FFFFFF",
    "maintainAspectRatio": true,
    "withoutEnlargement": false
}
```

**Sample Output**

```json
{
    "file": {
        "name": "resized_product-photo.jpeg",
        "url": "https://example.com/files/resized_product-photo.jpeg",
        "mime_type": "image/jpeg",
        "expires": 1762322400
    },
    "width": 500,
    "height": 500,
    "format": "jpeg",
    "size": 48213
}
```

### Convert Format

Convert an image to a different format (JPEG, PNG, WebP, AVIF, TIFF, GIF).
**Sample Input**

```json
{
    "image": {
        "name": "product-photo.png",
        "url": "https://example.com/files/product-photo.png",
        "mime_type": "image/png",
        "expires": 1762300800
    },
    "format": "webp",
    "quality": 85
}
```

**Sample Output**

```json
{
    "file": {
        "name": "product-photo.webp",
        "url": "https://example.com/files/product-photo.webp",
        "mime_type": "image/webp",
        "expires": 1762322400
    },
    "format": "webp",
    "size": 131072,
    "width": 1024,
    "height": 768
}
```

### Adjust Quality

Adjust the quality/compression level of an image.
**Sample Input**

```json
{
    "image": {
        "name": "product-photo.jpg",
        "url": "https://example.com/files/product-photo.jpg",
        "mime_type": "image/jpeg",
        "expires": 1762300800
    },
    "quality": 60
}
```

**Sample Output**

```json
{
    "file": {
        "name": "product-photo.jpeg",
        "url": "https://example.com/files/product-photo.jpeg",
        "mime_type": "image/jpeg",
        "expires": 1762322400
    },
    "format": "jpeg",
    "size": 210944,
    "width": 4032,
    "height": 3024
}
```

### Get Metadata

Extract metadata from an image (dimensions, format, color space, etc.).
**Sample Input**

```json
{
    "image": {
        "name": "product-photo.jpg",
        "url": "https://example.com/files/product-photo.jpg",
        "mime_type": "image/jpeg",
        "expires": 1762300800
    }
}
```

**Sample Output**

```json
{
    "width": 4032,
    "height": 3024,
    "format": "jpeg",
    "size": 2457600,
    "space": "srgb",
    "channels": 3,
    "depth": "uchar",
    "density": 72,
    "hasAlpha": false,
    "orientation": 6
}
```
