# `PhoenixKit.Modules.Storage.VariantGenerator`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.87/lib/modules/storage/services/variant_generator.ex#L1)

Variant generation system for images and videos.

This module handles the creation of different variants (thumbnails, resizes,
quality adjustments) for uploaded files based on dimension configurations.

## Supported Operations

### Images
- Resize to specific dimensions
- Generate thumbnails (square crops)
- Quality adjustments
- Format conversion (JPEG, PNG, WebP)

### Videos
- Quality variants (360p, 720p, 1080p)
- Thumbnail extraction
- Format conversion (MP4)

## Dependencies

Requires external tools to be installed:
- Images: ImageMagick (`convert` and `identify` commands)
- Videos: FFmpeg

# `generate_variant`

Generates a specific variant for a file.

## Parameters

- `file` - The file struct
- `dimension` - The dimension configuration

## Returns

- `{:ok, file_instance}` - Generated variant
- `{:error, reason}` - Error if generation fails

# `generate_variants`

Generates variants for a file based on enabled dimensions.

## Parameters

- `file` - The file struct to generate variants for
- `opts` - Options for variant generation

## Options

- `:async` - Whether to generate variants asynchronously (default: true)
- `:dimensions` - List of specific dimensions to generate (default: all enabled)

## Returns

- `{:ok, variants}` - List of generated file instances
- `{:error, reason}` - Error if generation fails

---

*Consult [api-reference.md](api-reference.md) for complete listing*
