qcms
Firefox's library for transforming image data between ICC profiles.
Example
// Decode the jpeg
let mut d = new;
let mut data = d.decode.unwrap;
let info = d.info.unwrap;
// Extract the profile after decode
let profile = d.icc_profile.unwrap;
// Create a new qcms Profile
let input = new_from_slice.unwrap;
let mut output = new_sRGB;
output.precache_output_transform;
// Create a transform between input and output profiles and apply it.
let xfm = new.unwrap;
xfm.apply;
// write the result to a PNG
let mut encoder = new;
encoder.set_color;
encoder.set_srgb;
let mut writer = encoder.write_header.unwrap;
writer.write_image_data.unwrap; // Save
This library was originally written in C, was converted to Rust using c2rust, and then refactored to be mostly safe and more idiomatic Rust.