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§
- Image
Format Options - 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.