Mscms.Core
1.6.0
See the version list below for details.
dotnet add package Mscms.Core --version 1.6.0
NuGet\Install-Package Mscms.Core -Version 1.6.0
<PackageReference Include="Mscms.Core" Version="1.6.0" />
paket add Mscms.Core --version 1.6.0
#r "nuget: Mscms.Core, 1.6.0"
// Install Mscms.Core as a Cake Addin
#addin nuget:?package=Mscms.Core&version=1.6.0
// Install Mscms.Core as a Cake Tool
#tool nuget:?package=Mscms.Core&version=1.6.0
Mscms.Core
Color Management Engine for .Net based on Windows Color System
Colors displayed by .Net applications are not color managed, this library fills the gap by integrating the WCS (Windows Color System) introduced by Windows Vista.
The first step for accurate colors is to calibrate the monitor with a calibration software (ex. DisplayCal) and an hardware device (ex. instruments by Calibrite, Datacolor, etc..). A Color Profile file (.icm) for your monitor will be installed after the calibration.
As an example the Color Profile may contains data to map the sRGB color (255,0,0) to the value RGB (240,0,0) if you monitor is able to display a RED that is more saturated than the RED defined by the sRGB standard.
After this step color-managed apps (ex. Adobe Photoshop) can use the installed Color Profile to display accurate colors.
What about other apps? They show partially corrected colors because only some corrections (ex. Gamma Curve 1D LUT) are loaded into the GPU and OS-independent.
If your .Net app is looking for accurate colors, this is the right place to be. This library will do all the hard work for you.
Why Windows Color System?
Windows Color System is integrated in the OS and supports advanced Color Profiles containing LUTs, Matrix, etc.. that other Color Engines (for ex. the one used by Gimp) are not able to fully process. LittleCMS is a common free alternative for C/C++ softwares.
How this library works?
The whole app is not automatically color-managed because there is usually no need for this. Only images or specific areas need to be color-managed.
To translate a color using the monitor assigned profile a simple ColorHelper.ToManagedColor() method is all you need.
byte[] sRgb = new byte[] { 248, 218, 69 };
byte[] rgb = ColorHelper.ToManagedColor(sRgb);
The package Mscms.WPF offers additional extension methods to easily work with Colors and Images: ToManagedColor() and ToManagedImage().
Color managed = Color.FromRgb(248, 218, 69).ToManagedColor();
BitmapImage managedImage = new BitmapImage(..).ToManagedImage();
Additional classes are available to specify the Input/Output Profile, the Rendering Intent and additional options.
Full Advanced Example:
using Mscms;
using System.Diagnostics;
Console.WriteLine("\nAdvanced Example");
byte[] sRgb = new byte[] { 248, 218, 69 };
var monitor = Mscms.Monitor.FromWindow(Process.GetCurrentProcess().MainWindowHandle);
using (var input = Profile.FromSRGBColorSpace())
using (var output = Profile.FromMonitor(monitor))
using (var transform = Mscms.Transform.Create(input, output, RenderingIntent.INTENT_PERCEPTUAL, CmsFlags.BEST_MODE | CmsFlags.PRESERVEBLACK))
{
Console.WriteLine($"Input Profile: {Path.GetFileName(input.Filename)}");
Console.WriteLine($"Monitor: {monitor.Device}");
Console.WriteLine($"Output Profile: {Path.GetFileName(output.Filename)}");
Console.WriteLine($"Rendering Intent: {transform.RenderingIntent}");
Console.WriteLine($"Flags: {transform.Flags}");
byte[] rgb = ColorHelper.ToManagedColor(sRgb, transform);
Console.WriteLine($"Unmanaged color: {sRgb[0]} {sRgb[1]} {sRgb[2]}");
Console.WriteLine($"Managed color: {rgb[0]} {rgb[1]} {rgb[2]}");
}
Commercial License
This Library and it's source-code is not free to use for commercial projects. Please contact the Author at leonardo@majinsoft.com to obtain a commercial license.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Mscms.Core:
Package | Downloads |
---|---|
Mscms.WPF
Color Management Engine for WPF based on Windows Color System |
GitHub repositories
This package is not used by any popular GitHub repositories.