make-elles-profiles.c 66 KB
Newer Older
1 2
/* License:
 * 
3 4 5 6 7 8 9 10 11
 * Code for making well-behaved ICC profiles
 * Copyright © 2013, 2014, 2015 Elle Stone 
 * 
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
15
 * 
16 17 18 19 20
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 * 
 * Contact information:
21 22
 * ellestone@ninedegreesbelow.com
 * http://ninedegreesbelow.com
23
 * 
24 25
 * */

26
/* About the ICC profile header "Platform" tag:
27
 * 
28 29 30 31 32 33 34
 * When creating a profile, LCMS checks to see if the platform is 
 * Windows ('MSFT'). If your platform isn't Windows, LCMS defaults 
 * to using the Apple ('APPL') platform tag for the profile header.
 * 
 * There is an unofficial Platform 
 * cmsPlatformSignature cmsSigUnices 0x2A6E6978 '*nix'. There is, 
 * however, no LCMS2 API for changing the platform when making a profile.
35 36 37
 * 
 * So on my own computer, to replace 'APPL' with '*nix' in the header, 
 * I modified the LCMS source file 'cmsio0.c' and recompiled LCMS:
38 39 40 41 42 43
 * #ifdef CMS_IS_WINDOWS_
 * Header.platform= (cmsPlatformSignature) _cmsAdjustEndianess32(cmsSigMicrosoft);
 * #else
 * Header.platform= (cmsPlatformSignature) _cmsAdjustEndianess32(cmsSigUnices);
 * #endif
 * 
44 45
 * */

46
/* Sample command line to compile this code:
47
 * 
48 49 50 51 52 53
 * gcc -g -O0 -Wall -o make-elles-profiles make-elles-profiles.c -llcms2
 * 
 * You'll see a lot of harmless warnings about unused variables. 
 * That's because I included variables for profiles that the code 
 * doesn't actually make, in case you might want to make 
 * these profiles for your own use.
54 55
 * 
 * */
56
 
57 58 59
#include <lcms2.h>
int main ()
{
60 61 62
/* prints D50 XYZ values from lcms2.h, 
 * mostly to let you know the code did something! 
 * */
63 64
printf("D50X, D50Y, D50Z = %1.8f %1.8f %1.8f\n", cmsD50X, cmsD50Y, cmsD50Z);

65

66 67
/* ************************** TONE CURVES *************************** */

68 69 70 71 72 73 74
/* sRGB, Rec709, and labl Tone Reproduction Curves ("TRCs") */
/* About these TRCs: 
 * This code makes V2 and V4 ICC profiles.
 * For the V4 profiles, which are made using parametric curves, 
 * these TRCs can work in unbounded mode.
 * For the V2 profiles, the resulting TRC is a 4096-point curve and 
 * cannot work in unbounded mode. 
75 76
 * See http://ninedegreesbelow.com/photography/lcms2-unbounded-mode.html
 * for an explanation of unbounded mode ICC profile conversions. 
77 78 79 80 81
 * 
 * Also, during ICC profile conversions,
 * LCMS quantizes images with ICC profiles that have point TRCs. 
 * So use the V4 profile variants for editing images with software 
 * that uses LCMS2 as the Color Management System.
82
 * */
83 84
 
/* sRGB TRC */
85 86 87 88 89 90 91
cmsFloat64Number srgb_parameters[5] = 
   { 2.4, 1.0 / 1.055,  0.055 / 1.055, 1.0 / 12.92, 0.04045 }; 
cmsToneCurve *srgb_parametic_curve =
   cmsBuildParametricToneCurve(NULL, 4, srgb_parameters);
cmsToneCurve *srgb_parametric[3] = 
   {srgb_parametic_curve,srgb_parametic_curve,srgb_parametic_curve};

92 93 94 95 96 97 98 99
/* LAB "L" (perceptually uniform) TRC */
cmsFloat64Number labl_parameters[5] = 
   { 3.0, 0.862076,  0.137924, 0.110703, 0.080002 }; 
cmsToneCurve *labl_parametic_curve =
   cmsBuildParametricToneCurve(NULL, 4, labl_parameters);
cmsToneCurve *labl_parametric[3] = 
   {labl_parametic_curve,labl_parametic_curve,labl_parametic_curve};

100 101
/* Rec 709 TRC */
cmsFloat64Number rec709_parameters[5] = 
102
   { 1.0 / 0.45, 1.0 / 1.099,  0.099 / 1.099,  1.0 / 4.5, 0.018 }; 
103 104 105 106
cmsToneCurve *rec709_parametic_curve =
   cmsBuildParametricToneCurve(NULL, 4, rec709_parameters);
cmsToneCurve *rec709_parametric[3] = 
   {rec709_parametic_curve,rec709_parametic_curve,rec709_parametic_curve};
107 108 109 110
   
/* The following true gamma TRCs work in unbounded mode
 * for both V2 and V4 profiles, and quantization during ICC profile
 * conversions is not an issue with either the V2 or V4 variants: */
111 112 113 114 115
   
/* gamma=1.00, linear gamma, "linear light", etc tone response curve */
cmsToneCurve* gamma100[3];
gamma100[0] = gamma100[1] = gamma100[2] = cmsBuildGamma (NULL, 1.00); 

116 117 118
cmsToneCurve* gamma200[3];
gamma200[0] = gamma200[1] = gamma200[2] = cmsBuildGamma (NULL, 2.00);

119
/* Because of hexadecimal rounding during the profile making process, 
120 121 122 123 124
 * the following two gamma values for the profile's TRC are not precisely 
 * preserved when a V2 profile is made. So I used the V2 value for 
 * both V2 and V4 versions of the profiles that use these TRCs.
 * Otherwise V2 and V4 versions of nominally gamma=1.80 and gamma=2.20 
 * profiles would have slightly different gamma curves.
125 126 127 128
 * */

/* gamma=1.80078125 tone response curve */
/* http://www.color.org/chardata/rgb/ROMMRGB.pdf indicates that 
129
 * the official tone response curve for ROMM isn't a simple gamma curve 
130
 * but rather has a linear portion in shadows, just like sRGB.
131
 * Most ProPhotoRGB profiles use a gamma curve equal to 1.80078125. 
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
 * This odd value is because of hexadecimal rounding.
 * */ 
cmsToneCurve* gamma180[3];
gamma180[0] = gamma180[1] = gamma180[2] = cmsBuildGamma (NULL, 1.80078125); 

/* gamma=2.19921875 tone response curve */
/* per http://www.adobe.com/digitalimag/pdfs/AdobeRGB1998.pdf;
 * ClayRGB uses this value. Based on an old proprietary profile, 
 * it also appears to be the correct gamma for WideGamutRGB.
 * It also is what you get when you 
 * try to create a V2 profile with a gamma=2.20 gamma curve. 
 * So perhaps the AdobeRGB1998 specifications 
 * were simply bowing to the inevitable hexadecimal rounding. 
 * Almost all (all?) V2 ICC profiles with nominally gamma=2.20 
 * really have a gamma of 2.19921875, not 2.20.
 * */
148
 
149 150 151 152 153 154
cmsToneCurve* gamma220[3];
gamma220[0] = gamma220[1] = gamma220[2] = cmsBuildGamma (NULL, 2.19921875);

/* ************************** WHITE POINTS ************************** */

/* D50 WHITE POINTS */
155

156 157
cmsCIExyY d50_romm_spec= {0.3457, 0.3585, 1.0};
/* http://photo-lovers.org/pdf/color/romm.pdf */
158

159 160 161
cmsCIExyY d50_illuminant_specs = {0.345702915, 0.358538597, 1.0};
/* calculated from D50 illuminant XYZ values in ICC specs */

162

163
/* D65 WHITE POINTS */
164

165 166 167 168 169 170 171 172 173
cmsCIExyY  d65_srgb_adobe_specs = {0.3127, 0.3290, 1.0};
/* White point from the sRGB.icm and AdobeRGB1998 profile specs:
 * http://www.adobe.com/digitalimag/pdfs/AdobeRGB1998.pdf 
 * 4.2.1 Reference Display White Point
 * The chromaticity coordinates of white displayed on 
 * the reference color monitor shall be x=0.3127, y=0.3290. 
 * . . . [which] correspond to CIE Standard Illuminant D65.
 * 
 * Wikipedia gives this same white point for SMPTE-C.
174
 * This white point is also given in the sRGB color space specs.
175 176
 * It's probably correct for most or all of the standard D65 profiles.
 * 
177 178 179 180 181 182
 * The D65 white point values used in the LCMS virtual sRGB profile
 * is slightly different than the D65 white point values given in the 
 * sRGB color space specs, so the LCMS virtual sRGB profile
 * doesn't match sRGB profiles made using the values given in the 
 * sRGB color space specs.
 * 
183 184
 * */
 
185 186 187
 
/* Various C and E WHITE POINTS */

188
cmsCIExyY c_astm  = {0.310060511, 0.316149551, 1.0}; 
189
/* see http://www.brucelindbloom.com/index.html?Eqn_ChromAdapt.html */
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204
cmsCIExyY e_astm  = {0.333333333, 0.333333333, 1.0};
/* see http://www.brucelindbloom.com/index.html?Eqn_ChromAdapt.html */

cmsCIExyY c_cie= {0.310, 0.316};
/* https://en.wikipedia.org/wiki/NTSC#Colorimetry */
cmsCIExyY e_cie= {0.333, 0.333};

cmsCIExyY c_6774_robertson= {0.308548930, 0.324928102, 1.0}; 
/* see http://en.wikipedia.org/wiki/Standard_illuminant#White_points_of_standard_illuminants
 * also see  http://www.brucelindbloom.com/index.html?Eqn_T_to_xy.html for the equations */
cmsCIExyY e_5454_robertson= {0.333608970, 0.348572909, 1.0}; 
/* see http://en.wikipedia.org/wiki/Standard_illuminant#White_points_of_standard_illuminants
 * also see http://www.brucelindbloom.com/index.html?Eqn_T_to_xy.html for the equations */
 
 
205 206 207 208 209 210
/* ACES white point, taken from
 * Specification S-2014-004
 * ACEScg – A Working Space for CGI Render and Compositing
 */
cmsCIExyY d60_aces= {0.32168, 0.33767, 1.0};

211 212 213 214 215 216 217
/* *****************Set up profile variables and values *************** */
cmsHPROFILE profile;
cmsToneCurve* tone_curve[3];
cmsCIExyY whitepoint;
cmsCIExyYTRIPLE primaries;
const char* filename;
cmsMLU *copyright = cmsMLUalloc(NULL, 1);
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250

/* I put a Creative Commons Attribution-ShareAlike 3.0 Unported License
 * on the profiles that I distribute (see
 * https://creativecommons.org/licenses/by-sa/3.0/legalcode)
 * The CC V3 Attribution-ShareAlike unported licence is accepted by both
 * Debian and Fedora as a free licence.
 * 
 * Note that the CC V3 BY-SA licence that I put on the ICC profiles 
 * is not the same licence that's applied to my profile-making code, 
 * which is LGPL2.1+.
 * 
 * Of course you can modify my profile-making code to put some other 
 * *profile* copyright on the actual profiles that the code makes, 
 * for example public domain (Creative Commons CC0) 
 * or one of the GPL copyrights.
 * 
 * The ICC suggested wording for profile copyrights is here 
 * (see the last section, entitled "Licensing"): 
 * http://www.color.org/registry/profileregistration.xalter
 * 
 * The ICC copyright sounds like it's probably a free licence,
 * but as of June 2015 it hasn't been accepted by Fedora or Debian as a 
 * free license. 
 * 
 * Here are the Fedora and Debian lists of free licences:
 * 
 * https://fedoraproject.org/wiki/Licensing:Main?rd=Licensing#Content_Licenses
 * https://wiki.debian.org/DFSGLicenses
 * 
 * */

cmsMLUsetASCII(copyright, "en", "US", "Copyright 2015, Elle Stone (website: http://ninedegreesbelow.com/; email: ellestone@ninedegreesbelow.com). This ICC profile is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License (https://creativecommons.org/licenses/by-sa/3.0/legalcode).");

251
cmsMLU *manufacturer = cmsMLUalloc(NULL, 1);
252

253 254 255 256
cmsMLU *description;

/* ********************** MAKE THE PROFILES ************************* */

257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458
/* ACES PROFILES */

/* ***** Make profile: ACEScg, D60, gamma=1.00 */
/* ACEScg chromaticities taken from
 * Specification S-2014-004
 * ACEScg – A Working Space for CGI Render and Compositing
 */
cmsCIExyYTRIPLE aces_cg_primaries = 
{
{0.713, 0.293,  1.0},
{0.165, 0.830,  1.0},
{0.128, 0.044,  1.0}
};

whitepoint = d60_aces;
primaries = aces_cg_primaries;

/* linear gamma */
tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma100[0];
profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
/* V4 */
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "ACEScg-elle-V4-g10.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "ACEScg-elle-V4-g10.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);
/* V2 */
cmsSetProfileVersion(profile, 2.1);
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "ACEScg-elle-V2-g10.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "ACEScg-elle-V2-g10.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);

/* gamma=2.2 */
tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma220[0];
profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
/* V4 */
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "ACEScg-elle-V4-g22.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "ACEScg-elle-V4-g22.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);
/* V2 */
cmsSetProfileVersion(profile, 2.1);
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "ACEScg-elle-V2-g22.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "ACEScg-elle-V2-g22.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);

/* sRGB TRC */
tone_curve[0] = tone_curve[1] = tone_curve[2] = srgb_parametric[0];
profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
/* V4 */
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "ACEScg-elle-V4-srgbtrc.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "ACEScg-elle-V4-srgbtrc.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);
/* V2 */
cmsSetProfileVersion(profile, 2.1);
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "ACEScg-elle-V2-srgbtrc.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "ACEScg-elle-V2-srgbtrc.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);

/* labl TRC */
tone_curve[0] = tone_curve[1] = tone_curve[2] = labl_parametric[0];
profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
/* V4 */
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "ACEScg-elle-V4-labl.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "ACEScg-elle-V4-labl.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);
/* V2 */
cmsSetProfileVersion(profile, 2.1);
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "ACEScg-elle-V2-labl.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "ACEScg-elle-V2-labl.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);



/* ***** Make profile: ACES, D60, gamma=1.00 */
/* ACES chromaticities taken from
 * Specification
 * */
cmsCIExyYTRIPLE aces_primaries = 
{
{0.73470,  0.26530,  1.0},
{0.00000,  1.00000,  1.0},
{0.00010, -0.07700,  1.0}
};
cmsCIExyYTRIPLE aces_primaries_prequantized = 
{
{0.734704192222, 0.265298276252,  1.0},
{-0.000004945077, 0.999992850272,  1.0},
{0.000099889199, -0.077007518685,  1.0}
};

whitepoint = d60_aces;
primaries = aces_primaries_prequantized;

/* linear gamma */
tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma100[0];
profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
/* V4 */
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "ACES-elle-V4-g10.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "ACES-elle-V4-g10.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);
/* V2 */
cmsSetProfileVersion(profile, 2.1);
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "ACES-elle-V2-g10.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "ACES-elle-V2-g10.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);

/* gamma=2.2 */
tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma220[0];
profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
/* V4 */
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "ACES-elle-V4-g122.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "ACES-elle-V4-g22.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);
/* V2 */
cmsSetProfileVersion(profile, 2.1);
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "ACES-elle-V2-g22.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "ACES-elle-V2-g22.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);

/* sRGB TRC */
tone_curve[0] = tone_curve[1] = tone_curve[2] = srgb_parametric[0];
profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
/* V4 */
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "ACES-elle-V4-srgbtrc.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "ACES-elle-V4-srgbtrc.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);
/* V2 */
cmsSetProfileVersion(profile, 2.1);
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "ACES-elle-V2-srgbtrc.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "ACES-elle-V2-srgbtrc.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);

/* labl TRC */
tone_curve[0] = tone_curve[1] = tone_curve[2] = labl_parametric[0];
profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
/* V4 */
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "ACES-elle-V4-labl.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "ACES-elle-V4-labl.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);
/* V2 */
cmsSetProfileVersion(profile, 2.1);
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "ACES-elle-V2-labl.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "ACES-elle-V2-labl.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);




459 460 461 462
/* D50 PROFILES */

/* ***** Make profile: AllColorsRGB, D50, gamma=1.00 */
/* AllColors.icc has a slightly larger color gamut than the ACES color space.
463 464 465 466
 * It has a D50 white point and a linear gamma TRC. 
 * It holds all visible colors.
 * Just like the ACES color space, 
 * AllColors also holds a high percentage of imaginary colors.
467 468
 * See http://ninedegreesbelow.com/photography/xyz-rgb.html#xyY 
 * for more information about imaginary colors.
469 470
 * AllColors primaries for red and blue from 
 * http://www.ledtuning.nl/en/cie-convertor
471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512
 * blue 375nm red 780nm, plus Y intercepts:
 * Color Wavelength (): 375 nm.
 * Spectral Locus coordinates: X:0.17451 Y:0.005182
 * Color Wavelength (): 780 nm.
 * Spectral Locus coordinates: X:0.734690265 Y:0.265309735
 * X1:0.17451 Y1:0.005182
 * X2:0.734690265 Y2:0.265309735
 * X3:0.00Y3:? Solve for Y3:
 * (0.265309735-0.005182)/(0.734690265-0.17451)=0.46436433279205221554=m
 * y=mx+b let x=0; y=b
 * Y1=0.005182=(0.46436433279205221554*0.17451)+b
 * b=0.005182-(0.46436433279205221554*0.17451)=-.07585421971554103213
 *  */
cmsCIExyYTRIPLE allcolors_primaries = 
{
{0.734690265,  0.265309735,  1.0},
{0.000000000,  1.000000000,  1.0},
{0.000000000, -.0758542197,  1.0}
}; 
whitepoint = d50_illuminant_specs;
primaries = allcolors_primaries;

/* linear gamma */
tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma100[0];
profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
/* V4 */
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "AllColorsRGB-elle-V4-g10.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "AllColorsRGB-elle-V4-g10.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);
/* V2 */
cmsSetProfileVersion(profile, 2.1);
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "AllColorsRGB-elle-V2-g10.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "AllColorsRGB-elle-V2-g10.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);

513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532
/* gamma=2.2 */
tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma220[0];
profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
/* V4 */
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "AllColorsRGB-elle-V4-g22.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "AllColorsRGB-elle-V4-g22.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);
/* V2 */
cmsSetProfileVersion(profile, 2.1);
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "AllColorsRGB-elle-V2-g22.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "AllColorsRGB-elle-V2-g22.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);

533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552
/* sRGB TRC */
tone_curve[0] = tone_curve[1] = tone_curve[2] = srgb_parametric[0];
profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
/* V4 */
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "AllColorsRGB-elle-V4-srgbtrc.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "AllColorsRGB-elle-V4-srgbtrc.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);
/* V2 */
cmsSetProfileVersion(profile, 2.1);
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "AllColorsRGB-elle-V2-srgbtrc.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "AllColorsRGB-elle-V2-srgbtrc.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);

553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572
/* labl TRC */
tone_curve[0] = tone_curve[1] = tone_curve[2] = labl_parametric[0];
profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
/* V4 */
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "AllColorsRGB-elle-V4-labl.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "AllColorsRGB-elle-V4-labl.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);
/* V2 */
cmsSetProfileVersion(profile, 2.1);
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "AllColorsRGB-elle-V2-labl.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "AllColorsRGB-elle-V2-labl.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);

573 574 575 576 577 578 579 580 581 582 583 584

/* ***** Make profile: Identity, D50, gamma=1.00. */
/* These primaries also hold all possible visible colors, 
 * but less efficiently than the AllColors profile.*/
cmsCIExyYTRIPLE identity_primaries = {/*  */
{1.0, 0.0, 1.0},
{0.0, 1.0, 1.0},
{0.0, 0.0, 1.0}
};
whitepoint = d50_illuminant_specs;
primaries = identity_primaries;

585
/* linear gamma */
586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604
tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma100[0];
profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
/* V4 */
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "IdentityRGB-elle-V4-g10.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "IdentityRGB-elle-V4-g10.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);
/* V2 */
cmsSetProfileVersion(profile, 2.1);
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "IdentityRGB-elle-V2-g10.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "IdentityRGB-elle-V2-g10.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);

605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624
/* gamma=2.2 */
tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma220[0];
profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
/* V4 */
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "IdentityRGB-elle-V4-g22.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "IdentityRGB-elle-V4-g22.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);
/* V2 */
cmsSetProfileVersion(profile, 2.1);
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "IdentityRGB-elle-V2-g22.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "IdentityRGB-elle-V2-g22.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);

625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644
/* sRGB TRC */
tone_curve[0] = tone_curve[1] = tone_curve[2] = srgb_parametric[0];
profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
/* V4 */
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "IdentityRGB-elle-V4-srgbtrc.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "IdentityRGB-elle-V4-srgbtrc.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);
/* V2 */
cmsSetProfileVersion(profile, 2.1);
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "IdentityRGB-elle-V2-srgbtrc.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "IdentityRGB-elle-V2-srgbtrc.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);

645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664
/* labl TRC */
tone_curve[0] = tone_curve[1] = tone_curve[2] = labl_parametric[0];
profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
/* V4 */
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "IdentityRGB-elle-V4-labl.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "IdentityRGB-elle-V4-labl.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);
/* V2 */
cmsSetProfileVersion(profile, 2.1);
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "IdentityRGB-elle-V2-labl.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "IdentityRGB-elle-V2-labl.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);

665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722

/* ***** Make profile: Romm/Prophoto, D50, gamma=1.80 */
/* Reference Input/Output Medium Metric RGB Color Encodings (RIMM/ROMM RGB)
 * Kevin E. Spaulding, Geoffrey J. Woolfe and Edward J. Giorgianni
 * Eastman Kodak Company, Rochester, New York, U.S.A.
 * Above document is available at http://photo-lovers.org/pdf/color/romm.pdf
 * Kodak designed the Romm (ProPhoto) color gamut to include all printable 
 * and most real world colors. It includes some imaginary colors and excludes 
 * some of the real world blues and violet blues that can be captured by 
 * digital cameras. For high bit depth image editing only.
 */
cmsCIExyYTRIPLE romm_primaries = {
{0.7347, 0.2653, 1.0},
{0.1596, 0.8404, 1.0},
{0.0366, 0.0001, 1.0}
};
primaries = romm_primaries;
whitepoint = d50_romm_spec;
/* gamma 1.80 */
tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma180[0];
profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
/* V4 */
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "LargeRGB-elle-V4-g18.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "LargeRGB-elle-V4-g18.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);
/* V2 */
cmsSetProfileVersion(profile, 2.1);
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "LargeRGB-elle-V2-g18.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "LargeRGB-elle-V2-g18.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);

/* linear gamma */
tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma100[0];
profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
/* V4 */
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "LargeRGB-elle-V4-g10.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "LargeRGB-elle-V4-g10.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);
/* V2 */
cmsSetProfileVersion(profile, 2.1);
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "LargeRGB-elle-V2-g10.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "LargeRGB-elle-V2-g10.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);

723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742
/* gamma=2.2 */
tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma220[0];
profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
/* V4 */
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "LargeRGB-elle-V4-g22.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "LargeRGB-elle-V4-g22.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);
/* V2 */
cmsSetProfileVersion(profile, 2.1);
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "LargeRGB-elle-V2-g22.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "LargeRGB-elle-V2-g22.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);

743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762
/* sRGB TRC */
tone_curve[0] = tone_curve[1] = tone_curve[2] = srgb_parametric[0];
profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
/* V4 */
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "LargeRGB-elle-V4-srgbtrc.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "LargeRGB-elle-V4-srgbtrc.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);
/* V2 */
cmsSetProfileVersion(profile, 2.1);
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "LargeRGB-elle-V2-srgbtrc.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "LargeRGB-elle-V2-srgbtrc.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);

763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782
/* labl TRC */
tone_curve[0] = tone_curve[1] = tone_curve[2] = labl_parametric[0];
profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
/* V4 */
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "LargeRGB-elle-V4-labl.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "LargeRGB-elle-V4-labl.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);
/* V2 */
cmsSetProfileVersion(profile, 2.1);
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "LargeRGB-elle-V2-labl.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "LargeRGB-elle-V2-labl.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);

783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858


/* ***** Make profile: WidegamutRGB, D50, gamma=2.19921875 */
/* Pascale's primary values produce a profile that matches 
 * old V2 Widegamut profiles from Adobe and Canon.
 * Danny Pascale: A review of RGB color spaces
 * http://www.babelcolor.com/download/A%20review%20of%20RGB%20color%20spaces.pdf  
 * WideGamutRGB was designed by Adobe to be a wide gamut color space that uses
 * spectral colors as its primaries. For high bit depth image editing only. */
cmsCIExyYTRIPLE widegamut_pascale_primaries = {
{0.7347, 0.2653, 1.0},
{0.1152, 0.8264, 1.0},
{0.1566, 0.0177, 1.0}
};
primaries = widegamut_pascale_primaries;
whitepoint = d50_romm_spec;
/* gamma 2.20 */
tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma220[0];
profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
/* V4 */
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "WideRGB-elle-V4-g22.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "WideRGB-elle-V4-g22.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);
/* V2 */
cmsSetProfileVersion(profile, 2.1);
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "WideRGB-elle-V2-g22.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "WideRGB-elle-V2-g22.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);

/* linear gamma */
tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma100[0];
profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
/* V4 */
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "WideRGB-elle-V4-g10.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "WideRGB-elle-V4-g10.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);
/* V2 */
cmsSetProfileVersion(profile, 2.1);
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "WideRGB-elle-V2-g10.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "WideRGB-elle-V2-g10.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);

/* sRGB TRC */
tone_curve[0] = tone_curve[1] = tone_curve[2] = srgb_parametric[0];
profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
/* V4 */
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "WideRGB-elle-V4-srgbtrc.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "WideRGB-elle-V4-srgbtrc.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);
/* V2 */
cmsSetProfileVersion(profile, 2.1);
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "WideRGB-elle-V2-srgbtrc.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "WideRGB-elle-V2-srgbtrc.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);

859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878
/* labl TRC */
tone_curve[0] = tone_curve[1] = tone_curve[2] = labl_parametric[0];
profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
/* V4 */
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "WideRGB-elle-V4-labl.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "WideRGB-elle-V4-labl.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);
/* V2 */
cmsSetProfileVersion(profile, 2.1);
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "WideRGB-elle-V2-labl.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "WideRGB-elle-V2-labl.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);

879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909

/* D65 PROFILES */

/* ***** Make profile: ClayRGB (AdobeRGB), D65, gamma=2.19921875 */
/* The Adobe RGB 1998 color gamut covers a higher percentage of 
 * real-world greens than sRGB, but still doesn't include all printable 
 * greens, yellows, and cyans. 
 * When made using the gamma=2.19921875 tone response curve, 
 * this profile can be used for 8-bit image editing 
 * if used with appropriate caution to avoid posterization. 
 * When made with the gamma=2.19921875 tone response curve
 * this profile can be applied to DCF R98 camera-generated jpegs.
 * */
cmsCIExyYTRIPLE adobe_primaries = {
{0.6400, 0.3300, 1.0},
{0.2100, 0.7100, 1.0},
{0.1500, 0.0600, 1.0}
};
cmsCIExyYTRIPLE adobe_primaries_prequantized = {
{0.639996511, 0.329996864, 1.0},
{0.210005295, 0.710004866, 1.0},
{0.149997606, 0.060003644, 1.0}
};
primaries = adobe_primaries_prequantized;
whitepoint = d65_srgb_adobe_specs;
/* gamma 2.20 */
tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma220[0];
profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
/* V4 */
description = cmsMLUalloc(NULL, 1);
910
cmsMLUsetASCII(description, "en", "US", "ClayRGB-elle-V4-g22.icc");
911 912 913 914 915 916 917
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "ClayRGB-elle-V4-g22.icc";
cmsSaveProfileToFile(profile, filename); 
cmsMLUfree(description);
/* V2 */
cmsSetProfileVersion(profile, 2.1);
description = cmsMLUalloc(NULL, 1);
918
cmsMLUsetASCII(description, "en", "US", "ClayRGB-elle-V2-g22.icc");
919 920 921 922 923 924 925 926 927 928 929
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "ClayRGB-elle-V2-g22.icc";
cmsSaveProfileToFile(profile, filename); 
cmsMLUfree(description);

/* linear gamma */
tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma100[0];
profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
/* V4 */
description = cmsMLUalloc(NULL, 1);
930
cmsMLUsetASCII(description, "en", "US", "ClayRGB-elle-V4-g10.icc");
931 932 933 934 935 936 937
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "ClayRGB-elle-V4-g10.icc";
cmsSaveProfileToFile(profile, filename); 
cmsMLUfree(description);
/* V2 */
cmsSetProfileVersion(profile, 2.1);
description = cmsMLUalloc(NULL, 1);
938
cmsMLUsetASCII(description, "en", "US", "ClayRGB-elle-V2-g10.icc");
939 940 941 942 943 944 945 946 947 948 949
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "ClayRGB-elle-V2-g10.icc";
cmsSaveProfileToFile(profile, filename); 
cmsMLUfree(description);

/* sRGB TRC */
tone_curve[0] = tone_curve[1] = tone_curve[2] = srgb_parametric[0];
profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
/* V4 */
description = cmsMLUalloc(NULL, 1);
950
cmsMLUsetASCII(description, "en", "US", "ClayRGB-elle-V4-srgbtrc.icc");
951 952 953 954 955 956 957
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "ClayRGB-elle-V4-srgbtrc.icc";
cmsSaveProfileToFile(profile, filename); 
cmsMLUfree(description);
/* V2 */
cmsSetProfileVersion(profile, 2.1);
description = cmsMLUalloc(NULL, 1);
958
cmsMLUsetASCII(description, "en", "US", "ClayRGB-elle-V2-srgbtrc.icc");
959 960 961 962 963
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "ClayRGB-elle-V2-srgbtrc.icc";
cmsSaveProfileToFile(profile, filename); 
cmsMLUfree(description);

964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021
/* labl TRC */
tone_curve[0] = tone_curve[1] = tone_curve[2] = labl_parametric[0];
profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
/* V4 */
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "ClayRGB-elle-V4-labl.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "ClayRGB-elle-V4-labl.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);
/* V2 */
cmsSetProfileVersion(profile, 2.1);
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "ClayRGB-elle-V2-labl.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "ClayRGB-elle-V2-labl.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);



/* ***** Make profile: Rec.2020, D65, Rec709 TRC */
/* 
 * */
cmsCIExyYTRIPLE rec2020_primaries = {
{0.7079, 0.2920, 1.0},
{0.1702, 0.7965, 1.0},
{0.1314, 0.0459, 1.0}
};

cmsCIExyYTRIPLE rec2020_primaries_prequantized = {
{0.708012540607, 0.291993664388, 1.0},
{0.169991652439, 0.797007778423, 1.0},
{0.130997824007, 0.045996550894, 1.0}
};

primaries = rec2020_primaries_prequantized;
whitepoint = d65_srgb_adobe_specs;
/* rec.709 */
tone_curve[0] = tone_curve[1] = tone_curve[2] = rec709_parametric[0];
profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
/* V4 */
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "Rec2020-elle-V4-rec709.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "Rec2020-elle-V4-rec709.icc";
cmsSaveProfileToFile(profile, filename); 
cmsMLUfree(description);
/* V2 */
cmsSetProfileVersion(profile, 2.1);
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "Rec2020-elle-V2-rec709.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "Rec2020-elle-V2-rec709.icc";
cmsSaveProfileToFile(profile, filename); 
cmsMLUfree(description);
1022

1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106
/* linear gamma */
tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma100[0];
profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
/* V4 */
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "Rec2020-elle-V4-g10.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "Rec2020-elle-V4-g10.icc";
cmsSaveProfileToFile(profile, filename); 
cmsMLUfree(description);
/* V2 */
cmsSetProfileVersion(profile, 2.1);
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "Rec2020-elle-V2-g10.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "Rec2020-elle-V2-g10.icc";
cmsSaveProfileToFile(profile, filename); 
cmsMLUfree(description);

/* gamma=2.2 */
tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma220[0];
profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
/* V4 */
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "Rec2020-elle-V4-g22.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "Rec2020-elle-V4-g22.icc";
cmsSaveProfileToFile(profile, filename); 
cmsMLUfree(description);
/* V2 */
cmsSetProfileVersion(profile, 2.1);
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "Rec2020-elle-V2-g22.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "Rec2020-elle-V2-g22.icc";
cmsSaveProfileToFile(profile, filename); 
cmsMLUfree(description);


/* sRGB TRC */
tone_curve[0] = tone_curve[1] = tone_curve[2] = srgb_parametric[0];
profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
/* V4 */
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "Rec2020-elle-V4-srgbtrc.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "Rec2020-elle-V4-srgbtrc.icc";
cmsSaveProfileToFile(profile, filename); 
cmsMLUfree(description);
/* V2 */
cmsSetProfileVersion(profile, 2.1);
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "Rec2020-elle-V2-srgbtrc.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "Rec2020-elle-V2-srgbtrc.icc";
cmsSaveProfileToFile(profile, filename); 
cmsMLUfree(description);

/* labl TRC */
tone_curve[0] = tone_curve[1] = tone_curve[2] = labl_parametric[0];
profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
/* V4 */
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "Rec2020-elle-V4-labl.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "Rec2020-elle-V4-labl.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);
/* V2 */
cmsSetProfileVersion(profile, 2.1);
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "Rec2020-elle-V2-labl.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "Rec2020-elle-V2-labl.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);


/* ***** Make profile: sRGB, D65, sRGB TRC */
/* http://en.wikipedia.org/wiki/Srgb */
1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167
/* Hewlett-Packard and Microsoft designed sRGB to match 
 * the color gamut of consumer-grade CRTs from the 1990s
 * and to be the standard color space for the world wide web.
 * When made using the standard sRGB TRC, this sRGB profile 
 * can be applied to DCF R03 camera-generated jpegs and 
 * is an excellent color space for editing 8-bit images.
 * When made using the linear gamma TRC, the resulting profile
 * should only be used for high bit depth image editing.
 * */
cmsCIExyYTRIPLE srgb_primaries = {
{0.6400, 0.3300, 1.0},
{0.3000, 0.6000, 1.0},
{0.1500, 0.0600, 1.0}
};
cmsCIExyYTRIPLE srgb_primaries_pre_quantized = {
{0.639998686, 0.330010138, 1.0},
{0.300003784, 0.600003357, 1.0},
{0.150002046, 0.059997204, 1.0}
};
primaries = srgb_primaries_pre_quantized;
whitepoint = d65_srgb_adobe_specs;
/* sRGB TRC */
tone_curve[0] = tone_curve[1] = tone_curve[2] = srgb_parametric[0];
profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
/* V4 */
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "sRGB-elle-V4-srgbtrc.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "sRGB-elle-V4-srgbtrc.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);
/* V2 */
cmsSetProfileVersion(profile, 2.1);
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "sRGB-elle-V2-srgbtrc.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "sRGB-elle-V2-srgbtrc.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);

/* linear gamma */
tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma100[0];
profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
/* V4 */
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "sRGB-elle-V4-g10.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "sRGB-elle-V4-g10.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);
/* V2 */
cmsSetProfileVersion(profile, 2.1);
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "sRGB-elle-V2-g10.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "sRGB-elle-V2-g10.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);

1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226
/* gamma=2.2 */
tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma220[0];
profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
/* V4 */
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "sRGB-elle-V4-g22.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "sRGB-elle-V4-g22.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);
/* V2 */
cmsSetProfileVersion(profile, 2.1);
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "sRGB-elle-V2-g22.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "sRGB-elle-V2-g22.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);

/* labl TRC */
tone_curve[0] = tone_curve[1] = tone_curve[2] = labl_parametric[0];
profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
/* V4 */
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "sRGB-elle-V4-labl.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "sRGB-elle-V4-labl.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);
/* V2 */
cmsSetProfileVersion(profile, 2.1);
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "sRGB-elle-V2-labl.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "sRGB-elle-V2-labl.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);

/* Rec.709 TRC */
tone_curve[0] = tone_curve[1] = tone_curve[2] = rec709_parametric[0];
profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
/* V4 */
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "sRGB-elle-V4-rec709.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "sRGB-elle-V4-rec709.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);
/* V2 */
cmsSetProfileVersion(profile, 2.1);
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "sRGB-elle-V2-rec709.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "sRGB-elle-V2-rec709.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);
1227 1228


1229
/* ***** Make profile: CIE-RGB profile, E white point*/
1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328
/* The ASTM E white point is probably the right white point 
 * to use when making the CIE-RGB color space profile.
 * It's not clear to me what the correct CIE-RGB primaries really are.
 * Lindbloom gives one set. The LCMS version 1 tutorial gives a different set.
 * I asked a friend to ask an expert, who said the real primaries should
 * be calculated from the spectral wavelengths. 
 * Two sets of primaries are given below:
 * */
/* This page explains what the CIE color space is:
 * https://en.wikipedia.org/wiki/CIE_1931
 * These pages give the wavelengths:
 * http://hackipedia.org/Color%20space/pdf/CIE%20Color%20Space.pdf 
 * http://infocom.ing.uniroma1.it/~gaetano/texware/Full-How%20the%20CIE%201931%20Color-Matching%20Functions%20Were%20Derived%20from%20Wright-Guild%20Data.pdf
 * This page has resources for calculating xy values given a spectral color wavelength:
 * http://www.cvrl.org/cmfs.htm
 * This page does the calculations for you:
 * http://www.ledtuning.nl/cie.php
 * Plugging the wavelengths into the ledtuning website 
 * gives the following CIE RGB xy primaries:
700.0 nm has Spectral Locus coordinates: x:0.734690023  y:0.265309977
546.1 nm has Spectral Locus coordinates: x:0.2736747378 y:0.7174284409
435.8 nm has Spectral Locus coordinates: x:0.1665361196 y:0.0088826412
* */
cmsCIExyYTRIPLE cie_primaries_ledtuning = {
{0.7346900230, 0.2653099770, 1.0},
{0.2736747378, 0.7174284409, 1.0},
{0.1665361196, 0.0088826412, 1.0}
};
/* Assuming you want to use the ASTM values for the E white point, 
 * here are the prequantized ledtuning primaries */
cmsCIExyYTRIPLE cie_primaries_ledtuning_prequantized = {
{0.734689082, 0.265296653, 1.0},
{0.273673341, 0.717437354, 1.0},
{0.166531028, 0.008882428, 1.0}
};
primaries = cie_primaries_ledtuning_prequantized;
whitepoint = e_astm;
tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma220[0];
profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
/* V4 */
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "CIERGB-elle-V4-g22.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "CIERGB-elle-V4-g22.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);
/* V2 */
cmsSetProfileVersion(profile, 2.1);
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "CIERGB-elle-V2-g22.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "CIERGB-elle-V2-g22.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);

/* A linear gamma version of this profile makes more sense 
 * than a gamma=2.2 version */
tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma100[0];
whitepoint = e_astm;
profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
/* V4 */
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "CIERGB-elle-V4-g10.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "CIERGB-elle-V4-g10.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);
/* V2 */
cmsSetProfileVersion(profile, 2.1);
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "CIERGB-elle-V2-g10.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "CIERGB-elle-V2-g10.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);

/* sRGB TRC*/
tone_curve[0] = tone_curve[1] = tone_curve[2] = srgb_parametric[0];
whitepoint = e_astm;
profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
/* V4 */
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "CIERGB-elle-V4-srgbtrc.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "CIERGB-elle-V4-srgbtrc.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);
/* V2 */
cmsSetProfileVersion(profile, 2.1);
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "CIERGB-elle-V2-srgbtrc.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "CIERGB-elle-V2-srgbtrc.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);

1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348
/* labl TRC */
tone_curve[0] = tone_curve[1] = tone_curve[2] = labl_parametric[0];
profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
/* V4 */
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "CIERGB-elle-V4-labl.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "CIERGB-elle-V4-labl.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);
/* V2 */
cmsSetProfileVersion(profile, 2.1);
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "CIERGB-elle-V2-labl.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "CIERGB-elle-V2-labl.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);

1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456

/* 
 * Here's the second set of primaries
 * http://www.cis.rit.edu/research/mcsl2/research/broadbent/CIE1931_RGB.pdf
 * https://groups.google.com/forum/#!topic/sci.engr.color/fBI3k1llm-g 
 * Lindbloom gives these values on his Working Space Information page: */
cmsCIExyYTRIPLE cie_primaries_lindbloom = {
{0.7350, 0.2650, 1.0},
{0.2740, 0.7170, 1.0},
{0.1670, 0.0090, 1.0}
}; 
/* Assuming you want to use the ASTM values for the E white point, 
 * here are the prequantized Lindbloom primaries */
cmsCIExyYTRIPLE cie_primaries_lindbloom_prequantized = {
{0.714504840, 0.297234644, 1.0},
{0.520085568, 0.452364535, 1.0},
{0.090957433, 0.051485032, 1.0}
}; 


/* ***** Make profile: Gray ICC profiles - D50 white point  ********* */
whitepoint = d50_illuminant_specs;
const cmsToneCurve* grayTRC;

/* Gray profile with gamma=1.00, linear gamma, "linear light", etc */
grayTRC = cmsBuildGamma (NULL, 1.00); 
profile = cmsCreateGrayProfile ( &whitepoint, grayTRC );
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
/* V4 */
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "Gray-D50-elle-V4-g10.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "Gray-D50-elle-V4-g10.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);
/* V2 */
cmsSetProfileVersion(profile, 2.1);
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "Gray-D50-elle-V2-g10.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "Gray-D50-elle-V2-g10.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);

/* Gray profile with gamma=1.80, 
 * actually 1.80078125,
 * in order to create the same gamma curve in V2 and V4 profiles */
grayTRC = cmsBuildGamma (NULL, 1.80078125); 
profile = cmsCreateGrayProfile ( &whitepoint, grayTRC );
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
/* V4 */
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "Gray-D50-elle-V4-g18.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "Gray-D50-elle-V4-g18.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);
/* V2 */
cmsSetProfileVersion(profile, 2.1);
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "Gray-D50-elle-V2-g18.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "Gray-D50-elle-V2-g18.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);

/* Gray profile with gamma=2.20 
 * actually gamma=2.19921875,
 * in order to create the same gamma curve in V2 and V4 profiles  */
grayTRC = cmsBuildGamma (NULL, 2.19921875); 
profile = cmsCreateGrayProfile ( &whitepoint, grayTRC );
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
/* V4 */
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "Gray-D50-elle-V4-g22.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "Gray-D50-elle-V4-g22.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);
/* V2 */
cmsSetProfileVersion(profile, 2.1);
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "Gray-D50-elle-V2-g22.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "Gray-D50-elle-V2-g22.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);

/* Gray profile with srgb-trc */
grayTRC = cmsBuildParametricToneCurve(NULL, 4, srgb_parameters);
profile = cmsCreateGrayProfile ( &whitepoint, grayTRC );
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
/* V4 */
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "Gray-D50-elle-V4-srgbtrc.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "Gray-D50-elle-V4-srgbtrc.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);
/* V2 */
cmsSetProfileVersion(profile, 2.1);
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "Gray-D50-elle-V2-srgbtrc.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "Gray-D50-elle-V2-srgbtrc.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);

1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496
/* Gray profile with labl TRC */
grayTRC = cmsBuildParametricToneCurve(NULL, 4, labl_parameters);
profile = cmsCreateGrayProfile ( &whitepoint, grayTRC );
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
/* V4 */
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "Gray-D50-elle-V4-labl.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "Gray-D50-elle-V4-labl.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);
/* V2 */
cmsSetProfileVersion(profile, 2.1);
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "Gray-D50-elle-V2-labl.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "Gray-D50-elle-V2-labl.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);

/* Gray profile with Rec709 TRC */
grayTRC = cmsBuildParametricToneCurve(NULL, 4, rec709_parameters);
profile = cmsCreateGrayProfile ( &whitepoint, grayTRC );
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
/* V4 */
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "Gray-D50-elle-V4-rec709.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "Gray-D50-elle-V4-rec709.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);
/* V2 */
cmsSetProfileVersion(profile, 2.1);
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "Gray-D50-elle-V2-rec709.icc");
cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
                             filename = "Gray-D50-elle-V2-rec709.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);

1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653

/* ***** Make profile: LCMS built-in LAB and XYZ profiles *********** */
/* Based on transicc output, the V4 profiles 
 * can be used in unbounded mode, but the V2 versions cannot. */
profile  = cmsCreateLab2Profile(&d50_illuminant_specs);
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "Lab-D50-Identity-elle-V2.icc");
                             filename = "Lab-D50-Identity-elle-V2.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);

profile  = cmsCreateLab4Profile(&d50_illuminant_specs);
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "Lab-D50-Identity-elle-V4.icc");
                             filename = "Lab-D50-Identity-elle-V4.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);

profile = cmsCreateXYZProfile();
cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
description = cmsMLUalloc(NULL, 1);
cmsMLUsetASCII(description, "en", "US", "XYZ-D50-Identity-elle-V4.icc");
                             filename = "XYZ-D50-Identity-elle-V4.icc";
cmsSaveProfileToFile(profile, filename);
cmsMLUfree(description);


/* For the following profiles, information is provided, but not the actual
 * profile making code.
 * */

/* old monitor-based editing profiles */

/* ColorMatchRGB, D50, gamma=1.80 */
/* http://www.dpreview.com/forums/post/3902882 
 * http://lists.apple.com/archives/colorsync-users/2001/Apr/msg00073.html
 * ColorMatch was designed to fit Radius PressView CRT monitors,
 * similar to sRGB fitting consumer-grade CRT monitors, 
 * "fit" meaning "could be calibrated to match".
 * Adobe does still distribute a ColorMatchRGB profile.
 * Making this profile using the D50_romm_doc white point that is used 
 * in other old V2 profiles (ProPhoto, WideGamut)
 * doesn't make a well behaved profile,
 * but the resulting profile is very close to the Adobe-supplied version. 
 * Using the prequantized primaries makes a profile that's just as close
 * to the Adobe-supplied version and in addition is well behaved.
 * Unless you have untagged images created on a PressView CRT, 
 * there is no reason to make or use this profile. 
 * */
cmsCIExyYTRIPLE colormatch_primaries = {
{0.6300, 0.3400, 1.0},
{0.2950, 0.6050, 1.0},
{0.1500, 0.0750, 1.0}
};
cmsCIExyYTRIPLE colormatch_primaries_prequantized = {
{0.629992636, 0.339999723, 1.0},
{0.295006332, 0.604997745, 1.0},
{0.149992036, 0.075005244, 1.0}
};
primaries = colormatch_primaries_prequantized;
whitepoint = d50_romm_spec;
tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma180[0];

/* AppleRGB, D65, gamma=1.80 */
/* AppleRGB was created to fit the old Apple CRT displays
 * just as sRGB fit consumer-grade CRT monitors
 * and ColorMatch fit PressView CRT monitors.
 * */
cmsCIExyYTRIPLE apple_primaries = {
{0.6250, 0.3400, 1.0},
{0.2800, 0.5950, 1.0},
{0.1550, 0.0700, 1.0}
};
cmsCIExyYTRIPLE apple_primaries_prequantized = {
{0.625012368, 0.340000081, 1.0},
{0.279996113, 0.595006943, 1.0},
{0.155001212, 0.070001183, 1.0}
};
primaries = apple_primaries_prequantized;
whitepoint = d65_srgb_adobe_specs;
tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma180[0];

/* video profiles */

/* PAL-SECAM, D65 gamma=2.20 */
/* http://en.wikipedia.org/wiki/PAL */
cmsCIExyYTRIPLE pal_primaries = {
{0.6400, 0.3300, 1.0},
{0.2900, 0.6000, 1.0},
{0.1500, 0.0600, 1.0}
}; 
/* PAL is one of many video and television-related color spaces. 
 * If you need the original profile with all its tags, 
 * I recommend that you use the Argyllcms version of this profile 
 * (EBU3213_PAL.icm, located in the "ref" folder), 
 * rather than making your own. 
 * But if you do want to make your own PAL profile using LCMS2, 
 * these prequantized primaries and white point make a profile with 
 * the same primaries and white point as the Argyllcms profile. 
 * The Argyllcms profile has a point curve TRC.
 * */
cmsCIExyYTRIPLE pal_primaries_prequantized = {
{0.640007798, 0.330006592, 1.0},
{0.290000327, 0.600000840, 1.0},
{0.149998025, 0.059996098, 1.0}
};
primaries = pal_primaries_prequantized;
whitepoint = d65_srgb_adobe_specs;
tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma220[0];

/* SMPTE-C, D65, gamma=2.20 */
/* http://en.wikipedia.org/wiki/NTSC#SMPTE_C 
 * SMPTE-C is one of many video and television-related color spaces 
 * and is an update of the original NTSC. */
cmsCIExyYTRIPLE smpte_c_primaries = {
{0.6300, 0.3400, 1.0},
{0.3100, 0.5950, 1.0},
{0.1550, 0.0700, 1.0}
};
cmsCIExyYTRIPLE smpte_c_primaries_prequantized = {
{0.629996495, 0.339990597, 1.0},
{0.309997880, 0.594995808, 1.0},
{0.149999952, 0.069999431, 1.0}
};
primaries = smpte_c_primaries_prequantized;
whitepoint = d65_srgb_adobe_specs;
tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma220[0];

/* NTSC, C, gamma=2.20 */
/* http://en.wikipedia.org/wiki/NTSC#Colorimetry*/
/* According to Wikipedia, these "original 1953 color NTSC specifications"
 * were used by early television receivers. */
cmsCIExyYTRIPLE ntcs_primaries = {
{0.6700, 0.3300, 1.0},
{0.2100, 0.7100, 1.0},
{0.1400, 0.0800, 1.0}
}; 
cmsCIExyYTRIPLE ntcs_primaries_prequantized = {
{0.670010373, 0.330001186, 1.0},
{0.209999261, 0.710001124, 1.0},
{0.139996061, 0.080002934, 1.0}
};
primaries = ntcs_primaries_prequantized;
whitepoint = c_astm;
tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma220[0];


/* ***********************  wrap up and close out  ****************** */

/* free copyright */
cmsMLUfree(copyright);

/* make gcc happy by returning an integer from main() */
return 0;
}