liboxen 0.53.0

Oxen is a fast data version control system, built with machine learning training data in mind. Designed to handle terabytes of data with ease, using a workflow similar to git. Version both structured and unstructured data of any modality: text, images, video, audio, CSV, Parquet, JSONL, model checkpoints, and more. liboxen is the embeddable core library behind the oxen CLI and server, which power fine tuning and inference pipelines for multimodal LLMs, image models, and video models on Oxen.ai.
use serde::{Deserialize, Serialize};
use utoipa::{IntoParams, ToSchema};

#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq, ToSchema)]
pub enum ImgColorSpace {
    // 8-bit
    RGB,
    RGBA,
    Grayscale,
    GrayscaleAlpha,

    // 16-bit
    Rgb16,
    Rgba16,
    Grayscale16,
    GrayscaleAlpha16,

    // 32-bit float
    Rgb32F,
    Rgba32F,

    Unknown,
}

#[derive(Deserialize, Serialize, Debug, Clone, ToSchema)]
pub struct MetadataImage {
    pub image: MetadataImageImpl,
}

#[derive(Deserialize, Serialize, Debug, Clone, ToSchema)]
pub struct MetadataImageImpl {
    pub width: u32,
    pub height: u32,
    pub color_space: Option<ImgColorSpace>,
}

#[derive(Deserialize, Debug, IntoParams, ToSchema)]
pub struct ImgResize {
    pub width: Option<u32>,
    pub height: Option<u32>,
}

impl MetadataImage {
    pub fn new(width: u32, height: u32) -> Self {
        Self {
            image: MetadataImageImpl {
                width,
                height,
                color_space: None,
            },
        }
    }
}

impl std::fmt::Display for MetadataImage {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        write!(
            f,
            "MetadataImage({}x{})",
            self.image.width, self.image.height
        )
    }
}