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

colorutils-rs

High performance utilities for color format handling and conversion

45 releases (4 breaking)

new 0.5.4 Jul 22, 2024
0.5.3 Jul 22, 2024
0.4.16 Jul 20, 2024
0.4.10 Jun 22, 2024
0.1.4 May 19, 2024

#231 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 58/week @ 2024-06-24 4/week @ 2024-07-01 363/week @ 2024-07-08 265/week @ 2024-07-15

738 downloads per month
Used in 3 crates

Apache-2.0 OR BSD-3-Clause

680KB
16K SLoC

Rust utilities for color handling and conversion.

Allows conversion between

  • Rgb/Rgba/Rgba1010102/Rgb565/RgbF16
  • HSL
  • HSV
  • CIE LAB
  • CIE LUV
  • CIE LCh
  • XYZ
  • Sigmoidal
  • Oklab
  • Oklch
  • Jzazbz
  • Jzczhz

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

~735KB
~17K SLoC