spectro-rs

Crates.iospectro-rs
lib.rsspectro-rs
version0.3.6
created_at2025-12-24 11:04:18.525793+00
updated_at2026-01-23 05:54:17.886859+00
descriptionA high-performance Rust driver for X-Rite ColorMunki spectrometers
homepage
repositoryhttps://github.com/Tinnci/spectro-rs
max_upload_size
id2002988
size297,944
SiTinc (Tinnci)

documentation

README

🌈 spectro-rs

Crates.io Docs.rs License: GPL v3

A high-performance Rust driver for X-Rite ColorMunki spectrometers. This library provides a safe, cross-platform interface for color measurement, display calibration, and spectral analysis.

✨ Features

  • Cross-platform: Windows, macOS, and Linux support
  • Multi-mode Measurement: Reflective, Emissive (Monitor), and Ambient modes
  • Colorimetry Engine: CIE XYZ, L*a*b*, CCT, and Delta E (76/2000) calculations
  • Calibration Persistence: Automatically saves and loads calibration data
  • Internationalization: Built-in English and Chinese support

📦 Installation

Add to your Cargo.toml:

[dependencies]
spectro-rs = "0.3"

🚀 Quick Start

use spectro_rs::{discover, MeasurementMode};

fn main() -> spectro_rs::Result<()> {
    // Auto-discover connected spectrometer
    let mut device = discover()?;
    
    // Print device info
    let info = device.info()?;
    println!("Found: {} ({})", info.model, info.serial);
    
    // Calibrate (required for reflective mode)
    device.calibrate()?;
    
    // Take a measurement
    let spectrum = device.measure(MeasurementMode::Reflective)?;
    
    // Convert to colorimetric values
    let xyz = spectrum.to_xyz();
    let lab = xyz.to_lab(spectro_rs::colorimetry::illuminant::D65_2);
    
    println!("L*={:.2}, a*={:.2}, b*={:.2}", lab.l, lab.a, lab.b);
    Ok(())
}

📖 Documentation

Full API documentation is available on docs.rs.

⚠️ Driver Setup

  • Windows: Use Zadig to install the WinUSB driver.
  • Linux: Add appropriate udev rules for USB access.

🔗 Related

⚖️ License

Licensed under the GNU General Public License v3.0.

Commit count: 118

cargo fmt