.NET bindings for Little CMS (http://www.littlecms.com/)
The following software is required if you want only to use this library:
- Little CMS >= 2.9
The following applications are needed to build this library:
To use on Windows, make sure that lcms2.dll
is in the DLL search path, e.g. the PATH environment variable.
To use on Linux see the API Reference documentation on the Little CMS web site for installation instructions.
This library is available as a NuGet package too.
To build this library you need to install the .NET Core SDK.
To build the library, run the following command in the project folder:
dotnet build -c Release
A successful build will put the resulting library in
..\..\bin\netstandard2.0
To use this library in your project add the following statement to your source code:
using lcmsNET;
Console.WriteLine(Cms.EncodedCMMVersion);
void HandleError(IntPtr contextID, int errorCode, string errorText)
{
// do something with the error, e.g. log it to file
}
Cms.SetErrorHandler(HandleError);
...
// restore default error handler
Cms.SetErrorHandler(null);
using (var profile = Profile.Open(profilePath, "r"))
{
// do something with the profile
}
using (var input = Profile.Open(inputProfilePath, "r"))
using (var output = Profile.Open(outputProfilePath, "r"))
using (var transform = Transform.Create(input, Cms.TYPE_RGB_8, output, Cms.TYPE_RGB_8,
Intent.Perceptual, CmsFlags.None))
{
byte[] source = ....
byte[] dest = new byte[source.Length];
transform.DoTransform(source, dest, pixelCount);
}
See the unit tests for examples of how to invoke each supported method and property.
- Improved documentation