#xyz #lab #hsv #hsl #color-conversion #luv

colorutils-rs

High performance utilities for color format handling and conversion

34 releases

new 0.4.10 Jun 22, 2024
0.4.9 Jun 21, 2024
0.3.5 Jun 10, 2024
0.2.11 Jun 5, 2024
0.1.4 May 19, 2024

#178 in Images

Download history 129/week @ 2024-05-13 14/week @ 2024-05-20 849/week @ 2024-05-27 955/week @ 2024-06-03 1276/week @ 2024-06-10 846/week @ 2024-06-17

3,926 downloads per month
Used in 3 crates

Apache-2.0 OR BSD-3-Clause

560KB
14K SLoC

Rust utilities for color handling and conversion.

Allows conversion between

  • Rgb/Rgba/Rgba1010102/Rgb565/RgbF16
  • HSL
  • HSV
  • LAB
  • LUV
  • XYZ
  • Sigmoidal

Performance

There are some prebuilt functions for ex.

srgb_to_lab(src_bytes, width * components, &mut lab_store, width * 3 * std::mem::size_of::<f32>() as u32, width, height);

Prebuilt solutions ~3-5 times faster than naive implementation. If your case fits that you prebuilt function. Speed increasing done with AVX, NEON and SSE, if you are disabled or not using CPU with this features then you won't receive any benefits.

Also, fma target feature for x86-64 is available.

Target feature at compile time +avx2 must be activated to properly compile avx2 instructions. This is an important step even when runtime dispatch are used.

Dependencies

~250KB