#icc #color #profile #sys #lcms

sys lcms2-sys

Bindings for liblcms2 (Little CMS) with support for Linux, macOS, and Windows. See lcms2 crate for a safe Rust wrapper

19 stable releases

4.0.4 Nov 23, 2023
4.0.2 Aug 24, 2023
4.0.1 Apr 5, 2023
4.0.0 Sep 22, 2022
0.5.0 Jul 16, 2016

#596 in Images

Download history 1990/week @ 2023-08-11 1904/week @ 2023-08-18 3393/week @ 2023-08-25 3820/week @ 2023-09-01 4661/week @ 2023-09-08 5290/week @ 2023-09-15 3827/week @ 2023-09-22 4795/week @ 2023-09-29 4395/week @ 2023-10-06 3866/week @ 2023-10-13 3415/week @ 2023-10-20 3212/week @ 2023-10-27 5453/week @ 2023-11-03 3505/week @ 2023-11-10 2605/week @ 2023-11-17 2378/week @ 2023-11-24

14,566 downloads per month
Used in 20 crates (3 directly)

MIT license

26K SLoC

C 24K SLoC // 0.1% comments Rust 1.5K SLoC // 0.0% comments

Little CMS bindings for Rust

Makes LCMS C API available in Rust. There's also a higher-level wrapper.

It's up to date with version 2.16, and works with older versions too. Linux, macOS and Windows are supported. Other platforms may work, too.

The crate requires Rust 1.65 or later.

Differences from the C API

This crate improves bindgen's bindings to be a bit more Rust-friendly:

  • Type names don't have the cms prefix, e.g. cmsColorSpace is ColorSpace.
    • All C function names remained the same (with the prefix, e.g. fn cmsReadTag()).
  • Enum values don't have the cmsSig prefix, e.g. cmsSigLabData is LabData.
  • Some arguments use more specific types, e.g. Intent::Perceptual enum instead of INTENT_PERCEPTUAL integer.

Dynamic vs static linking configuration

If LCMS2_LIB_DIR environmental variable is set, and the path contains either a static or dynamic library, this libary will be used regardless of other settings.

If LCMS2_STATIC environmental variable is set, it will prefer static linking instead.

The package supports "static" and "dynamic" Cargo features. If "dynamic" is enabled (the default) then it will link to system-wide LCMS2 shared library if pkg-config is installed and working correctly. Typically you will also need a lcms2-dev or similar package installed on the system.

If pkg-config doesn't work (e.g. on Windows), or the "static" feature is enabled, it will build bundled LCMS 2.15 from source instead.

For Rust build scripts using this sys crate as a dependency, Cargo will set DEP_LCMS2_INCLUDE env var to joined paths of include dirs where lcms2.h may be found. This is only relevant if you compile C code using the library directly.


This repo uses git submodules, which can be annoying. Make sure you clone with git clone --recursive, or run:

git submodule update --init