1 /* License:
2  *
3  * Code for making well-behaved ICC profiles
4  * Copyright © 2013, 2014, 2015 Elle Stone
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19  *
20  * Contact information:
21  * ellestone@ninedegreesbelow.com
22  * http://ninedegreesbelow.com
23  *
24  * */
25 
26 /* About the ICC profile header "Platform" tag:
27  *
28  * When creating a profile, LCMS checks to see if the platform is
29  * Windows ('MSFT'). If your platform isn't Windows, LCMS defaults
30  * to using the Apple ('APPL') platform tag for the profile header.
31  *
32  * There is an unofficial Platform
33  * cmsPlatformSignature cmsSigUnices 0x2A6E6978 '*nix'. There is,
34  * however, no LCMS2 API for changing the platform when making a profile.
35  *
36  * So on my own computer, to replace 'APPL' with '*nix' in the header,
37  * I modified the LCMS source file 'cmsio0.c' and recompiled LCMS:
38  * #ifdef CMS_IS_WINDOWS_
39  * Header.platform= (cmsPlatformSignature) _cmsAdjustEndianess32(cmsSigMicrosoft);
40  * #else
41  * Header.platform= (cmsPlatformSignature) _cmsAdjustEndianess32(cmsSigUnices);
42  * #endif
43  *
44  * */
45 
46 /* Sample command line to compile this code:
47  *
48  * gcc -g -O0 -Wall -o make-elles-profiles make-elles-profiles.c -llcms2
49  *
50  * You'll see a lot of harmless warnings about unused variables.
51  * That's because I included variables for profiles that the code
52  * doesn't actually make, in case you might want to make
53  * these profiles for your own use.
54  *
55  * */
56 
57 #include <lcms2.h>
main()58 int main ()
59 {
60 /* prints D50 XYZ values from lcms2.h,
61  * mostly to let you know the code did something!
62  * */
63 printf("D50X, D50Y, D50Z = %1.8f %1.8f %1.8f\n", cmsD50X, cmsD50Y, cmsD50Z);
64 
65 
66 /* ************************** TONE CURVES *************************** */
67 
68 /* sRGB, Rec709, and labl Tone Reproduction Curves ("TRCs") */
69 /* About these TRCs:
70  * This code makes V2 and V4 ICC profiles.
71  * For the V4 profiles, which are made using parametric curves,
72  * these TRCs can work in unbounded mode.
73  * For the V2 profiles, the resulting TRC is a 4096-point curve and
74  * cannot work in unbounded mode.
75  * See http://ninedegreesbelow.com/photography/lcms2-unbounded-mode.html
76  * for an explanation of unbounded mode ICC profile conversions.
77  *
78  * Also, during ICC profile conversions,
79  * LCMS quantizes images with ICC profiles that have point TRCs.
80  * So use the V4 profile variants for editing images with software
81  * that uses LCMS2 as the Color Management System.
82  * */
83 
84 /* sRGB TRC */
85 cmsFloat64Number srgb_parameters[5] =
86    { 2.4, 1.0 / 1.055,  0.055 / 1.055, 1.0 / 12.92, 0.04045 };
87 cmsToneCurve *srgb_parametric_curve =
88    cmsBuildParametricToneCurve(NULL, 4, srgb_parameters);
89 cmsToneCurve *srgb_parametric[3] =
90    {srgb_parametric_curve,srgb_parametric_curve,srgb_parametric_curve};
91 
92 /* LAB "L" (perceptually uniform) TRC */
93 cmsFloat64Number labl_parameters[5] =
94    { 3.0, 0.862076,  0.137924, 0.110703, 0.080002 };
95 cmsToneCurve *labl_parametric_curve =
96    cmsBuildParametricToneCurve(NULL, 4, labl_parameters);
97 cmsToneCurve *labl_parametric[3] =
98    {labl_parametric_curve,labl_parametric_curve,labl_parametric_curve};
99 
100 /* Rec 709 TRC */
101 cmsFloat64Number rec709_parameters[5] =
102    { 1.0 / 0.45, 1.0 / 1.099,  0.099 / 1.099,  1.0 / 4.5, 0.018 };
103 cmsToneCurve *rec709_parametric_curve =
104    cmsBuildParametricToneCurve(NULL, 4, rec709_parameters);
105 cmsToneCurve *rec709_parametric[3] =
106    {rec709_parametric_curve,rec709_parametric_curve,rec709_parametric_curve};
107 
108 /* The following true gamma TRCs work in unbounded mode
109  * for both V2 and V4 profiles, and quantization during ICC profile
110  * conversions is not an issue with either the V2 or V4 variants: */
111 
112 /* gamma=1.00, linear gamma, "linear light", etc tone response curve */
113 cmsToneCurve* gamma100[3];
114 gamma100[0] = gamma100[1] = gamma100[2] = cmsBuildGamma (NULL, 1.00);
115 
116 cmsToneCurve* gamma200[3];
117 gamma200[0] = gamma200[1] = gamma200[2] = cmsBuildGamma (NULL, 2.00);
118 
119 /* Because of hexadecimal rounding during the profile making process,
120  * the following two gamma values for the profile's TRC are not precisely
121  * preserved when a V2 profile is made. So I used the V2 value for
122  * both V2 and V4 versions of the profiles that use these TRCs.
123  * Otherwise V2 and V4 versions of nominally gamma=1.80 and gamma=2.20
124  * profiles would have slightly different gamma curves.
125  * */
126 
127 /* gamma=1.80078125 tone response curve */
128 /* 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  * This odd value is because of hexadecimal rounding.
133  * */
134 cmsToneCurve* gamma180[3];
135 gamma180[0] = gamma180[1] = gamma180[2] = cmsBuildGamma (NULL, 1.80078125);
136 
137 /* gamma=2.19921875 tone response curve */
138 /* per http://www.adobe.com/digitalimag/pdfs/AdobeRGB1998.pdf;
139  * ClayRGB uses this value. Based on an old proprietary profile,
140  * it also appears to be the correct gamma for WideGamutRGB.
141  * It also is what you get when you
142  * try to create a V2 profile with a gamma=2.20 gamma curve.
143  * So perhaps the AdobeRGB1998 specifications
144  * were simply bowing to the inevitable hexadecimal rounding.
145  * Almost all (all?) V2 ICC profiles with nominally gamma=2.20
146  * really have a gamma of 2.19921875, not 2.20.
147  * */
148 
149 cmsToneCurve* gamma220[3];
150 gamma220[0] = gamma220[1] = gamma220[2] = cmsBuildGamma (NULL, 2.19921875);
151 
152 /* ************************** WHITE POINTS ************************** */
153 
154 /* D50 WHITE POINTS */
155 
156 cmsCIExyY d50_romm_spec= {0.3457, 0.3585, 1.0};
157 /* http://photo-lovers.org/pdf/color/romm.pdf */
158 
159 cmsCIExyY d50_illuminant_specs = {0.345702915, 0.358538597, 1.0};
160 /* calculated from D50 illuminant XYZ values in ICC specs */
161 
162 
163 /* D65 WHITE POINTS */
164 
165 cmsCIExyY  d65_srgb_adobe_specs = {0.3127, 0.3290, 1.0};
166 /* White point from the sRGB.icm and AdobeRGB1998 profile specs:
167  * http://www.adobe.com/digitalimag/pdfs/AdobeRGB1998.pdf
168  * 4.2.1 Reference Display White Point
169  * The chromaticity coordinates of white displayed on
170  * the reference color monitor shall be x=0.3127, y=0.3290.
171  * . . . [which] correspond to CIE Standard Illuminant D65.
172  *
173  * Wikipedia gives this same white point for SMPTE-C.
174  * This white point is also given in the sRGB color space specs.
175  * It's probably correct for most or all of the standard D65 profiles.
176  *
177  * The D65 white point values used in the LCMS virtual sRGB profile
178  * is slightly different than the D65 white point values given in the
179  * sRGB color space specs, so the LCMS virtual sRGB profile
180  * doesn't match sRGB profiles made using the values given in the
181  * sRGB color space specs.
182  *
183  * */
184 
185 
186 /* Various C and E WHITE POINTS */
187 
188 cmsCIExyY c_astm  = {0.310060511, 0.316149551, 1.0};
189 /* see http://www.brucelindbloom.com/index.html?Eqn_ChromAdapt.html */
190 cmsCIExyY e_astm  = {0.333333333, 0.333333333, 1.0};
191 /* see http://www.brucelindbloom.com/index.html?Eqn_ChromAdapt.html */
192 
193 cmsCIExyY c_cie= {0.310, 0.316};
194 /* https://en.wikipedia.org/wiki/NTSC#Colorimetry */
195 cmsCIExyY e_cie= {0.333, 0.333};
196 
197 cmsCIExyY c_6774_robertson= {0.308548930, 0.324928102, 1.0};
198 /* see http://en.wikipedia.org/wiki/Standard_illuminant#White_points_of_standard_illuminants
199  * also see  http://www.brucelindbloom.com/index.html?Eqn_T_to_xy.html for the equations */
200 cmsCIExyY e_5454_robertson= {0.333608970, 0.348572909, 1.0};
201 /* see http://en.wikipedia.org/wiki/Standard_illuminant#White_points_of_standard_illuminants
202  * also see http://www.brucelindbloom.com/index.html?Eqn_T_to_xy.html for the equations */
203 
204 
205 /* ACES white point, taken from
206  * Specification S-2014-004
207  * ACEScg – A Working Space for CGI Render and Compositing
208  */
209 cmsCIExyY d60_aces= {0.32168, 0.33767, 1.0};
210 
211 /* *****************Set up profile variables and values *************** */
212 cmsHPROFILE profile;
213 cmsToneCurve* tone_curve[3];
214 cmsCIExyY whitepoint;
215 cmsCIExyYTRIPLE primaries;
216 const char* filename;
217 cmsMLU *copyright = cmsMLUalloc(NULL, 1);
218 
219 /* I put a Creative Commons Attribution-ShareAlike 3.0 Unported License
220  * on the profiles that I distribute (see
221  * https://creativecommons.org/licenses/by-sa/3.0/legalcode)
222  * The CC V3 Attribution-ShareAlike unported licence is accepted by both
223  * Debian and Fedora as a free licence.
224  *
225  * Note that the CC V3 BY-SA licence that I put on the ICC profiles
226  * is not the same licence that's applied to my profile-making code,
227  * which is LGPL2.1+.
228  *
229  * Of course you can modify my profile-making code to put some other
230  * *profile* copyright on the actual profiles that the code makes,
231  * for example public domain (Creative Commons CC0)
232  * or one of the GPL copyrights.
233  *
234  * The ICC suggested wording for profile copyrights is here
235  * (see the last section, entitled "Licensing"):
236  * http://www.color.org/registry/profileregistration.xalter
237  *
238  * The ICC copyright sounds like it's probably a free licence,
239  * but as of June 2015 it hasn't been accepted by Fedora or Debian as a
240  * free license.
241  *
242  * Here are the Fedora and Debian lists of free licences:
243  *
244  * https://fedoraproject.org/wiki/Licensing:Main?rd=Licensing#Content_Licenses
245  * https://wiki.debian.org/DFSGLicenses
246  *
247  * */
248 
249 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).");
250 
251 cmsMLU *manufacturer = cmsMLUalloc(NULL, 1);
252 
253 cmsMLU *description;
254 
255 /* ********************** MAKE THE PROFILES ************************* */
256 
257 /* ACES PROFILES */
258 
259 /* ***** Make profile: ACEScg, D60, gamma=1.00 */
260 /* ACEScg chromaticities taken from
261  * Specification S-2014-004
262  * ACEScg – A Working Space for CGI Render and Compositing
263  */
264 cmsCIExyYTRIPLE aces_cg_primaries =
265 {
266 {0.713, 0.293,  1.0},
267 {0.165, 0.830,  1.0},
268 {0.128, 0.044,  1.0}
269 };
270 
271 whitepoint = d60_aces;
272 primaries = aces_cg_primaries;
273 
274 /* linear gamma */
275 tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma100[0];
276 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
277 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
278 /* V4 */
279 description = cmsMLUalloc(NULL, 1);
280 cmsMLUsetASCII(description, "en", "US", "ACEScg-elle-V4-g10.icc");
281 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
282                              filename = "ACEScg-elle-V4-g10.icc";
283 cmsSaveProfileToFile(profile, filename);
284 cmsMLUfree(description);
285 /* V2 */
286 cmsSetProfileVersion(profile, 2.1);
287 description = cmsMLUalloc(NULL, 1);
288 cmsMLUsetASCII(description, "en", "US", "ACEScg-elle-V2-g10.icc");
289 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
290                              filename = "ACEScg-elle-V2-g10.icc";
291 cmsSaveProfileToFile(profile, filename);
292 cmsMLUfree(description);
293 
294 /* gamma=2.2 */
295 tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma220[0];
296 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
297 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
298 /* V4 */
299 description = cmsMLUalloc(NULL, 1);
300 cmsMLUsetASCII(description, "en", "US", "ACEScg-elle-V4-g22.icc");
301 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
302                              filename = "ACEScg-elle-V4-g22.icc";
303 cmsSaveProfileToFile(profile, filename);
304 cmsMLUfree(description);
305 /* V2 */
306 cmsSetProfileVersion(profile, 2.1);
307 description = cmsMLUalloc(NULL, 1);
308 cmsMLUsetASCII(description, "en", "US", "ACEScg-elle-V2-g22.icc");
309 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
310                              filename = "ACEScg-elle-V2-g22.icc";
311 cmsSaveProfileToFile(profile, filename);
312 cmsMLUfree(description);
313 
314 /* sRGB TRC */
315 tone_curve[0] = tone_curve[1] = tone_curve[2] = srgb_parametric[0];
316 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
317 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
318 /* V4 */
319 description = cmsMLUalloc(NULL, 1);
320 cmsMLUsetASCII(description, "en", "US", "ACEScg-elle-V4-srgbtrc.icc");
321 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
322                              filename = "ACEScg-elle-V4-srgbtrc.icc";
323 cmsSaveProfileToFile(profile, filename);
324 cmsMLUfree(description);
325 /* V2 */
326 cmsSetProfileVersion(profile, 2.1);
327 description = cmsMLUalloc(NULL, 1);
328 cmsMLUsetASCII(description, "en", "US", "ACEScg-elle-V2-srgbtrc.icc");
329 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
330                              filename = "ACEScg-elle-V2-srgbtrc.icc";
331 cmsSaveProfileToFile(profile, filename);
332 cmsMLUfree(description);
333 
334 /* labl TRC */
335 tone_curve[0] = tone_curve[1] = tone_curve[2] = labl_parametric[0];
336 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
337 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
338 /* V4 */
339 description = cmsMLUalloc(NULL, 1);
340 cmsMLUsetASCII(description, "en", "US", "ACEScg-elle-V4-labl.icc");
341 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
342                              filename = "ACEScg-elle-V4-labl.icc";
343 cmsSaveProfileToFile(profile, filename);
344 cmsMLUfree(description);
345 /* V2 */
346 cmsSetProfileVersion(profile, 2.1);
347 description = cmsMLUalloc(NULL, 1);
348 cmsMLUsetASCII(description, "en", "US", "ACEScg-elle-V2-labl.icc");
349 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
350                              filename = "ACEScg-elle-V2-labl.icc";
351 cmsSaveProfileToFile(profile, filename);
352 cmsMLUfree(description);
353 
354 
355 
356 /* ***** Make profile: ACES, D60, gamma=1.00 */
357 /* ACES chromaticities taken from
358  * Specification
359  * */
360 cmsCIExyYTRIPLE aces_primaries =
361 {
362 {0.73470,  0.26530,  1.0},
363 {0.00000,  1.00000,  1.0},
364 {0.00010, -0.07700,  1.0}
365 };
366 cmsCIExyYTRIPLE aces_primaries_prequantized =
367 {
368 {0.734704192222, 0.265298276252,  1.0},
369 {-0.000004945077, 0.999992850272,  1.0},
370 {0.000099889199, -0.077007518685,  1.0}
371 };
372 
373 whitepoint = d60_aces;
374 primaries = aces_primaries_prequantized;
375 
376 /* linear gamma */
377 tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma100[0];
378 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
379 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
380 /* V4 */
381 description = cmsMLUalloc(NULL, 1);
382 cmsMLUsetASCII(description, "en", "US", "ACES-elle-V4-g10.icc");
383 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
384                              filename = "ACES-elle-V4-g10.icc";
385 cmsSaveProfileToFile(profile, filename);
386 cmsMLUfree(description);
387 /* V2 */
388 cmsSetProfileVersion(profile, 2.1);
389 description = cmsMLUalloc(NULL, 1);
390 cmsMLUsetASCII(description, "en", "US", "ACES-elle-V2-g10.icc");
391 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
392                              filename = "ACES-elle-V2-g10.icc";
393 cmsSaveProfileToFile(profile, filename);
394 cmsMLUfree(description);
395 
396 /* gamma=2.2 */
397 tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma220[0];
398 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
399 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
400 /* V4 */
401 description = cmsMLUalloc(NULL, 1);
402 cmsMLUsetASCII(description, "en", "US", "ACES-elle-V4-g122.icc");
403 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
404                              filename = "ACES-elle-V4-g22.icc";
405 cmsSaveProfileToFile(profile, filename);
406 cmsMLUfree(description);
407 /* V2 */
408 cmsSetProfileVersion(profile, 2.1);
409 description = cmsMLUalloc(NULL, 1);
410 cmsMLUsetASCII(description, "en", "US", "ACES-elle-V2-g22.icc");
411 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
412                              filename = "ACES-elle-V2-g22.icc";
413 cmsSaveProfileToFile(profile, filename);
414 cmsMLUfree(description);
415 
416 /* sRGB TRC */
417 tone_curve[0] = tone_curve[1] = tone_curve[2] = srgb_parametric[0];
418 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
419 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
420 /* V4 */
421 description = cmsMLUalloc(NULL, 1);
422 cmsMLUsetASCII(description, "en", "US", "ACES-elle-V4-srgbtrc.icc");
423 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
424                              filename = "ACES-elle-V4-srgbtrc.icc";
425 cmsSaveProfileToFile(profile, filename);
426 cmsMLUfree(description);
427 /* V2 */
428 cmsSetProfileVersion(profile, 2.1);
429 description = cmsMLUalloc(NULL, 1);
430 cmsMLUsetASCII(description, "en", "US", "ACES-elle-V2-srgbtrc.icc");
431 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
432                              filename = "ACES-elle-V2-srgbtrc.icc";
433 cmsSaveProfileToFile(profile, filename);
434 cmsMLUfree(description);
435 
436 /* labl TRC */
437 tone_curve[0] = tone_curve[1] = tone_curve[2] = labl_parametric[0];
438 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
439 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
440 /* V4 */
441 description = cmsMLUalloc(NULL, 1);
442 cmsMLUsetASCII(description, "en", "US", "ACES-elle-V4-labl.icc");
443 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
444                              filename = "ACES-elle-V4-labl.icc";
445 cmsSaveProfileToFile(profile, filename);
446 cmsMLUfree(description);
447 /* V2 */
448 cmsSetProfileVersion(profile, 2.1);
449 description = cmsMLUalloc(NULL, 1);
450 cmsMLUsetASCII(description, "en", "US", "ACES-elle-V2-labl.icc");
451 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
452                              filename = "ACES-elle-V2-labl.icc";
453 cmsSaveProfileToFile(profile, filename);
454 cmsMLUfree(description);
455 
456 
457 
458 
459 /* D50 PROFILES */
460 
461 /* ***** Make profile: AllColorsRGB, D50, gamma=1.00 */
462 /* AllColors.icc has a slightly larger color gamut than the ACES color space.
463  * It has a D50 white point and a linear gamma TRC.
464  * It holds all visible colors.
465  * Just like the ACES color space,
466  * AllColors also holds a high percentage of imaginary colors.
467  * See http://ninedegreesbelow.com/photography/xyz-rgb.html#xyY
468  * for more information about imaginary colors.
469  * AllColors primaries for red and blue from
470  * http://www.ledtuning.nl/en/cie-convertor
471  * blue 375nm red 780nm, plus Y intercepts:
472  * Color Wavelength (): 375 nm.
473  * Spectral Locus coordinates: X:0.17451 Y:0.005182
474  * Color Wavelength (): 780 nm.
475  * Spectral Locus coordinates: X:0.734690265 Y:0.265309735
476  * X1:0.17451 Y1:0.005182
477  * X2:0.734690265 Y2:0.265309735
478  * X3:0.00Y3:? Solve for Y3:
479  * (0.265309735-0.005182)/(0.734690265-0.17451)=0.46436433279205221554=m
480  * y=mx+b let x=0; y=b
481  * Y1=0.005182=(0.46436433279205221554*0.17451)+b
482  * b=0.005182-(0.46436433279205221554*0.17451)=-.07585421971554103213
483  *  */
484 cmsCIExyYTRIPLE allcolors_primaries =
485 {
486 {0.734690265,  0.265309735,  1.0},
487 {0.000000000,  1.000000000,  1.0},
488 {0.000000000, -.0758542197,  1.0}
489 };
490 whitepoint = d50_illuminant_specs;
491 primaries = allcolors_primaries;
492 
493 /* linear gamma */
494 tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma100[0];
495 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
496 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
497 /* V4 */
498 description = cmsMLUalloc(NULL, 1);
499 cmsMLUsetASCII(description, "en", "US", "AllColorsRGB-elle-V4-g10.icc");
500 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
501                              filename = "AllColorsRGB-elle-V4-g10.icc";
502 cmsSaveProfileToFile(profile, filename);
503 cmsMLUfree(description);
504 /* V2 */
505 cmsSetProfileVersion(profile, 2.1);
506 description = cmsMLUalloc(NULL, 1);
507 cmsMLUsetASCII(description, "en", "US", "AllColorsRGB-elle-V2-g10.icc");
508 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
509                              filename = "AllColorsRGB-elle-V2-g10.icc";
510 cmsSaveProfileToFile(profile, filename);
511 cmsMLUfree(description);
512 
513 /* gamma=2.2 */
514 tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma220[0];
515 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
516 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
517 /* V4 */
518 description = cmsMLUalloc(NULL, 1);
519 cmsMLUsetASCII(description, "en", "US", "AllColorsRGB-elle-V4-g22.icc");
520 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
521                              filename = "AllColorsRGB-elle-V4-g22.icc";
522 cmsSaveProfileToFile(profile, filename);
523 cmsMLUfree(description);
524 /* V2 */
525 cmsSetProfileVersion(profile, 2.1);
526 description = cmsMLUalloc(NULL, 1);
527 cmsMLUsetASCII(description, "en", "US", "AllColorsRGB-elle-V2-g22.icc");
528 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
529                              filename = "AllColorsRGB-elle-V2-g22.icc";
530 cmsSaveProfileToFile(profile, filename);
531 cmsMLUfree(description);
532 
533 /* sRGB TRC */
534 tone_curve[0] = tone_curve[1] = tone_curve[2] = srgb_parametric[0];
535 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
536 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
537 /* V4 */
538 description = cmsMLUalloc(NULL, 1);
539 cmsMLUsetASCII(description, "en", "US", "AllColorsRGB-elle-V4-srgbtrc.icc");
540 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
541                              filename = "AllColorsRGB-elle-V4-srgbtrc.icc";
542 cmsSaveProfileToFile(profile, filename);
543 cmsMLUfree(description);
544 /* V2 */
545 cmsSetProfileVersion(profile, 2.1);
546 description = cmsMLUalloc(NULL, 1);
547 cmsMLUsetASCII(description, "en", "US", "AllColorsRGB-elle-V2-srgbtrc.icc");
548 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
549                              filename = "AllColorsRGB-elle-V2-srgbtrc.icc";
550 cmsSaveProfileToFile(profile, filename);
551 cmsMLUfree(description);
552 
553 /* labl TRC */
554 tone_curve[0] = tone_curve[1] = tone_curve[2] = labl_parametric[0];
555 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
556 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
557 /* V4 */
558 description = cmsMLUalloc(NULL, 1);
559 cmsMLUsetASCII(description, "en", "US", "AllColorsRGB-elle-V4-labl.icc");
560 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
561                              filename = "AllColorsRGB-elle-V4-labl.icc";
562 cmsSaveProfileToFile(profile, filename);
563 cmsMLUfree(description);
564 /* V2 */
565 cmsSetProfileVersion(profile, 2.1);
566 description = cmsMLUalloc(NULL, 1);
567 cmsMLUsetASCII(description, "en", "US", "AllColorsRGB-elle-V2-labl.icc");
568 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
569                              filename = "AllColorsRGB-elle-V2-labl.icc";
570 cmsSaveProfileToFile(profile, filename);
571 cmsMLUfree(description);
572 
573 
574 /* ***** Make profile: Identity, D50, gamma=1.00. */
575 /* These primaries also hold all possible visible colors,
576  * but less efficiently than the AllColors profile.*/
577 cmsCIExyYTRIPLE identity_primaries = {/*  */
578 {1.0, 0.0, 1.0},
579 {0.0, 1.0, 1.0},
580 {0.0, 0.0, 1.0}
581 };
582 whitepoint = d50_illuminant_specs;
583 primaries = identity_primaries;
584 
585 /* linear gamma */
586 tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma100[0];
587 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
588 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
589 /* V4 */
590 description = cmsMLUalloc(NULL, 1);
591 cmsMLUsetASCII(description, "en", "US", "IdentityRGB-elle-V4-g10.icc");
592 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
593                              filename = "IdentityRGB-elle-V4-g10.icc";
594 cmsSaveProfileToFile(profile, filename);
595 cmsMLUfree(description);
596 /* V2 */
597 cmsSetProfileVersion(profile, 2.1);
598 description = cmsMLUalloc(NULL, 1);
599 cmsMLUsetASCII(description, "en", "US", "IdentityRGB-elle-V2-g10.icc");
600 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
601                              filename = "IdentityRGB-elle-V2-g10.icc";
602 cmsSaveProfileToFile(profile, filename);
603 cmsMLUfree(description);
604 
605 /* gamma=2.2 */
606 tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma220[0];
607 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
608 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
609 /* V4 */
610 description = cmsMLUalloc(NULL, 1);
611 cmsMLUsetASCII(description, "en", "US", "IdentityRGB-elle-V4-g22.icc");
612 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
613                              filename = "IdentityRGB-elle-V4-g22.icc";
614 cmsSaveProfileToFile(profile, filename);
615 cmsMLUfree(description);
616 /* V2 */
617 cmsSetProfileVersion(profile, 2.1);
618 description = cmsMLUalloc(NULL, 1);
619 cmsMLUsetASCII(description, "en", "US", "IdentityRGB-elle-V2-g22.icc");
620 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
621                              filename = "IdentityRGB-elle-V2-g22.icc";
622 cmsSaveProfileToFile(profile, filename);
623 cmsMLUfree(description);
624 
625 /* sRGB TRC */
626 tone_curve[0] = tone_curve[1] = tone_curve[2] = srgb_parametric[0];
627 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
628 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
629 /* V4 */
630 description = cmsMLUalloc(NULL, 1);
631 cmsMLUsetASCII(description, "en", "US", "IdentityRGB-elle-V4-srgbtrc.icc");
632 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
633                              filename = "IdentityRGB-elle-V4-srgbtrc.icc";
634 cmsSaveProfileToFile(profile, filename);
635 cmsMLUfree(description);
636 /* V2 */
637 cmsSetProfileVersion(profile, 2.1);
638 description = cmsMLUalloc(NULL, 1);
639 cmsMLUsetASCII(description, "en", "US", "IdentityRGB-elle-V2-srgbtrc.icc");
640 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
641                              filename = "IdentityRGB-elle-V2-srgbtrc.icc";
642 cmsSaveProfileToFile(profile, filename);
643 cmsMLUfree(description);
644 
645 /* labl TRC */
646 tone_curve[0] = tone_curve[1] = tone_curve[2] = labl_parametric[0];
647 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
648 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
649 /* V4 */
650 description = cmsMLUalloc(NULL, 1);
651 cmsMLUsetASCII(description, "en", "US", "IdentityRGB-elle-V4-labl.icc");
652 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
653                              filename = "IdentityRGB-elle-V4-labl.icc";
654 cmsSaveProfileToFile(profile, filename);
655 cmsMLUfree(description);
656 /* V2 */
657 cmsSetProfileVersion(profile, 2.1);
658 description = cmsMLUalloc(NULL, 1);
659 cmsMLUsetASCII(description, "en", "US", "IdentityRGB-elle-V2-labl.icc");
660 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
661                              filename = "IdentityRGB-elle-V2-labl.icc";
662 cmsSaveProfileToFile(profile, filename);
663 cmsMLUfree(description);
664 
665 
666 /* ***** Make profile: Romm/Prophoto, D50, gamma=1.80 */
667 /* Reference Input/Output Medium Metric RGB Color Encodings (RIMM/ROMM RGB)
668  * Kevin E. Spaulding, Geoffrey J. Woolfe and Edward J. Giorgianni
669  * Eastman Kodak Company, Rochester, New York, U.S.A.
670  * Above document is available at http://photo-lovers.org/pdf/color/romm.pdf
671  * Kodak designed the Romm (ProPhoto) color gamut to include all printable
672  * and most real world colors. It includes some imaginary colors and excludes
673  * some of the real world blues and violet blues that can be captured by
674  * digital cameras. For high bit depth image editing only.
675  */
676 cmsCIExyYTRIPLE romm_primaries = {
677 {0.7347, 0.2653, 1.0},
678 {0.1596, 0.8404, 1.0},
679 {0.0366, 0.0001, 1.0}
680 };
681 primaries = romm_primaries;
682 whitepoint = d50_romm_spec;
683 /* gamma 1.80 */
684 tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma180[0];
685 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
686 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
687 /* V4 */
688 description = cmsMLUalloc(NULL, 1);
689 cmsMLUsetASCII(description, "en", "US", "LargeRGB-elle-V4-g18.icc");
690 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
691                              filename = "LargeRGB-elle-V4-g18.icc";
692 cmsSaveProfileToFile(profile, filename);
693 cmsMLUfree(description);
694 /* V2 */
695 cmsSetProfileVersion(profile, 2.1);
696 description = cmsMLUalloc(NULL, 1);
697 cmsMLUsetASCII(description, "en", "US", "LargeRGB-elle-V2-g18.icc");
698 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
699                              filename = "LargeRGB-elle-V2-g18.icc";
700 cmsSaveProfileToFile(profile, filename);
701 cmsMLUfree(description);
702 
703 /* linear gamma */
704 tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma100[0];
705 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
706 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
707 /* V4 */
708 description = cmsMLUalloc(NULL, 1);
709 cmsMLUsetASCII(description, "en", "US", "LargeRGB-elle-V4-g10.icc");
710 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
711                              filename = "LargeRGB-elle-V4-g10.icc";
712 cmsSaveProfileToFile(profile, filename);
713 cmsMLUfree(description);
714 /* V2 */
715 cmsSetProfileVersion(profile, 2.1);
716 description = cmsMLUalloc(NULL, 1);
717 cmsMLUsetASCII(description, "en", "US", "LargeRGB-elle-V2-g10.icc");
718 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
719                              filename = "LargeRGB-elle-V2-g10.icc";
720 cmsSaveProfileToFile(profile, filename);
721 cmsMLUfree(description);
722 
723 /* gamma=2.2 */
724 tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma220[0];
725 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
726 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
727 /* V4 */
728 description = cmsMLUalloc(NULL, 1);
729 cmsMLUsetASCII(description, "en", "US", "LargeRGB-elle-V4-g22.icc");
730 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
731                              filename = "LargeRGB-elle-V4-g22.icc";
732 cmsSaveProfileToFile(profile, filename);
733 cmsMLUfree(description);
734 /* V2 */
735 cmsSetProfileVersion(profile, 2.1);
736 description = cmsMLUalloc(NULL, 1);
737 cmsMLUsetASCII(description, "en", "US", "LargeRGB-elle-V2-g22.icc");
738 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
739                              filename = "LargeRGB-elle-V2-g22.icc";
740 cmsSaveProfileToFile(profile, filename);
741 cmsMLUfree(description);
742 
743 /* sRGB TRC */
744 tone_curve[0] = tone_curve[1] = tone_curve[2] = srgb_parametric[0];
745 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
746 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
747 /* V4 */
748 description = cmsMLUalloc(NULL, 1);
749 cmsMLUsetASCII(description, "en", "US", "LargeRGB-elle-V4-srgbtrc.icc");
750 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
751                              filename = "LargeRGB-elle-V4-srgbtrc.icc";
752 cmsSaveProfileToFile(profile, filename);
753 cmsMLUfree(description);
754 /* V2 */
755 cmsSetProfileVersion(profile, 2.1);
756 description = cmsMLUalloc(NULL, 1);
757 cmsMLUsetASCII(description, "en", "US", "LargeRGB-elle-V2-srgbtrc.icc");
758 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
759                              filename = "LargeRGB-elle-V2-srgbtrc.icc";
760 cmsSaveProfileToFile(profile, filename);
761 cmsMLUfree(description);
762 
763 /* labl TRC */
764 tone_curve[0] = tone_curve[1] = tone_curve[2] = labl_parametric[0];
765 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
766 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
767 /* V4 */
768 description = cmsMLUalloc(NULL, 1);
769 cmsMLUsetASCII(description, "en", "US", "LargeRGB-elle-V4-labl.icc");
770 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
771                              filename = "LargeRGB-elle-V4-labl.icc";
772 cmsSaveProfileToFile(profile, filename);
773 cmsMLUfree(description);
774 /* V2 */
775 cmsSetProfileVersion(profile, 2.1);
776 description = cmsMLUalloc(NULL, 1);
777 cmsMLUsetASCII(description, "en", "US", "LargeRGB-elle-V2-labl.icc");
778 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
779                              filename = "LargeRGB-elle-V2-labl.icc";
780 cmsSaveProfileToFile(profile, filename);
781 cmsMLUfree(description);
782 
783 
784 
785 /* ***** Make profile: WidegamutRGB, D50, gamma=2.19921875 */
786 /* Pascale's primary values produce a profile that matches
787  * old V2 Widegamut profiles from Adobe and Canon.
788  * Danny Pascale: A review of RGB color spaces
789  * http://www.babelcolor.com/download/A%20review%20of%20RGB%20color%20spaces.pdf
790  * WideGamutRGB was designed by Adobe to be a wide gamut color space that uses
791  * spectral colors as its primaries. For high bit depth image editing only. */
792 cmsCIExyYTRIPLE widegamut_pascale_primaries = {
793 {0.7347, 0.2653, 1.0},
794 {0.1152, 0.8264, 1.0},
795 {0.1566, 0.0177, 1.0}
796 };
797 primaries = widegamut_pascale_primaries;
798 whitepoint = d50_romm_spec;
799 /* gamma 2.20 */
800 tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma220[0];
801 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
802 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
803 /* V4 */
804 description = cmsMLUalloc(NULL, 1);
805 cmsMLUsetASCII(description, "en", "US", "WideRGB-elle-V4-g22.icc");
806 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
807                              filename = "WideRGB-elle-V4-g22.icc";
808 cmsSaveProfileToFile(profile, filename);
809 cmsMLUfree(description);
810 /* V2 */
811 cmsSetProfileVersion(profile, 2.1);
812 description = cmsMLUalloc(NULL, 1);
813 cmsMLUsetASCII(description, "en", "US", "WideRGB-elle-V2-g22.icc");
814 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
815                              filename = "WideRGB-elle-V2-g22.icc";
816 cmsSaveProfileToFile(profile, filename);
817 cmsMLUfree(description);
818 
819 /* linear gamma */
820 tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma100[0];
821 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
822 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
823 /* V4 */
824 description = cmsMLUalloc(NULL, 1);
825 cmsMLUsetASCII(description, "en", "US", "WideRGB-elle-V4-g10.icc");
826 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
827                              filename = "WideRGB-elle-V4-g10.icc";
828 cmsSaveProfileToFile(profile, filename);
829 cmsMLUfree(description);
830 /* V2 */
831 cmsSetProfileVersion(profile, 2.1);
832 description = cmsMLUalloc(NULL, 1);
833 cmsMLUsetASCII(description, "en", "US", "WideRGB-elle-V2-g10.icc");
834 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
835                              filename = "WideRGB-elle-V2-g10.icc";
836 cmsSaveProfileToFile(profile, filename);
837 cmsMLUfree(description);
838 
839 /* sRGB TRC */
840 tone_curve[0] = tone_curve[1] = tone_curve[2] = srgb_parametric[0];
841 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
842 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
843 /* V4 */
844 description = cmsMLUalloc(NULL, 1);
845 cmsMLUsetASCII(description, "en", "US", "WideRGB-elle-V4-srgbtrc.icc");
846 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
847                              filename = "WideRGB-elle-V4-srgbtrc.icc";
848 cmsSaveProfileToFile(profile, filename);
849 cmsMLUfree(description);
850 /* V2 */
851 cmsSetProfileVersion(profile, 2.1);
852 description = cmsMLUalloc(NULL, 1);
853 cmsMLUsetASCII(description, "en", "US", "WideRGB-elle-V2-srgbtrc.icc");
854 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
855                              filename = "WideRGB-elle-V2-srgbtrc.icc";
856 cmsSaveProfileToFile(profile, filename);
857 cmsMLUfree(description);
858 
859 /* labl TRC */
860 tone_curve[0] = tone_curve[1] = tone_curve[2] = labl_parametric[0];
861 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
862 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
863 /* V4 */
864 description = cmsMLUalloc(NULL, 1);
865 cmsMLUsetASCII(description, "en", "US", "WideRGB-elle-V4-labl.icc");
866 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
867                              filename = "WideRGB-elle-V4-labl.icc";
868 cmsSaveProfileToFile(profile, filename);
869 cmsMLUfree(description);
870 /* V2 */
871 cmsSetProfileVersion(profile, 2.1);
872 description = cmsMLUalloc(NULL, 1);
873 cmsMLUsetASCII(description, "en", "US", "WideRGB-elle-V2-labl.icc");
874 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
875                              filename = "WideRGB-elle-V2-labl.icc";
876 cmsSaveProfileToFile(profile, filename);
877 cmsMLUfree(description);
878 
879 
880 /* D65 PROFILES */
881 
882 /* ***** Make profile: ClayRGB (AdobeRGB), D65, gamma=2.19921875 */
883 /* The Adobe RGB 1998 color gamut covers a higher percentage of
884  * real-world greens than sRGB, but still doesn't include all printable
885  * greens, yellows, and cyans.
886  * When made using the gamma=2.19921875 tone response curve,
887  * this profile can be used for 8-bit image editing
888  * if used with appropriate caution to avoid posterization.
889  * When made with the gamma=2.19921875 tone response curve
890  * this profile can be applied to DCF R98 camera-generated jpegs.
891  * */
892 cmsCIExyYTRIPLE adobe_primaries = {
893 {0.6400, 0.3300, 1.0},
894 {0.2100, 0.7100, 1.0},
895 {0.1500, 0.0600, 1.0}
896 };
897 cmsCIExyYTRIPLE adobe_primaries_prequantized = {
898 {0.639996511, 0.329996864, 1.0},
899 {0.210005295, 0.710004866, 1.0},
900 {0.149997606, 0.060003644, 1.0}
901 };
902 primaries = adobe_primaries_prequantized;
903 whitepoint = d65_srgb_adobe_specs;
904 /* gamma 2.20 */
905 tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma220[0];
906 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
907 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
908 /* V4 */
909 description = cmsMLUalloc(NULL, 1);
910 cmsMLUsetASCII(description, "en", "US", "ClayRGB-elle-V4-g22.icc");
911 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
912                              filename = "ClayRGB-elle-V4-g22.icc";
913 cmsSaveProfileToFile(profile, filename);
914 cmsMLUfree(description);
915 /* V2 */
916 cmsSetProfileVersion(profile, 2.1);
917 description = cmsMLUalloc(NULL, 1);
918 cmsMLUsetASCII(description, "en", "US", "ClayRGB-elle-V2-g22.icc");
919 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
920                              filename = "ClayRGB-elle-V2-g22.icc";
921 cmsSaveProfileToFile(profile, filename);
922 cmsMLUfree(description);
923 
924 /* linear gamma */
925 tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma100[0];
926 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
927 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
928 /* V4 */
929 description = cmsMLUalloc(NULL, 1);
930 cmsMLUsetASCII(description, "en", "US", "ClayRGB-elle-V4-g10.icc");
931 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
932                              filename = "ClayRGB-elle-V4-g10.icc";
933 cmsSaveProfileToFile(profile, filename);
934 cmsMLUfree(description);
935 /* V2 */
936 cmsSetProfileVersion(profile, 2.1);
937 description = cmsMLUalloc(NULL, 1);
938 cmsMLUsetASCII(description, "en", "US", "ClayRGB-elle-V2-g10.icc");
939 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
940                              filename = "ClayRGB-elle-V2-g10.icc";
941 cmsSaveProfileToFile(profile, filename);
942 cmsMLUfree(description);
943 
944 /* sRGB TRC */
945 tone_curve[0] = tone_curve[1] = tone_curve[2] = srgb_parametric[0];
946 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
947 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
948 /* V4 */
949 description = cmsMLUalloc(NULL, 1);
950 cmsMLUsetASCII(description, "en", "US", "ClayRGB-elle-V4-srgbtrc.icc");
951 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
952                              filename = "ClayRGB-elle-V4-srgbtrc.icc";
953 cmsSaveProfileToFile(profile, filename);
954 cmsMLUfree(description);
955 /* V2 */
956 cmsSetProfileVersion(profile, 2.1);
957 description = cmsMLUalloc(NULL, 1);
958 cmsMLUsetASCII(description, "en", "US", "ClayRGB-elle-V2-srgbtrc.icc");
959 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
960                              filename = "ClayRGB-elle-V2-srgbtrc.icc";
961 cmsSaveProfileToFile(profile, filename);
962 cmsMLUfree(description);
963 
964 /* labl TRC */
965 tone_curve[0] = tone_curve[1] = tone_curve[2] = labl_parametric[0];
966 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
967 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
968 /* V4 */
969 description = cmsMLUalloc(NULL, 1);
970 cmsMLUsetASCII(description, "en", "US", "ClayRGB-elle-V4-labl.icc");
971 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
972                              filename = "ClayRGB-elle-V4-labl.icc";
973 cmsSaveProfileToFile(profile, filename);
974 cmsMLUfree(description);
975 /* V2 */
976 cmsSetProfileVersion(profile, 2.1);
977 description = cmsMLUalloc(NULL, 1);
978 cmsMLUsetASCII(description, "en", "US", "ClayRGB-elle-V2-labl.icc");
979 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
980                              filename = "ClayRGB-elle-V2-labl.icc";
981 cmsSaveProfileToFile(profile, filename);
982 cmsMLUfree(description);
983 
984 
985 
986 /* ***** Make profile: Rec.2020, D65, Rec709 TRC */
987 /*
988  * */
989 cmsCIExyYTRIPLE rec2020_primaries = {
990 {0.7079, 0.2920, 1.0},
991 {0.1702, 0.7965, 1.0},
992 {0.1314, 0.0459, 1.0}
993 };
994 
995 cmsCIExyYTRIPLE rec2020_primaries_prequantized = {
996 {0.708012540607, 0.291993664388, 1.0},
997 {0.169991652439, 0.797007778423, 1.0},
998 {0.130997824007, 0.045996550894, 1.0}
999 };
1000 
1001 primaries = rec2020_primaries_prequantized;
1002 whitepoint = d65_srgb_adobe_specs;
1003 /* rec.709 */
1004 tone_curve[0] = tone_curve[1] = tone_curve[2] = rec709_parametric[0];
1005 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
1006 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
1007 /* V4 */
1008 description = cmsMLUalloc(NULL, 1);
1009 cmsMLUsetASCII(description, "en", "US", "Rec2020-elle-V4-rec709.icc");
1010 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
1011                              filename = "Rec2020-elle-V4-rec709.icc";
1012 cmsSaveProfileToFile(profile, filename);
1013 cmsMLUfree(description);
1014 /* V2 */
1015 cmsSetProfileVersion(profile, 2.1);
1016 description = cmsMLUalloc(NULL, 1);
1017 cmsMLUsetASCII(description, "en", "US", "Rec2020-elle-V2-rec709.icc");
1018 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
1019                              filename = "Rec2020-elle-V2-rec709.icc";
1020 cmsSaveProfileToFile(profile, filename);
1021 cmsMLUfree(description);
1022 
1023 /* linear gamma */
1024 tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma100[0];
1025 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
1026 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
1027 /* V4 */
1028 description = cmsMLUalloc(NULL, 1);
1029 cmsMLUsetASCII(description, "en", "US", "Rec2020-elle-V4-g10.icc");
1030 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
1031                              filename = "Rec2020-elle-V4-g10.icc";
1032 cmsSaveProfileToFile(profile, filename);
1033 cmsMLUfree(description);
1034 /* V2 */
1035 cmsSetProfileVersion(profile, 2.1);
1036 description = cmsMLUalloc(NULL, 1);
1037 cmsMLUsetASCII(description, "en", "US", "Rec2020-elle-V2-g10.icc");
1038 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
1039                              filename = "Rec2020-elle-V2-g10.icc";
1040 cmsSaveProfileToFile(profile, filename);
1041 cmsMLUfree(description);
1042 
1043 /* gamma=2.2 */
1044 tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma220[0];
1045 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
1046 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
1047 /* V4 */
1048 description = cmsMLUalloc(NULL, 1);
1049 cmsMLUsetASCII(description, "en", "US", "Rec2020-elle-V4-g22.icc");
1050 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
1051                              filename = "Rec2020-elle-V4-g22.icc";
1052 cmsSaveProfileToFile(profile, filename);
1053 cmsMLUfree(description);
1054 /* V2 */
1055 cmsSetProfileVersion(profile, 2.1);
1056 description = cmsMLUalloc(NULL, 1);
1057 cmsMLUsetASCII(description, "en", "US", "Rec2020-elle-V2-g22.icc");
1058 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
1059                              filename = "Rec2020-elle-V2-g22.icc";
1060 cmsSaveProfileToFile(profile, filename);
1061 cmsMLUfree(description);
1062 
1063 
1064 /* sRGB TRC */
1065 tone_curve[0] = tone_curve[1] = tone_curve[2] = srgb_parametric[0];
1066 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
1067 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
1068 /* V4 */
1069 description = cmsMLUalloc(NULL, 1);
1070 cmsMLUsetASCII(description, "en", "US", "Rec2020-elle-V4-srgbtrc.icc");
1071 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
1072                              filename = "Rec2020-elle-V4-srgbtrc.icc";
1073 cmsSaveProfileToFile(profile, filename);
1074 cmsMLUfree(description);
1075 /* V2 */
1076 cmsSetProfileVersion(profile, 2.1);
1077 description = cmsMLUalloc(NULL, 1);
1078 cmsMLUsetASCII(description, "en", "US", "Rec2020-elle-V2-srgbtrc.icc");
1079 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
1080                              filename = "Rec2020-elle-V2-srgbtrc.icc";
1081 cmsSaveProfileToFile(profile, filename);
1082 cmsMLUfree(description);
1083 
1084 /* labl TRC */
1085 tone_curve[0] = tone_curve[1] = tone_curve[2] = labl_parametric[0];
1086 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
1087 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
1088 /* V4 */
1089 description = cmsMLUalloc(NULL, 1);
1090 cmsMLUsetASCII(description, "en", "US", "Rec2020-elle-V4-labl.icc");
1091 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
1092                              filename = "Rec2020-elle-V4-labl.icc";
1093 cmsSaveProfileToFile(profile, filename);
1094 cmsMLUfree(description);
1095 /* V2 */
1096 cmsSetProfileVersion(profile, 2.1);
1097 description = cmsMLUalloc(NULL, 1);
1098 cmsMLUsetASCII(description, "en", "US", "Rec2020-elle-V2-labl.icc");
1099 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
1100                              filename = "Rec2020-elle-V2-labl.icc";
1101 cmsSaveProfileToFile(profile, filename);
1102 cmsMLUfree(description);
1103 
1104 
1105 /* ***** Make profile: sRGB, D65, sRGB TRC */
1106 /* http://en.wikipedia.org/wiki/Srgb */
1107 /* Hewlett-Packard and Microsoft designed sRGB to match
1108  * the color gamut of consumer-grade CRTs from the 1990s
1109  * and to be the standard color space for the world wide web.
1110  * When made using the standard sRGB TRC, this sRGB profile
1111  * can be applied to DCF R03 camera-generated jpegs and
1112  * is an excellent color space for editing 8-bit images.
1113  * When made using the linear gamma TRC, the resulting profile
1114  * should only be used for high bit depth image editing.
1115  * */
1116 cmsCIExyYTRIPLE srgb_primaries = {
1117 {0.6400, 0.3300, 1.0},
1118 {0.3000, 0.6000, 1.0},
1119 {0.1500, 0.0600, 1.0}
1120 };
1121 cmsCIExyYTRIPLE srgb_primaries_pre_quantized = {
1122 {0.639998686, 0.330010138, 1.0},
1123 {0.300003784, 0.600003357, 1.0},
1124 {0.150002046, 0.059997204, 1.0}
1125 };
1126 primaries = srgb_primaries_pre_quantized;
1127 whitepoint = d65_srgb_adobe_specs;
1128 /* sRGB TRC */
1129 tone_curve[0] = tone_curve[1] = tone_curve[2] = srgb_parametric[0];
1130 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
1131 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
1132 /* V4 */
1133 description = cmsMLUalloc(NULL, 1);
1134 cmsMLUsetASCII(description, "en", "US", "sRGB-elle-V4-srgbtrc.icc");
1135 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
1136                              filename = "sRGB-elle-V4-srgbtrc.icc";
1137 cmsSaveProfileToFile(profile, filename);
1138 cmsMLUfree(description);
1139 /* V2 */
1140 cmsSetProfileVersion(profile, 2.1);
1141 description = cmsMLUalloc(NULL, 1);
1142 cmsMLUsetASCII(description, "en", "US", "sRGB-elle-V2-srgbtrc.icc");
1143 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
1144                              filename = "sRGB-elle-V2-srgbtrc.icc";
1145 cmsSaveProfileToFile(profile, filename);
1146 cmsMLUfree(description);
1147 
1148 /* linear gamma */
1149 tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma100[0];
1150 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
1151 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
1152 /* V4 */
1153 description = cmsMLUalloc(NULL, 1);
1154 cmsMLUsetASCII(description, "en", "US", "sRGB-elle-V4-g10.icc");
1155 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
1156                              filename = "sRGB-elle-V4-g10.icc";
1157 cmsSaveProfileToFile(profile, filename);
1158 cmsMLUfree(description);
1159 /* V2 */
1160 cmsSetProfileVersion(profile, 2.1);
1161 description = cmsMLUalloc(NULL, 1);
1162 cmsMLUsetASCII(description, "en", "US", "sRGB-elle-V2-g10.icc");
1163 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
1164                              filename = "sRGB-elle-V2-g10.icc";
1165 cmsSaveProfileToFile(profile, filename);
1166 cmsMLUfree(description);
1167 
1168 /* gamma=2.2 */
1169 tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma220[0];
1170 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
1171 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
1172 /* V4 */
1173 description = cmsMLUalloc(NULL, 1);
1174 cmsMLUsetASCII(description, "en", "US", "sRGB-elle-V4-g22.icc");
1175 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
1176                              filename = "sRGB-elle-V4-g22.icc";
1177 cmsSaveProfileToFile(profile, filename);
1178 cmsMLUfree(description);
1179 /* V2 */
1180 cmsSetProfileVersion(profile, 2.1);
1181 description = cmsMLUalloc(NULL, 1);
1182 cmsMLUsetASCII(description, "en", "US", "sRGB-elle-V2-g22.icc");
1183 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
1184                              filename = "sRGB-elle-V2-g22.icc";
1185 cmsSaveProfileToFile(profile, filename);
1186 cmsMLUfree(description);
1187 
1188 /* labl TRC */
1189 tone_curve[0] = tone_curve[1] = tone_curve[2] = labl_parametric[0];
1190 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
1191 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
1192 /* V4 */
1193 description = cmsMLUalloc(NULL, 1);
1194 cmsMLUsetASCII(description, "en", "US", "sRGB-elle-V4-labl.icc");
1195 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
1196                              filename = "sRGB-elle-V4-labl.icc";
1197 cmsSaveProfileToFile(profile, filename);
1198 cmsMLUfree(description);
1199 /* V2 */
1200 cmsSetProfileVersion(profile, 2.1);
1201 description = cmsMLUalloc(NULL, 1);
1202 cmsMLUsetASCII(description, "en", "US", "sRGB-elle-V2-labl.icc");
1203 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
1204                              filename = "sRGB-elle-V2-labl.icc";
1205 cmsSaveProfileToFile(profile, filename);
1206 cmsMLUfree(description);
1207 
1208 /* Rec.709 TRC */
1209 tone_curve[0] = tone_curve[1] = tone_curve[2] = rec709_parametric[0];
1210 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
1211 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
1212 /* V4 */
1213 description = cmsMLUalloc(NULL, 1);
1214 cmsMLUsetASCII(description, "en", "US", "sRGB-elle-V4-rec709.icc");
1215 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
1216                              filename = "sRGB-elle-V4-rec709.icc";
1217 cmsSaveProfileToFile(profile, filename);
1218 cmsMLUfree(description);
1219 /* V2 */
1220 cmsSetProfileVersion(profile, 2.1);
1221 description = cmsMLUalloc(NULL, 1);
1222 cmsMLUsetASCII(description, "en", "US", "sRGB-elle-V2-rec709.icc");
1223 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
1224                              filename = "sRGB-elle-V2-rec709.icc";
1225 cmsSaveProfileToFile(profile, filename);
1226 cmsMLUfree(description);
1227 
1228 
1229 /* ***** Make profile: CIE-RGB profile, E white point*/
1230 /* The ASTM E white point is probably the right white point
1231  * to use when making the CIE-RGB color space profile.
1232  * It's not clear to me what the correct CIE-RGB primaries really are.
1233  * Lindbloom gives one set. The LCMS version 1 tutorial gives a different set.
1234  * I asked a friend to ask an expert, who said the real primaries should
1235  * be calculated from the spectral wavelengths.
1236  * Two sets of primaries are given below:
1237  * */
1238 /* This page explains what the CIE color space is:
1239  * https://en.wikipedia.org/wiki/CIE_1931
1240  * These pages give the wavelengths:
1241  * http://hackipedia.org/Color%20space/pdf/CIE%20Color%20Space.pdf
1242  * http://infocom.ing.uniroma1.it/~gaetano/texware/Full-How%20the%20CIE%201931%20Color-Matching%20Functions%20Were%20Derived%20from%20Wright-Guild%20Data.pdf
1243  * This page has resources for calculating xy values given a spectral color wavelength:
1244  * http://www.cvrl.org/cmfs.htm
1245  * This page does the calculations for you:
1246  * http://www.ledtuning.nl/cie.php
1247  * Plugging the wavelengths into the ledtuning website
1248  * gives the following CIE RGB xy primaries:
1249 700.0 nm has Spectral Locus coordinates: x:0.734690023  y:0.265309977
1250 546.1 nm has Spectral Locus coordinates: x:0.2736747378 y:0.7174284409
1251 435.8 nm has Spectral Locus coordinates: x:0.1665361196 y:0.0088826412
1252 * */
1253 cmsCIExyYTRIPLE cie_primaries_ledtuning = {
1254 {0.7346900230, 0.2653099770, 1.0},
1255 {0.2736747378, 0.7174284409, 1.0},
1256 {0.1665361196, 0.0088826412, 1.0}
1257 };
1258 /* Assuming you want to use the ASTM values for the E white point,
1259  * here are the prequantized ledtuning primaries */
1260 cmsCIExyYTRIPLE cie_primaries_ledtuning_prequantized = {
1261 {0.734689082, 0.265296653, 1.0},
1262 {0.273673341, 0.717437354, 1.0},
1263 {0.166531028, 0.008882428, 1.0}
1264 };
1265 primaries = cie_primaries_ledtuning_prequantized;
1266 whitepoint = e_astm;
1267 tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma220[0];
1268 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
1269 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
1270 /* V4 */
1271 description = cmsMLUalloc(NULL, 1);
1272 cmsMLUsetASCII(description, "en", "US", "CIERGB-elle-V4-g22.icc");
1273 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
1274                              filename = "CIERGB-elle-V4-g22.icc";
1275 cmsSaveProfileToFile(profile, filename);
1276 cmsMLUfree(description);
1277 /* V2 */
1278 cmsSetProfileVersion(profile, 2.1);
1279 description = cmsMLUalloc(NULL, 1);
1280 cmsMLUsetASCII(description, "en", "US", "CIERGB-elle-V2-g22.icc");
1281 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
1282                              filename = "CIERGB-elle-V2-g22.icc";
1283 cmsSaveProfileToFile(profile, filename);
1284 cmsMLUfree(description);
1285 
1286 /* A linear gamma version of this profile makes more sense
1287  * than a gamma=2.2 version */
1288 tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma100[0];
1289 whitepoint = e_astm;
1290 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
1291 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
1292 /* V4 */
1293 description = cmsMLUalloc(NULL, 1);
1294 cmsMLUsetASCII(description, "en", "US", "CIERGB-elle-V4-g10.icc");
1295 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
1296                              filename = "CIERGB-elle-V4-g10.icc";
1297 cmsSaveProfileToFile(profile, filename);
1298 cmsMLUfree(description);
1299 /* V2 */
1300 cmsSetProfileVersion(profile, 2.1);
1301 description = cmsMLUalloc(NULL, 1);
1302 cmsMLUsetASCII(description, "en", "US", "CIERGB-elle-V2-g10.icc");
1303 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
1304                              filename = "CIERGB-elle-V2-g10.icc";
1305 cmsSaveProfileToFile(profile, filename);
1306 cmsMLUfree(description);
1307 
1308 /* sRGB TRC*/
1309 tone_curve[0] = tone_curve[1] = tone_curve[2] = srgb_parametric[0];
1310 whitepoint = e_astm;
1311 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
1312 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
1313 /* V4 */
1314 description = cmsMLUalloc(NULL, 1);
1315 cmsMLUsetASCII(description, "en", "US", "CIERGB-elle-V4-srgbtrc.icc");
1316 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
1317                              filename = "CIERGB-elle-V4-srgbtrc.icc";
1318 cmsSaveProfileToFile(profile, filename);
1319 cmsMLUfree(description);
1320 /* V2 */
1321 cmsSetProfileVersion(profile, 2.1);
1322 description = cmsMLUalloc(NULL, 1);
1323 cmsMLUsetASCII(description, "en", "US", "CIERGB-elle-V2-srgbtrc.icc");
1324 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
1325                              filename = "CIERGB-elle-V2-srgbtrc.icc";
1326 cmsSaveProfileToFile(profile, filename);
1327 cmsMLUfree(description);
1328 
1329 /* labl TRC */
1330 tone_curve[0] = tone_curve[1] = tone_curve[2] = labl_parametric[0];
1331 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve );
1332 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
1333 /* V4 */
1334 description = cmsMLUalloc(NULL, 1);
1335 cmsMLUsetASCII(description, "en", "US", "CIERGB-elle-V4-labl.icc");
1336 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
1337                              filename = "CIERGB-elle-V4-labl.icc";
1338 cmsSaveProfileToFile(profile, filename);
1339 cmsMLUfree(description);
1340 /* V2 */
1341 cmsSetProfileVersion(profile, 2.1);
1342 description = cmsMLUalloc(NULL, 1);
1343 cmsMLUsetASCII(description, "en", "US", "CIERGB-elle-V2-labl.icc");
1344 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
1345                              filename = "CIERGB-elle-V2-labl.icc";
1346 cmsSaveProfileToFile(profile, filename);
1347 cmsMLUfree(description);
1348 
1349 
1350 /*
1351  * Here's the second set of primaries
1352  * http://www.cis.rit.edu/research/mcsl2/research/broadbent/CIE1931_RGB.pdf
1353  * https://groups.google.com/forum/#!topic/sci.engr.color/fBI3k1llm-g
1354  * Lindbloom gives these values on his Working Space Information page: */
1355 cmsCIExyYTRIPLE cie_primaries_lindbloom = {
1356 {0.7350, 0.2650, 1.0},
1357 {0.2740, 0.7170, 1.0},
1358 {0.1670, 0.0090, 1.0}
1359 };
1360 /* Assuming you want to use the ASTM values for the E white point,
1361  * here are the prequantized Lindbloom primaries */
1362 cmsCIExyYTRIPLE cie_primaries_lindbloom_prequantized = {
1363 {0.714504840, 0.297234644, 1.0},
1364 {0.520085568, 0.452364535, 1.0},
1365 {0.090957433, 0.051485032, 1.0}
1366 };
1367 
1368 
1369 /* ***** Make profile: Gray ICC profiles - D50 white point  ********* */
1370 whitepoint = d50_illuminant_specs;
1371 const cmsToneCurve* grayTRC;
1372 
1373 /* Gray profile with gamma=1.00, linear gamma, "linear light", etc */
1374 grayTRC = cmsBuildGamma (NULL, 1.00);
1375 profile = cmsCreateGrayProfile ( &whitepoint, grayTRC );
1376 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
1377 /* V4 */
1378 description = cmsMLUalloc(NULL, 1);
1379 cmsMLUsetASCII(description, "en", "US", "Gray-D50-elle-V4-g10.icc");
1380 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
1381                              filename = "Gray-D50-elle-V4-g10.icc";
1382 cmsSaveProfileToFile(profile, filename);
1383 cmsMLUfree(description);
1384 /* V2 */
1385 cmsSetProfileVersion(profile, 2.1);
1386 description = cmsMLUalloc(NULL, 1);
1387 cmsMLUsetASCII(description, "en", "US", "Gray-D50-elle-V2-g10.icc");
1388 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
1389                              filename = "Gray-D50-elle-V2-g10.icc";
1390 cmsSaveProfileToFile(profile, filename);
1391 cmsMLUfree(description);
1392 
1393 /* Gray profile with gamma=1.80,
1394  * actually 1.80078125,
1395  * in order to create the same gamma curve in V2 and V4 profiles */
1396 grayTRC = cmsBuildGamma (NULL, 1.80078125);
1397 profile = cmsCreateGrayProfile ( &whitepoint, grayTRC );
1398 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
1399 /* V4 */
1400 description = cmsMLUalloc(NULL, 1);
1401 cmsMLUsetASCII(description, "en", "US", "Gray-D50-elle-V4-g18.icc");
1402 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
1403                              filename = "Gray-D50-elle-V4-g18.icc";
1404 cmsSaveProfileToFile(profile, filename);
1405 cmsMLUfree(description);
1406 /* V2 */
1407 cmsSetProfileVersion(profile, 2.1);
1408 description = cmsMLUalloc(NULL, 1);
1409 cmsMLUsetASCII(description, "en", "US", "Gray-D50-elle-V2-g18.icc");
1410 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
1411                              filename = "Gray-D50-elle-V2-g18.icc";
1412 cmsSaveProfileToFile(profile, filename);
1413 cmsMLUfree(description);
1414 
1415 /* Gray profile with gamma=2.20
1416  * actually gamma=2.19921875,
1417  * in order to create the same gamma curve in V2 and V4 profiles  */
1418 grayTRC = cmsBuildGamma (NULL, 2.19921875);
1419 profile = cmsCreateGrayProfile ( &whitepoint, grayTRC );
1420 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
1421 /* V4 */
1422 description = cmsMLUalloc(NULL, 1);
1423 cmsMLUsetASCII(description, "en", "US", "Gray-D50-elle-V4-g22.icc");
1424 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
1425                              filename = "Gray-D50-elle-V4-g22.icc";
1426 cmsSaveProfileToFile(profile, filename);
1427 cmsMLUfree(description);
1428 /* V2 */
1429 cmsSetProfileVersion(profile, 2.1);
1430 description = cmsMLUalloc(NULL, 1);
1431 cmsMLUsetASCII(description, "en", "US", "Gray-D50-elle-V2-g22.icc");
1432 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
1433                              filename = "Gray-D50-elle-V2-g22.icc";
1434 cmsSaveProfileToFile(profile, filename);
1435 cmsMLUfree(description);
1436 
1437 /* Gray profile with srgb-trc */
1438 grayTRC = cmsBuildParametricToneCurve(NULL, 4, srgb_parameters);
1439 profile = cmsCreateGrayProfile ( &whitepoint, grayTRC );
1440 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
1441 /* V4 */
1442 description = cmsMLUalloc(NULL, 1);
1443 cmsMLUsetASCII(description, "en", "US", "Gray-D50-elle-V4-srgbtrc.icc");
1444 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
1445                              filename = "Gray-D50-elle-V4-srgbtrc.icc";
1446 cmsSaveProfileToFile(profile, filename);
1447 cmsMLUfree(description);
1448 /* V2 */
1449 cmsSetProfileVersion(profile, 2.1);
1450 description = cmsMLUalloc(NULL, 1);
1451 cmsMLUsetASCII(description, "en", "US", "Gray-D50-elle-V2-srgbtrc.icc");
1452 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
1453                              filename = "Gray-D50-elle-V2-srgbtrc.icc";
1454 cmsSaveProfileToFile(profile, filename);
1455 cmsMLUfree(description);
1456 
1457 /* Gray profile with labl TRC */
1458 grayTRC = cmsBuildParametricToneCurve(NULL, 4, labl_parameters);
1459 profile = cmsCreateGrayProfile ( &whitepoint, grayTRC );
1460 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
1461 /* V4 */
1462 description = cmsMLUalloc(NULL, 1);
1463 cmsMLUsetASCII(description, "en", "US", "Gray-D50-elle-V4-labl.icc");
1464 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
1465                              filename = "Gray-D50-elle-V4-labl.icc";
1466 cmsSaveProfileToFile(profile, filename);
1467 cmsMLUfree(description);
1468 /* V2 */
1469 cmsSetProfileVersion(profile, 2.1);
1470 description = cmsMLUalloc(NULL, 1);
1471 cmsMLUsetASCII(description, "en", "US", "Gray-D50-elle-V2-labl.icc");
1472 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
1473                              filename = "Gray-D50-elle-V2-labl.icc";
1474 cmsSaveProfileToFile(profile, filename);
1475 cmsMLUfree(description);
1476 
1477 /* Gray profile with Rec709 TRC */
1478 grayTRC = cmsBuildParametricToneCurve(NULL, 4, rec709_parameters);
1479 profile = cmsCreateGrayProfile ( &whitepoint, grayTRC );
1480 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
1481 /* V4 */
1482 description = cmsMLUalloc(NULL, 1);
1483 cmsMLUsetASCII(description, "en", "US", "Gray-D50-elle-V4-rec709.icc");
1484 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
1485                              filename = "Gray-D50-elle-V4-rec709.icc";
1486 cmsSaveProfileToFile(profile, filename);
1487 cmsMLUfree(description);
1488 /* V2 */
1489 cmsSetProfileVersion(profile, 2.1);
1490 description = cmsMLUalloc(NULL, 1);
1491 cmsMLUsetASCII(description, "en", "US", "Gray-D50-elle-V2-rec709.icc");
1492 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description);
1493                              filename = "Gray-D50-elle-V2-rec709.icc";
1494 cmsSaveProfileToFile(profile, filename);
1495 cmsMLUfree(description);
1496 
1497 
1498 /* ***** Make profile: LCMS built-in LAB and XYZ profiles *********** */
1499 /* Based on transicc output, the V4 profiles
1500  * can be used in unbounded mode, but the V2 versions cannot. */
1501 profile  = cmsCreateLab2Profile(&d50_illuminant_specs);
1502 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
1503 description = cmsMLUalloc(NULL, 1);
1504 cmsMLUsetASCII(description, "en", "US", "Lab-D50-Identity-elle-V2.icc");
1505                              filename = "Lab-D50-Identity-elle-V2.icc";
1506 cmsSaveProfileToFile(profile, filename);
1507 cmsMLUfree(description);
1508 
1509 profile  = cmsCreateLab4Profile(&d50_illuminant_specs);
1510 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
1511 description = cmsMLUalloc(NULL, 1);
1512 cmsMLUsetASCII(description, "en", "US", "Lab-D50-Identity-elle-V4.icc");
1513                              filename = "Lab-D50-Identity-elle-V4.icc";
1514 cmsSaveProfileToFile(profile, filename);
1515 cmsMLUfree(description);
1516 
1517 profile = cmsCreateXYZProfile();
1518 cmsWriteTag(profile, cmsSigCopyrightTag, copyright);
1519 description = cmsMLUalloc(NULL, 1);
1520 cmsMLUsetASCII(description, "en", "US", "XYZ-D50-Identity-elle-V4.icc");
1521                              filename = "XYZ-D50-Identity-elle-V4.icc";
1522 cmsSaveProfileToFile(profile, filename);
1523 cmsMLUfree(description);
1524 
1525 
1526 /* For the following profiles, information is provided, but not the actual
1527  * profile making code.
1528  * */
1529 
1530 /* old monitor-based editing profiles */
1531 
1532 /* ColorMatchRGB, D50, gamma=1.80 */
1533 /* http://www.dpreview.com/forums/post/3902882
1534  * http://lists.apple.com/archives/colorsync-users/2001/Apr/msg00073.html
1535  * ColorMatch was designed to fit Radius PressView CRT monitors,
1536  * similar to sRGB fitting consumer-grade CRT monitors,
1537  * "fit" meaning "could be calibrated to match".
1538  * Adobe does still distribute a ColorMatchRGB profile.
1539  * Making this profile using the D50_romm_doc white point that is used
1540  * in other old V2 profiles (ProPhoto, WideGamut)
1541  * doesn't make a well behaved profile,
1542  * but the resulting profile is very close to the Adobe-supplied version.
1543  * Using the prequantized primaries makes a profile that's just as close
1544  * to the Adobe-supplied version and in addition is well behaved.
1545  * Unless you have untagged images created on a PressView CRT,
1546  * there is no reason to make or use this profile.
1547  * */
1548 cmsCIExyYTRIPLE colormatch_primaries = {
1549 {0.6300, 0.3400, 1.0},
1550 {0.2950, 0.6050, 1.0},
1551 {0.1500, 0.0750, 1.0}
1552 };
1553 cmsCIExyYTRIPLE colormatch_primaries_prequantized = {
1554 {0.629992636, 0.339999723, 1.0},
1555 {0.295006332, 0.604997745, 1.0},
1556 {0.149992036, 0.075005244, 1.0}
1557 };
1558 primaries = colormatch_primaries_prequantized;
1559 whitepoint = d50_romm_spec;
1560 tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma180[0];
1561 
1562 /* AppleRGB, D65, gamma=1.80 */
1563 /* AppleRGB was created to fit the old Apple CRT displays
1564  * just as sRGB fit consumer-grade CRT monitors
1565  * and ColorMatch fit PressView CRT monitors.
1566  * */
1567 cmsCIExyYTRIPLE apple_primaries = {
1568 {0.6250, 0.3400, 1.0},
1569 {0.2800, 0.5950, 1.0},
1570 {0.1550, 0.0700, 1.0}
1571 };
1572 cmsCIExyYTRIPLE apple_primaries_prequantized = {
1573 {0.625012368, 0.340000081, 1.0},
1574 {0.279996113, 0.595006943, 1.0},
1575 {0.155001212, 0.070001183, 1.0}
1576 };
1577 primaries = apple_primaries_prequantized;
1578 whitepoint = d65_srgb_adobe_specs;
1579 tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma180[0];
1580 
1581 /* video profiles */
1582 
1583 /* PAL-SECAM, D65 gamma=2.20 */
1584 /* http://en.wikipedia.org/wiki/PAL */
1585 cmsCIExyYTRIPLE pal_primaries = {
1586 {0.6400, 0.3300, 1.0},
1587 {0.2900, 0.6000, 1.0},
1588 {0.1500, 0.0600, 1.0}
1589 };
1590 /* PAL is one of many video and television-related color spaces.
1591  * If you need the original profile with all its tags,
1592  * I recommend that you use the Argyllcms version of this profile
1593  * (EBU3213_PAL.icm, located in the "ref" folder),
1594  * rather than making your own.
1595  * But if you do want to make your own PAL profile using LCMS2,
1596  * these prequantized primaries and white point make a profile with
1597  * the same primaries and white point as the Argyllcms profile.
1598  * The Argyllcms profile has a point curve TRC.
1599  * */
1600 cmsCIExyYTRIPLE pal_primaries_prequantized = {
1601 {0.640007798, 0.330006592, 1.0},
1602 {0.290000327, 0.600000840, 1.0},
1603 {0.149998025, 0.059996098, 1.0}
1604 };
1605 primaries = pal_primaries_prequantized;
1606 whitepoint = d65_srgb_adobe_specs;
1607 tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma220[0];
1608 
1609 /* SMPTE-C, D65, gamma=2.20 */
1610 /* http://en.wikipedia.org/wiki/NTSC#SMPTE_C
1611  * SMPTE-C is one of many video and television-related color spaces
1612  * and is an update of the original NTSC. */
1613 cmsCIExyYTRIPLE smpte_c_primaries = {
1614 {0.6300, 0.3400, 1.0},
1615 {0.3100, 0.5950, 1.0},
1616 {0.1550, 0.0700, 1.0}
1617 };
1618 cmsCIExyYTRIPLE smpte_c_primaries_prequantized = {
1619 {0.629996495, 0.339990597, 1.0},
1620 {0.309997880, 0.594995808, 1.0},
1621 {0.149999952, 0.069999431, 1.0}
1622 };
1623 primaries = smpte_c_primaries_prequantized;
1624 whitepoint = d65_srgb_adobe_specs;
1625 tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma220[0];
1626 
1627 /* NTSC, C, gamma=2.20 */
1628 /* http://en.wikipedia.org/wiki/NTSC#Colorimetry*/
1629 /* According to Wikipedia, these "original 1953 color NTSC specifications"
1630  * were used by early television receivers. */
1631 cmsCIExyYTRIPLE ntcs_primaries = {
1632 {0.6700, 0.3300, 1.0},
1633 {0.2100, 0.7100, 1.0},
1634 {0.1400, 0.0800, 1.0}
1635 };
1636 cmsCIExyYTRIPLE ntcs_primaries_prequantized = {
1637 {0.670010373, 0.330001186, 1.0},
1638 {0.209999261, 0.710001124, 1.0},
1639 {0.139996061, 0.080002934, 1.0}
1640 };
1641 primaries = ntcs_primaries_prequantized;
1642 whitepoint = c_astm;
1643 tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma220[0];
1644 
1645 
1646 /* ***********************  wrap up and close out  ****************** */
1647 
1648 /* free copyright */
1649 cmsMLUfree(copyright);
1650 
1651 /* make gcc happy by returning an integer from main() */
1652 return 0;
1653 }
1654