Skip to main content

ImageBackend

Trait ImageBackend 

Source
pub trait ImageBackend: Sync {
    // Required methods
    fn identify(&self, path: &Path) -> Result<Dimensions, BackendError>;
    fn read_metadata(&self, path: &Path) -> Result<ImageMetadata, BackendError>;
    fn resize(&self, params: &ResizeParams) -> Result<(), BackendError>;
    fn thumbnail(&self, params: &ThumbnailParams) -> Result<(), BackendError>;
}
Expand description

Trait for image processing backends.

Every backend must implement all four operations — identify, read_metadata, resize, and thumbnail — so the rest of the codebase is backend-agnostic. See the module docs for the parity table.

Required Methods§

Source

fn identify(&self, path: &Path) -> Result<Dimensions, BackendError>

Get image dimensions.

Source

fn read_metadata(&self, path: &Path) -> Result<ImageMetadata, BackendError>

Read embedded IPTC/EXIF metadata (title, description).

Source

fn resize(&self, params: &ResizeParams) -> Result<(), BackendError>

Execute a resize operation.

Source

fn thumbnail(&self, params: &ThumbnailParams) -> Result<(), BackendError>

Execute a thumbnail operation (resize + center crop).

Implementors§