Module formats

Source
Expand description

Image format conversion module with support for various formats Image format conversion module.

This module provides comprehensive support for converting between different image formats supported by the image crate. It includes:

  • Format detection and validation
  • Format conversion with quality control
  • Batch processing capabilities
  • Progress reporting through logging

§Examples

use std::path::Path;
use imx::formats::{convert_image, ImageFormatOptions};

async fn convert_to_webp() -> anyhow::Result<()> {
    let input = Path::new("input.png");
    let output = Path::new("output.webp");
     
    // Convert with default options
    convert_image(input, output, None).await?;
     
    // Convert with custom options
    let options = ImageFormatOptions::webp()
        .with_quality(85)
        .with_lossless(false);
    convert_image(input, output, Some(options)).await?;
     
    Ok(())
}

Structs§

ImageFormatOptions
Options for controlling image format conversion.

Functions§

convert_image
Convert an image from one format to another.
convert_images_batch
Convert multiple images in a batch operation.
detect_format_from_extension
Detect the image format from a file extension.