Skip to content

Commit 601b118

Browse files
committed
Merge branch 'trc' into 'main'
Add ICC profile support (TRC transforms, Input device, Display device) See merge request Wacton/Unicolour!71
2 parents 93ff867 + 7e64e5d commit 601b118

File tree

103 files changed

+30131
-735
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+30131
-735
lines changed

README.md

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![GitLab](https://badgen.net/static/gitlab/source/ff1493?icon=gitlab)](https://gitlab.com/Wacton/Unicolour)
44
[![NuGet](https://badgen.net/nuget/v/Wacton.Unicolour?icon)](https://www.nuget.org/packages/Wacton.Unicolour/)
55
[![pipeline status](https://gitlab.com/Wacton/Unicolour/badges/main/pipeline.svg)](https://gitlab.com/Wacton/Unicolour/-/commits/main)
6-
[![tests passed](https://badgen.net/static/tests/188,115/green/)](https://gitlab.com/Wacton/Unicolour/-/pipelines)
6+
[![tests passed](https://badgen.net/static/tests/216,552/green/)](https://gitlab.com/Wacton/Unicolour/-/pipelines)
77
[![coverage report](https://gitlab.com/Wacton/Unicolour/badges/main/coverage.svg)](https://gitlab.com/Wacton/Unicolour/-/pipelines)
88

99
Unicolour is the most comprehensive .NET library for working with colour:
@@ -404,13 +404,30 @@ var navyCmyk = new Unicolour(config, new Channels(1.0, 1.0, 0.0, 0.5));
404404
Console.WriteLine(navyCmyk.Rgb.Byte255); // 46 37 87
405405
```
406406

407-
Only ICC profiles that meet the following criteria are supported:
408-
409-
| Restriction | Criteria | Tag signature |
410-
|---------------|----------------------|-------------------------------------------------------------------------------------|
411-
| Device class | Output or ColorSpace | `prtr` or `spac` |
412-
| PCS | CIELAB or CIEXYZ | `Lab ` or `XYZ ` |
413-
| Transform | A2B and B2A | `A2B0` and `B2A0` (`A2B1` `B2A1` and `A2B2` `B2A2` are used accordingly if present) |
407+
The following tables summarise which ICC profiles are compatible with Unicolour:
408+
409+
| | Profile version |
410+
|---|-------------------|
411+
|| 2 |
412+
|| 4 |
413+
|| 5 / iccMAX |
414+
415+
| | Profile/device class |
416+
|---|----------------------|
417+
|| Input `scnr` |
418+
|| Display `mntr` |
419+
|| Output `prtr` |
420+
|| ColorSpace `spac` |
421+
|| DeviceLink `link` |
422+
|| Abstract `abst` |
423+
|| NamedColor `nmcl` |
424+
425+
| | Transform |
426+
|---|---------------------------------------------------------------------|
427+
|| AToB / BToA `A2B0` `A2B1` `A2B2` `B2A0` `B2A1` `B2A2` |
428+
|| TRC matrix `rTRC` `gTRC` `bTRC` `rXYZ` `gXYZ` `bXYZ` |
429+
|| TRC grey `kTRC` |
430+
|| DToB / BToD `D2B0` `D2B1` `D2B2` `D2B3` `B2D0` `B2D1` `B2D2` `B2D3` |
414431

415432
A wider variety of ICC profiles will be supported in future releases.
416433
If a problem is encountered using an ICC profile that meets the above criteria, please [raise an issue](https://github.com/waacton/Unicolour/issues).
@@ -627,7 +644,7 @@ When a [conversion to or from XYZ space](#convert-between-colour-spaces) involve
627644

628645
### Convert between configurations
629646
A `Unicolour` can be converted to a different configuration,
630-
in turn enabling conversions between different RGB models, XYZ white points, CAM viewing conditions, etc.
647+
in turn enabling conversions between different RGB models, XYZ white points, CAM viewing conditions, ICC profiles, etc.
631648

632649
```c#
633650
/* pure sRGB green */
@@ -790,4 +807,4 @@ var mapped = Colourmaps.Viridis.Map(0.5);
790807

791808
---
792809

793-
[Wacton.Unicolour](https://github.com/waacton/Unicolour) is licensed under the [MIT License](https://choosealicense.com/licenses/mit/), copyright © 2022-2024 William Acton.
810+
[Wacton.Unicolour](https://github.com/waacton/Unicolour) is licensed under the [MIT License](https://choosealicense.com/licenses/mit/), copyright © 2022-2025 William Acton.

Unicolour.Readme/README.md

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![GitLab](https://badgen.net/static/gitlab/source/ff1493?icon=gitlab)](https://gitlab.com/Wacton/Unicolour)
44
[![NuGet](https://badgen.net/nuget/v/Wacton.Unicolour?icon)](https://www.nuget.org/packages/Wacton.Unicolour/)
55
[![pipeline status](https://gitlab.com/Wacton/Unicolour/badges/main/pipeline.svg)](https://gitlab.com/Wacton/Unicolour/-/commits/main)
6-
[![tests passed](https://badgen.net/static/tests/188,115/green/)](https://gitlab.com/Wacton/Unicolour/-/pipelines)
6+
[![tests passed](https://badgen.net/static/tests/216,552/green/)](https://gitlab.com/Wacton/Unicolour/-/pipelines)
77
[![coverage report](https://gitlab.com/Wacton/Unicolour/badges/main/coverage.svg)](https://gitlab.com/Wacton/Unicolour/-/pipelines)
88

99
Unicolour is the most comprehensive .NET library for working with colour:
@@ -404,13 +404,30 @@ var navyCmyk = new Unicolour(config, new Channels(1.0, 1.0, 0.0, 0.5));
404404
Console.WriteLine(navyCmyk.Rgb.Byte255); // 46 37 87
405405
```
406406

407-
Only ICC profiles that meet the following criteria are supported:
408-
409-
| Restriction | Criteria | Tag signature |
410-
|---------------|----------------------|-------------------------------------------------------------------------------------|
411-
| Device class | Output or ColorSpace | `prtr` or `spac` |
412-
| PCS | CIELAB or CIEXYZ | `Lab ` or `XYZ ` |
413-
| Transform | A2B and B2A | `A2B0` and `B2A0` (`A2B1` `B2A1` and `A2B2` `B2A2` are used accordingly if present) |
407+
The following tables summarise which ICC profiles are compatible with Unicolour:
408+
409+
| | Profile version |
410+
|---|-------------------|
411+
|| 2 |
412+
|| 4 |
413+
|| 5 / iccMAX |
414+
415+
| | Profile/device class |
416+
|---|----------------------|
417+
|| Input `scnr` |
418+
|| Display `mntr` |
419+
|| Output `prtr` |
420+
|| ColorSpace `spac` |
421+
|| DeviceLink `link` |
422+
|| Abstract `abst` |
423+
|| NamedColor `nmcl` |
424+
425+
| | Transform |
426+
|---|---------------------------------------------------------------------|
427+
|| AToB / BToA `A2B0` `A2B1` `A2B2` `B2A0` `B2A1` `B2A2` |
428+
|| TRC matrix `rTRC` `gTRC` `bTRC` `rXYZ` `gXYZ` `bXYZ` |
429+
|| TRC grey `kTRC` |
430+
|| DToB / BToD `D2B0` `D2B1` `D2B2` `D2B3` `B2D0` `B2D1` `B2D2` `B2D3` |
414431

415432
A wider variety of ICC profiles will be supported in future releases.
416433
If a problem is encountered using an ICC profile that meets the above criteria, please [raise an issue](https://github.com/waacton/Unicolour/issues).
@@ -627,7 +644,7 @@ When a [conversion to or from XYZ space](#convert-between-colour-spaces) involve
627644

628645
### Convert between configurations
629646
A `Unicolour` can be converted to a different configuration,
630-
in turn enabling conversions between different RGB models, XYZ white points, CAM viewing conditions, etc.
647+
in turn enabling conversions between different RGB models, XYZ white points, CAM viewing conditions, ICC profiles, etc.
631648

632649
```c#
633650
/* pure sRGB green */
@@ -790,4 +807,4 @@ var mapped = Colourmaps.Viridis.Map(0.5);
790807

791808
---
792809

793-
[Wacton.Unicolour](https://github.com/waacton/Unicolour) is licensed under the [MIT License](https://choosealicense.com/licenses/mit/), copyright © 2022-2024 William Acton.
810+
[Wacton.Unicolour](https://github.com/waacton/Unicolour) is licensed under the [MIT License](https://choosealicense.com/licenses/mit/), copyright © 2022-2025 William Acton.

Unicolour.Readme/README_nuget.md

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![GitLab](https://badgen.net/static/gitlab/source/ff1493?icon=gitlab)](https://gitlab.com/Wacton/Unicolour)
44
[![NuGet](https://badgen.net/nuget/v/Wacton.Unicolour?icon)](https://www.nuget.org/packages/Wacton.Unicolour/)
55
[![pipeline status](https://gitlab.com/Wacton/Unicolour/badges/main/pipeline.svg)](https://gitlab.com/Wacton/Unicolour/-/commits/main)
6-
[![tests passed](https://badgen.net/static/tests/188,115/green/)](https://gitlab.com/Wacton/Unicolour/-/pipelines)
6+
[![tests passed](https://badgen.net/static/tests/216,552/green/)](https://gitlab.com/Wacton/Unicolour/-/pipelines)
77
[![coverage report](https://gitlab.com/Wacton/Unicolour/badges/main/coverage.svg)](https://gitlab.com/Wacton/Unicolour/-/pipelines)
88

99
Unicolour is the most comprehensive .NET library for working with colour:
@@ -295,13 +295,30 @@ var navyCmyk = new Unicolour(config, new Channels(1.0, 1.0, 0.0, 0.5));
295295
Console.WriteLine(navyCmyk.Rgb.Byte255); // 46 37 87
296296
```
297297
298-
Only ICC profiles that meet the following criteria are supported:
299-
300-
| Restriction | Criteria | Tag signature |
301-
|---------------|----------------------|-------------------------------------------------------------------------------------|
302-
| Device class | Output or ColorSpace | `prtr` or `spac` |
303-
| PCS | CIELAB or CIEXYZ | `Lab ` or `XYZ ` |
304-
| Transform | A2B and B2A | `A2B0` and `B2A0` (`A2B1` `B2A1` and `A2B2` `B2A2` are used accordingly if present) |
298+
The following tables summarise which ICC profiles are compatible with Unicolour:
299+
300+
| | Profile version |
301+
|---|-------------------|
302+
|| 2 |
303+
|| 4 |
304+
|| 5 / iccMAX |
305+
306+
| | Profile/device class |
307+
|---|----------------------|
308+
|| Input `scnr` |
309+
|| Display `mntr` |
310+
|| Output `prtr` |
311+
|| ColorSpace `spac` |
312+
|| DeviceLink `link` |
313+
|| Abstract `abst` |
314+
|| NamedColor `nmcl` |
315+
316+
| | Transform |
317+
|---|---------------------------------------------------------------------|
318+
|| AToB / BToA `A2B0` `A2B1` `A2B2` `B2A0` `B2A1` `B2A2` |
319+
|| TRC matrix `rTRC` `gTRC` `bTRC` `rXYZ` `gXYZ` `bXYZ` |
320+
|| TRC grey `kTRC` |
321+
|| DToB / BToD `D2B0` `D2B1` `D2B2` `D2B3` `B2D0` `B2D1` `B2D2` `B2D3` |
305322
306323
A wider variety of ICC profiles will be supported in future releases.
307324
If a problem is encountered using an ICC profile that meets the above criteria, please [raise an issue](https://github.com/waacton/Unicolour/issues).
@@ -466,7 +483,7 @@ When a [conversion to or from XYZ space](https://github.com/waacton/Unicolour#co
466483
467484
### Convert between configurations
468485
A `Unicolour` can be converted to a different configuration,
469-
in turn enabling conversions between different RGB models, XYZ white points, CAM viewing conditions, etc.
486+
in turn enabling conversions between different RGB models, XYZ white points, CAM viewing conditions, ICC profiles, etc.
470487
471488
```cs
472489
/* pure sRGB green */
@@ -630,4 +647,4 @@ var mapped = Colourmaps.Viridis.Map(0.5);
630647
631648
---
632649
633-
[Wacton.Unicolour](https://github.com/waacton/Unicolour) is licensed under the [MIT License](https://choosealicense.com/licenses/mit/), copyright © 2022-2024 William Acton.
650+
[Wacton.Unicolour](https://github.com/waacton/Unicolour) is licensed under the [MIT License](https://choosealicense.com/licenses/mit/), copyright © 2022-2025 William Acton.

Unicolour.Tests/ConfigureIccTests.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ public void ConvertBetweenIccProfiles(string sourceFileName, string destinationF
1515
var sourceFile = IccFile.Lookup[sourceFileName];
1616
var sourceIccConfig = new IccConfiguration(sourceFile.Path, Intent.Unspecified, "source");
1717
var sourceConfig = new Configuration(iccConfiguration: sourceIccConfig);
18-
var sourceCmyk = new double[sourceFile.DeviceChannels];
19-
for (var i = 0; i < sourceFile.DeviceChannels; i++)
18+
var sourceDeviceChannels = IccFile.GetDeviceChannels(sourceFile);
19+
var sourceCmyk = new double[sourceDeviceChannels];
20+
for (var i = 0; i < sourceDeviceChannels; i++)
2021
{
2122
sourceCmyk[i] = TestUtils.RandomDouble();
2223
}
444 KB
Binary file not shown.

0 commit comments

Comments
 (0)