Crate imx

Source
Expand description

IMX: Image Processing and Manipulation Library

This crate provides a comprehensive set of tools for image processing, manipulation, and visualization. It includes functionality for:

  • Image processing operations (resizing, format conversion, transparency handling)
  • JPEG XL format support and conversion
  • Numerical operations for image data
  • XY plotting capabilities for data visualization

§Features

  • Efficient image processing with support for common operations
  • JPEG XL format handling with conversion to PNG
  • Letterboxing removal and transparency handling
  • Data visualization through XY plotting

§Example

use std::path::PathBuf;
use imx::{process_image, PlotConfig, create_plot, LabelAlignment};
use anyhow::Result;

async fn example() -> Result<()> {
    // Process an image
    let path = PathBuf::from("input.jpg");
    process_image(path, |p| async move {
        // Process the image here
        Ok(())
    }).await?;
     
    // Create a plot
    let config = PlotConfig {
        images: vec![PathBuf::from("image1.png")],
        output: PathBuf::from("output.png"),
        rows: 1,
        row_labels: vec![],
        column_labels: vec![],
        column_label_alignment: LabelAlignment::Center,
        row_label_alignment: LabelAlignment::Center,
        debug_mode: false,
        top_padding: 40,
        left_padding: 40,
        font_size: None,
    };
    create_plot(&config)?;
     
    Ok(())
}

Re-exports§

pub use formats::ImageFormatOptions;
pub use formats::convert_image;
pub use formats::convert_images_batch;
pub use image_processing::get_image_dimensions;
pub use image_processing::is_image_file;
pub use image_processing::process_image;
pub use image_processing::remove_letterbox;
pub use image_processing::remove_letterbox_with_threshold;
pub use image_processing::remove_transparency;
pub use jxl::convert_jxl_to_png;
pub use jxl::is_jxl_file;
pub use jxl::process_jxl_file;
pub use layout::Layout;
pub use layout::LayoutElement;
pub use layout::LayoutRect;
pub use xyplot::LabelAlignment;
pub use xyplot::PlotConfig;
pub use xyplot::create_plot;

Modules§

formats
Image format conversion module with support for various formats Image format conversion module.
image_processing
Image processing module providing functions for image manipulation, format conversion, and various transformations. Image processing module for handling various image formats and transformations.
jxl
JPEG XL format support module with functions for handling JXL files and converting them to other formats.
layout
Layout module for debugging and visualizing image grid layouts
numeric
Numerical operations module for image data processing and analysis. Numeric type conversion utilities with safety guarantees.
xyplot
XY plotting module for creating visualizations and graphs.