File indexing completed on 2024-05-12 05:46:36
0001 /* License: 0002 * 0003 * Code for making well-behaved ICC profiles 0004 * Copyright © 2013, 2014, 2015 Elle Stone 0005 * 0006 * This program is free software; you can redistribute it and/or 0007 * modify it under the terms of the GNU General Public License 0008 * as published by the Free Software Foundation; either version 2 0009 * of the License, or (at your option) any later version. 0010 * 0011 * This program is distributed in the hope that it will be useful, 0012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0014 * GNU General Public License for more details. 0015 * 0016 * You should have received a copy of the GNU General Public License 0017 * along with this program; if not, write to the Free Software 0018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 0019 * 0020 * Contact information: 0021 * ellestone@ninedegreesbelow.com 0022 * https://ninedegreesbelow.com 0023 * 0024 * */ 0025 0026 /* About the ICC profile header "Platform" tag: 0027 * 0028 * When creating a profile, LCMS checks to see if the platform is 0029 * Windows ('MSFT'). If your platform isn't Windows, LCMS defaults 0030 * to using the Apple ('APPL') platform tag for the profile header. 0031 * 0032 * There is an unofficial Platform 0033 * cmsPlatformSignature cmsSigUnices 0x2A6E6978 '*nix'. There is, 0034 * however, no LCMS2 API for changing the platform when making a profile. 0035 * 0036 * So on my own computer, to replace 'APPL' with '*nix' in the header, 0037 * I modified the LCMS source file 'cmsio0.c' and recompiled LCMS: 0038 * #ifdef CMS_IS_WINDOWS_ 0039 * Header.platform= (cmsPlatformSignature) _cmsAdjustEndianess32(cmsSigMicrosoft); 0040 * #else 0041 * Header.platform= (cmsPlatformSignature) _cmsAdjustEndianess32(cmsSigUnices); 0042 * #endif 0043 * 0044 * */ 0045 0046 /* Sample command line to compile this code: 0047 * 0048 * gcc -g -O0 -Wall -o make-elles-profiles make-elles-profiles.c -llcms2 0049 * 0050 * You'll see a lot of harmless warnings about unused variables. 0051 * That's because I included variables for profiles that the code 0052 * doesn't actually make, in case you might want to make 0053 * these profiles for your own use. 0054 * 0055 * */ 0056 0057 #include <lcms2.h> 0058 int main () 0059 { 0060 /* prints D50 XYZ values from lcms2.h, 0061 * mostly to let you know the code did something! 0062 * */ 0063 printf("D50X, D50Y, D50Z = %1.8f %1.8f %1.8f\n", cmsD50X, cmsD50Y, cmsD50Z); 0064 0065 0066 /* ************************** TONE CURVES *************************** */ 0067 0068 /* sRGB, Rec709, and labl Tone Reproduction Curves ("TRCs") */ 0069 /* About these TRCs: 0070 * This code makes V2 and V4 ICC profiles. 0071 * For the V4 profiles, which are made using parametric curves, 0072 * these TRCs can work in unbounded mode. 0073 * For the V2 profiles, the resulting TRC is a 4096-point curve and 0074 * cannot work in unbounded mode. 0075 * See https://ninedegreesbelow.com/photography/lcms2-unbounded-mode.html 0076 * for an explanation of unbounded mode ICC profile conversions. 0077 * 0078 * Also, during ICC profile conversions, 0079 * LCMS quantizes images with ICC profiles that have point TRCs. 0080 * So use the V4 profile variants for editing images with software 0081 * that uses LCMS2 as the Color Management System. 0082 * */ 0083 0084 /* sRGB TRC */ 0085 cmsFloat64Number srgb_parameters[5] = 0086 { 2.4, 1.0 / 1.055, 0.055 / 1.055, 1.0 / 12.92, 0.04045 }; 0087 cmsToneCurve *srgb_parametic_curve = 0088 cmsBuildParametricToneCurve(NULL, 4, srgb_parameters); 0089 cmsToneCurve *srgb_parametric[3] = 0090 {srgb_parametic_curve,srgb_parametic_curve,srgb_parametic_curve}; 0091 0092 /* LAB "L" (perceptually uniform) TRC */ 0093 cmsFloat64Number labl_parameters[5] = 0094 { 3.0, 0.862076, 0.137924, 0.110703, 0.080002 }; 0095 cmsToneCurve *labl_parametic_curve = 0096 cmsBuildParametricToneCurve(NULL, 4, labl_parameters); 0097 cmsToneCurve *labl_parametric[3] = 0098 {labl_parametic_curve,labl_parametic_curve,labl_parametic_curve}; 0099 0100 /* Rec 709 TRC */ 0101 cmsFloat64Number rec709_parameters[5] = 0102 { 1.0 / 0.45, 1.0 / 1.099, 0.099 / 1.099, 1.0 / 4.5, 0.018 }; 0103 cmsToneCurve *rec709_parametic_curve = 0104 cmsBuildParametricToneCurve(NULL, 4, rec709_parameters); 0105 cmsToneCurve *rec709_parametric[3] = 0106 {rec709_parametic_curve,rec709_parametic_curve,rec709_parametic_curve}; 0107 0108 /* The following true gamma TRCs work in unbounded mode 0109 * for both V2 and V4 profiles, and quantization during ICC profile 0110 * conversions is not an issue with either the V2 or V4 variants: */ 0111 0112 /* gamma=1.00, linear gamma, "linear light", etc tone response curve */ 0113 cmsToneCurve* gamma100[3]; 0114 gamma100[0] = gamma100[1] = gamma100[2] = cmsBuildGamma (NULL, 1.00); 0115 0116 cmsToneCurve* gamma200[3]; 0117 gamma200[0] = gamma200[1] = gamma200[2] = cmsBuildGamma (NULL, 2.00); 0118 0119 /* Because of hexadecimal rounding during the profile making process, 0120 * the following two gamma values for the profile's TRC are not precisely 0121 * preserved when a V2 profile is made. So I used the V2 value for 0122 * both V2 and V4 versions of the profiles that use these TRCs. 0123 * Otherwise V2 and V4 versions of nominally gamma=1.80 and gamma=2.20 0124 * profiles would have slightly different gamma curves. 0125 * */ 0126 0127 /* gamma=1.80078125 tone response curve */ 0128 /* http://www.color.org/chardata/rgb/ROMMRGB.pdf indicates that 0129 * the official tone response curve for ROMM isn't a simple gamma curve 0130 * but rather has a linear portion in shadows, just like sRGB. 0131 * Most ProPhotoRGB profiles use a gamma curve equal to 1.80078125. 0132 * This odd value is because of hexadecimal rounding. 0133 * */ 0134 cmsToneCurve* gamma180[3]; 0135 gamma180[0] = gamma180[1] = gamma180[2] = cmsBuildGamma (NULL, 1.80078125); 0136 0137 /* gamma=2.19921875 tone response curve */ 0138 /* per https://www.adobe.com/digitalimag/pdfs/AdobeRGB1998.pdf; 0139 * ClayRGB uses this value. Based on an old proprietary profile, 0140 * it also appears to be the correct gamma for WideGamutRGB. 0141 * It also is what you get when you 0142 * try to create a V2 profile with a gamma=2.20 gamma curve. 0143 * So perhaps the AdobeRGB1998 specifications 0144 * were simply bowing to the inevitable hexadecimal rounding. 0145 * Almost all (all?) V2 ICC profiles with nominally gamma=2.20 0146 * really have a gamma of 2.19921875, not 2.20. 0147 * */ 0148 0149 cmsToneCurve* gamma220[3]; 0150 gamma220[0] = gamma220[1] = gamma220[2] = cmsBuildGamma (NULL, 2.19921875); 0151 0152 /* ************************** WHITE POINTS ************************** */ 0153 0154 /* D50 WHITE POINTS */ 0155 0156 cmsCIExyY d50_romm_spec= {0.3457, 0.3585, 1.0}; 0157 /* https://photo-lovers.org/pdf/color/romm.pdf */ 0158 0159 cmsCIExyY d50_illuminant_specs = {0.345702915, 0.358538597, 1.0}; 0160 /* calculated from D50 illuminant XYZ values in ICC specs */ 0161 0162 0163 /* D65 WHITE POINTS */ 0164 0165 cmsCIExyY d65_srgb_adobe_specs = {0.3127, 0.3290, 1.0}; 0166 /* White point from the sRGB.icm and AdobeRGB1998 profile specs: 0167 * https://www.adobe.com/digitalimag/pdfs/AdobeRGB1998.pdf 0168 * 4.2.1 Reference Display White Point 0169 * The chromaticity coordinates of white displayed on 0170 * the reference color monitor shall be x=0.3127, y=0.3290. 0171 * . . . [which] correspond to CIE Standard Illuminant D65. 0172 * 0173 * Wikipedia gives this same white point for SMPTE-C. 0174 * This white point is also given in the sRGB color space specs. 0175 * It's probably correct for most or all of the standard D65 profiles. 0176 * 0177 * The D65 white point values used in the LCMS virtual sRGB profile 0178 * is slightly different than the D65 white point values given in the 0179 * sRGB color space specs, so the LCMS virtual sRGB profile 0180 * doesn't match sRGB profiles made using the values given in the 0181 * sRGB color space specs. 0182 * 0183 * */ 0184 0185 0186 /* Various C and E WHITE POINTS */ 0187 0188 cmsCIExyY c_astm = {0.310060511, 0.316149551, 1.0}; 0189 /* see http://www.brucelindbloom.com/index.html?Eqn_ChromAdapt.html */ 0190 cmsCIExyY e_astm = {0.333333333, 0.333333333, 1.0}; 0191 /* see http://www.brucelindbloom.com/index.html?Eqn_ChromAdapt.html */ 0192 0193 cmsCIExyY c_cie= {0.310, 0.316}; 0194 /* https://en.wikipedia.org/wiki/NTSC#Colorimetry */ 0195 cmsCIExyY e_cie= {0.333, 0.333}; 0196 0197 cmsCIExyY c_6774_robertson= {0.308548930, 0.324928102, 1.0}; 0198 /* see https://en.wikipedia.org/wiki/Standard_illuminant#White_points_of_standard_illuminants 0199 * also see http://www.brucelindbloom.com/index.html?Eqn_T_to_xy.html for the equations */ 0200 cmsCIExyY e_5454_robertson= {0.333608970, 0.348572909, 1.0}; 0201 /* see https://en.wikipedia.org/wiki/Standard_illuminant#White_points_of_standard_illuminants 0202 * also see http://www.brucelindbloom.com/index.html?Eqn_T_to_xy.html for the equations */ 0203 0204 0205 /* ACES white point, taken from 0206 * Specification S-2014-004 0207 * ACEScg – A Working Space for CGI Render and Compositing 0208 */ 0209 cmsCIExyY d60_aces= {0.32168, 0.33767, 1.0}; 0210 0211 /* *****************Set up profile variables and values *************** */ 0212 cmsHPROFILE profile; 0213 cmsToneCurve* tone_curve[3]; 0214 cmsCIExyY whitepoint; 0215 cmsCIExyYTRIPLE primaries; 0216 const char* filename; 0217 cmsMLU *copyright = cmsMLUalloc(NULL, 1); 0218 0219 /* I put a Creative Commons Attribution-ShareAlike 3.0 Unported License 0220 * on the profiles that I distribute (see 0221 * https://creativecommons.org/licenses/by-sa/3.0/legalcode) 0222 * The CC V3 Attribution-ShareAlike unported licence is accepted by both 0223 * Debian and Fedora as a free licence. 0224 * 0225 * Note that the CC V3 BY-SA licence that I put on the ICC profiles 0226 * is not the same licence that's applied to my profile-making code, 0227 * which is LGPL2.1+. 0228 * 0229 * Of course you can modify my profile-making code to put some other 0230 * *profile* copyright on the actual profiles that the code makes, 0231 * for example public domain (Creative Commons CC0) 0232 * or one of the GPL copyrights. 0233 * 0234 * The ICC suggested wording for profile copyrights is here 0235 * (see the last section, entitled "Licensing"): 0236 * http://www.color.org/registry/profileregistration.xalter 0237 * 0238 * The ICC copyright sounds like it's probably a free licence, 0239 * but as of June 2015 it hasn't been accepted by Fedora or Debian as a 0240 * free license. 0241 * 0242 * Here are the Fedora and Debian lists of free licences: 0243 * 0244 * https://fedoraproject.org/wiki/Licensing:Main?rd=Licensing#Content_Licenses 0245 * https://wiki.debian.org/DFSGLicenses 0246 * 0247 * */ 0248 0249 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)."); 0250 0251 cmsMLU *manufacturer = cmsMLUalloc(NULL, 1); 0252 0253 cmsMLU *description; 0254 0255 /* ********************** MAKE THE PROFILES ************************* */ 0256 0257 /* ACES PROFILES */ 0258 0259 /* ***** Make profile: ACEScg, D60, gamma=1.00 */ 0260 /* ACEScg chromaticities taken from 0261 * Specification S-2014-004 0262 * ACEScg – A Working Space for CGI Render and Compositing 0263 */ 0264 cmsCIExyYTRIPLE aces_cg_primaries = 0265 { 0266 {0.713, 0.293, 1.0}, 0267 {0.165, 0.830, 1.0}, 0268 {0.128, 0.044, 1.0} 0269 }; 0270 0271 whitepoint = d60_aces; 0272 primaries = aces_cg_primaries; 0273 0274 /* linear gamma */ 0275 tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma100[0]; 0276 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve ); 0277 cmsWriteTag(profile, cmsSigCopyrightTag, copyright); 0278 /* V4 */ 0279 description = cmsMLUalloc(NULL, 1); 0280 cmsMLUsetASCII(description, "en", "US", "ACEScg-elle-V4-g10.icc"); 0281 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0282 filename = "ACEScg-elle-V4-g10.icc"; 0283 cmsSaveProfileToFile(profile, filename); 0284 cmsMLUfree(description); 0285 /* V2 */ 0286 cmsSetProfileVersion(profile, 2.1); 0287 description = cmsMLUalloc(NULL, 1); 0288 cmsMLUsetASCII(description, "en", "US", "ACEScg-elle-V2-g10.icc"); 0289 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0290 filename = "ACEScg-elle-V2-g10.icc"; 0291 cmsSaveProfileToFile(profile, filename); 0292 cmsMLUfree(description); 0293 0294 /* gamma=2.2 */ 0295 tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma220[0]; 0296 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve ); 0297 cmsWriteTag(profile, cmsSigCopyrightTag, copyright); 0298 /* V4 */ 0299 description = cmsMLUalloc(NULL, 1); 0300 cmsMLUsetASCII(description, "en", "US", "ACEScg-elle-V4-g22.icc"); 0301 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0302 filename = "ACEScg-elle-V4-g22.icc"; 0303 cmsSaveProfileToFile(profile, filename); 0304 cmsMLUfree(description); 0305 /* V2 */ 0306 cmsSetProfileVersion(profile, 2.1); 0307 description = cmsMLUalloc(NULL, 1); 0308 cmsMLUsetASCII(description, "en", "US", "ACEScg-elle-V2-g22.icc"); 0309 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0310 filename = "ACEScg-elle-V2-g22.icc"; 0311 cmsSaveProfileToFile(profile, filename); 0312 cmsMLUfree(description); 0313 0314 /* sRGB TRC */ 0315 tone_curve[0] = tone_curve[1] = tone_curve[2] = srgb_parametric[0]; 0316 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve ); 0317 cmsWriteTag(profile, cmsSigCopyrightTag, copyright); 0318 /* V4 */ 0319 description = cmsMLUalloc(NULL, 1); 0320 cmsMLUsetASCII(description, "en", "US", "ACEScg-elle-V4-srgbtrc.icc"); 0321 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0322 filename = "ACEScg-elle-V4-srgbtrc.icc"; 0323 cmsSaveProfileToFile(profile, filename); 0324 cmsMLUfree(description); 0325 /* V2 */ 0326 cmsSetProfileVersion(profile, 2.1); 0327 description = cmsMLUalloc(NULL, 1); 0328 cmsMLUsetASCII(description, "en", "US", "ACEScg-elle-V2-srgbtrc.icc"); 0329 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0330 filename = "ACEScg-elle-V2-srgbtrc.icc"; 0331 cmsSaveProfileToFile(profile, filename); 0332 cmsMLUfree(description); 0333 0334 /* labl TRC */ 0335 tone_curve[0] = tone_curve[1] = tone_curve[2] = labl_parametric[0]; 0336 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve ); 0337 cmsWriteTag(profile, cmsSigCopyrightTag, copyright); 0338 /* V4 */ 0339 description = cmsMLUalloc(NULL, 1); 0340 cmsMLUsetASCII(description, "en", "US", "ACEScg-elle-V4-labl.icc"); 0341 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0342 filename = "ACEScg-elle-V4-labl.icc"; 0343 cmsSaveProfileToFile(profile, filename); 0344 cmsMLUfree(description); 0345 /* V2 */ 0346 cmsSetProfileVersion(profile, 2.1); 0347 description = cmsMLUalloc(NULL, 1); 0348 cmsMLUsetASCII(description, "en", "US", "ACEScg-elle-V2-labl.icc"); 0349 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0350 filename = "ACEScg-elle-V2-labl.icc"; 0351 cmsSaveProfileToFile(profile, filename); 0352 cmsMLUfree(description); 0353 0354 0355 0356 /* ***** Make profile: ACES, D60, gamma=1.00 */ 0357 /* ACES chromaticities taken from 0358 * Specification 0359 * */ 0360 cmsCIExyYTRIPLE aces_primaries = 0361 { 0362 {0.73470, 0.26530, 1.0}, 0363 {0.00000, 1.00000, 1.0}, 0364 {0.00010, -0.07700, 1.0} 0365 }; 0366 cmsCIExyYTRIPLE aces_primaries_prequantized = 0367 { 0368 {0.734704192222, 0.265298276252, 1.0}, 0369 {-0.000004945077, 0.999992850272, 1.0}, 0370 {0.000099889199, -0.077007518685, 1.0} 0371 }; 0372 0373 whitepoint = d60_aces; 0374 primaries = aces_primaries_prequantized; 0375 0376 /* linear gamma */ 0377 tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma100[0]; 0378 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve ); 0379 cmsWriteTag(profile, cmsSigCopyrightTag, copyright); 0380 /* V4 */ 0381 description = cmsMLUalloc(NULL, 1); 0382 cmsMLUsetASCII(description, "en", "US", "ACES-elle-V4-g10.icc"); 0383 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0384 filename = "ACES-elle-V4-g10.icc"; 0385 cmsSaveProfileToFile(profile, filename); 0386 cmsMLUfree(description); 0387 /* V2 */ 0388 cmsSetProfileVersion(profile, 2.1); 0389 description = cmsMLUalloc(NULL, 1); 0390 cmsMLUsetASCII(description, "en", "US", "ACES-elle-V2-g10.icc"); 0391 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0392 filename = "ACES-elle-V2-g10.icc"; 0393 cmsSaveProfileToFile(profile, filename); 0394 cmsMLUfree(description); 0395 0396 /* gamma=2.2 */ 0397 tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma220[0]; 0398 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve ); 0399 cmsWriteTag(profile, cmsSigCopyrightTag, copyright); 0400 /* V4 */ 0401 description = cmsMLUalloc(NULL, 1); 0402 cmsMLUsetASCII(description, "en", "US", "ACES-elle-V4-g122.icc"); 0403 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0404 filename = "ACES-elle-V4-g22.icc"; 0405 cmsSaveProfileToFile(profile, filename); 0406 cmsMLUfree(description); 0407 /* V2 */ 0408 cmsSetProfileVersion(profile, 2.1); 0409 description = cmsMLUalloc(NULL, 1); 0410 cmsMLUsetASCII(description, "en", "US", "ACES-elle-V2-g22.icc"); 0411 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0412 filename = "ACES-elle-V2-g22.icc"; 0413 cmsSaveProfileToFile(profile, filename); 0414 cmsMLUfree(description); 0415 0416 /* sRGB TRC */ 0417 tone_curve[0] = tone_curve[1] = tone_curve[2] = srgb_parametric[0]; 0418 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve ); 0419 cmsWriteTag(profile, cmsSigCopyrightTag, copyright); 0420 /* V4 */ 0421 description = cmsMLUalloc(NULL, 1); 0422 cmsMLUsetASCII(description, "en", "US", "ACES-elle-V4-srgbtrc.icc"); 0423 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0424 filename = "ACES-elle-V4-srgbtrc.icc"; 0425 cmsSaveProfileToFile(profile, filename); 0426 cmsMLUfree(description); 0427 /* V2 */ 0428 cmsSetProfileVersion(profile, 2.1); 0429 description = cmsMLUalloc(NULL, 1); 0430 cmsMLUsetASCII(description, "en", "US", "ACES-elle-V2-srgbtrc.icc"); 0431 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0432 filename = "ACES-elle-V2-srgbtrc.icc"; 0433 cmsSaveProfileToFile(profile, filename); 0434 cmsMLUfree(description); 0435 0436 /* labl TRC */ 0437 tone_curve[0] = tone_curve[1] = tone_curve[2] = labl_parametric[0]; 0438 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve ); 0439 cmsWriteTag(profile, cmsSigCopyrightTag, copyright); 0440 /* V4 */ 0441 description = cmsMLUalloc(NULL, 1); 0442 cmsMLUsetASCII(description, "en", "US", "ACES-elle-V4-labl.icc"); 0443 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0444 filename = "ACES-elle-V4-labl.icc"; 0445 cmsSaveProfileToFile(profile, filename); 0446 cmsMLUfree(description); 0447 /* V2 */ 0448 cmsSetProfileVersion(profile, 2.1); 0449 description = cmsMLUalloc(NULL, 1); 0450 cmsMLUsetASCII(description, "en", "US", "ACES-elle-V2-labl.icc"); 0451 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0452 filename = "ACES-elle-V2-labl.icc"; 0453 cmsSaveProfileToFile(profile, filename); 0454 cmsMLUfree(description); 0455 0456 0457 0458 0459 /* D50 PROFILES */ 0460 0461 /* ***** Make profile: AllColorsRGB, D50, gamma=1.00 */ 0462 /* AllColors.icc has a slightly larger color gamut than the ACES color space. 0463 * It has a D50 white point and a linear gamma TRC. 0464 * It holds all visible colors. 0465 * Just like the ACES color space, 0466 * AllColors also holds a high percentage of imaginary colors. 0467 * See https://ninedegreesbelow.com/photography/xyz-rgb.html#xyY 0468 * for more information about imaginary colors. 0469 * AllColors primaries for red and blue from 0470 * https://www.ledtuning.nl/en/cie-convertor 0471 * blue 375nm red 780nm, plus Y intercepts: 0472 * Color Wavelength (): 375 nm. 0473 * Spectral Locus coordinates: X:0.17451 Y:0.005182 0474 * Color Wavelength (): 780 nm. 0475 * Spectral Locus coordinates: X:0.734690265 Y:0.265309735 0476 * X1:0.17451 Y1:0.005182 0477 * X2:0.734690265 Y2:0.265309735 0478 * X3:0.00Y3:? Solve for Y3: 0479 * (0.265309735-0.005182)/(0.734690265-0.17451)=0.46436433279205221554=m 0480 * y=mx+b let x=0; y=b 0481 * Y1=0.005182=(0.46436433279205221554*0.17451)+b 0482 * b=0.005182-(0.46436433279205221554*0.17451)=-.07585421971554103213 0483 * */ 0484 cmsCIExyYTRIPLE allcolors_primaries = 0485 { 0486 {0.734690265, 0.265309735, 1.0}, 0487 {0.000000000, 1.000000000, 1.0}, 0488 {0.000000000, -.0758542197, 1.0} 0489 }; 0490 whitepoint = d50_illuminant_specs; 0491 primaries = allcolors_primaries; 0492 0493 /* linear gamma */ 0494 tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma100[0]; 0495 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve ); 0496 cmsWriteTag(profile, cmsSigCopyrightTag, copyright); 0497 /* V4 */ 0498 description = cmsMLUalloc(NULL, 1); 0499 cmsMLUsetASCII(description, "en", "US", "AllColorsRGB-elle-V4-g10.icc"); 0500 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0501 filename = "AllColorsRGB-elle-V4-g10.icc"; 0502 cmsSaveProfileToFile(profile, filename); 0503 cmsMLUfree(description); 0504 /* V2 */ 0505 cmsSetProfileVersion(profile, 2.1); 0506 description = cmsMLUalloc(NULL, 1); 0507 cmsMLUsetASCII(description, "en", "US", "AllColorsRGB-elle-V2-g10.icc"); 0508 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0509 filename = "AllColorsRGB-elle-V2-g10.icc"; 0510 cmsSaveProfileToFile(profile, filename); 0511 cmsMLUfree(description); 0512 0513 /* gamma=2.2 */ 0514 tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma220[0]; 0515 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve ); 0516 cmsWriteTag(profile, cmsSigCopyrightTag, copyright); 0517 /* V4 */ 0518 description = cmsMLUalloc(NULL, 1); 0519 cmsMLUsetASCII(description, "en", "US", "AllColorsRGB-elle-V4-g22.icc"); 0520 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0521 filename = "AllColorsRGB-elle-V4-g22.icc"; 0522 cmsSaveProfileToFile(profile, filename); 0523 cmsMLUfree(description); 0524 /* V2 */ 0525 cmsSetProfileVersion(profile, 2.1); 0526 description = cmsMLUalloc(NULL, 1); 0527 cmsMLUsetASCII(description, "en", "US", "AllColorsRGB-elle-V2-g22.icc"); 0528 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0529 filename = "AllColorsRGB-elle-V2-g22.icc"; 0530 cmsSaveProfileToFile(profile, filename); 0531 cmsMLUfree(description); 0532 0533 /* sRGB TRC */ 0534 tone_curve[0] = tone_curve[1] = tone_curve[2] = srgb_parametric[0]; 0535 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve ); 0536 cmsWriteTag(profile, cmsSigCopyrightTag, copyright); 0537 /* V4 */ 0538 description = cmsMLUalloc(NULL, 1); 0539 cmsMLUsetASCII(description, "en", "US", "AllColorsRGB-elle-V4-srgbtrc.icc"); 0540 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0541 filename = "AllColorsRGB-elle-V4-srgbtrc.icc"; 0542 cmsSaveProfileToFile(profile, filename); 0543 cmsMLUfree(description); 0544 /* V2 */ 0545 cmsSetProfileVersion(profile, 2.1); 0546 description = cmsMLUalloc(NULL, 1); 0547 cmsMLUsetASCII(description, "en", "US", "AllColorsRGB-elle-V2-srgbtrc.icc"); 0548 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0549 filename = "AllColorsRGB-elle-V2-srgbtrc.icc"; 0550 cmsSaveProfileToFile(profile, filename); 0551 cmsMLUfree(description); 0552 0553 /* labl TRC */ 0554 tone_curve[0] = tone_curve[1] = tone_curve[2] = labl_parametric[0]; 0555 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve ); 0556 cmsWriteTag(profile, cmsSigCopyrightTag, copyright); 0557 /* V4 */ 0558 description = cmsMLUalloc(NULL, 1); 0559 cmsMLUsetASCII(description, "en", "US", "AllColorsRGB-elle-V4-labl.icc"); 0560 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0561 filename = "AllColorsRGB-elle-V4-labl.icc"; 0562 cmsSaveProfileToFile(profile, filename); 0563 cmsMLUfree(description); 0564 /* V2 */ 0565 cmsSetProfileVersion(profile, 2.1); 0566 description = cmsMLUalloc(NULL, 1); 0567 cmsMLUsetASCII(description, "en", "US", "AllColorsRGB-elle-V2-labl.icc"); 0568 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0569 filename = "AllColorsRGB-elle-V2-labl.icc"; 0570 cmsSaveProfileToFile(profile, filename); 0571 cmsMLUfree(description); 0572 0573 0574 /* ***** Make profile: Identity, D50, gamma=1.00. */ 0575 /* These primaries also hold all possible visible colors, 0576 * but less efficiently than the AllColors profile.*/ 0577 cmsCIExyYTRIPLE identity_primaries = {/* */ 0578 {1.0, 0.0, 1.0}, 0579 {0.0, 1.0, 1.0}, 0580 {0.0, 0.0, 1.0} 0581 }; 0582 whitepoint = d50_illuminant_specs; 0583 primaries = identity_primaries; 0584 0585 /* linear gamma */ 0586 tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma100[0]; 0587 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve ); 0588 cmsWriteTag(profile, cmsSigCopyrightTag, copyright); 0589 /* V4 */ 0590 description = cmsMLUalloc(NULL, 1); 0591 cmsMLUsetASCII(description, "en", "US", "IdentityRGB-elle-V4-g10.icc"); 0592 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0593 filename = "IdentityRGB-elle-V4-g10.icc"; 0594 cmsSaveProfileToFile(profile, filename); 0595 cmsMLUfree(description); 0596 /* V2 */ 0597 cmsSetProfileVersion(profile, 2.1); 0598 description = cmsMLUalloc(NULL, 1); 0599 cmsMLUsetASCII(description, "en", "US", "IdentityRGB-elle-V2-g10.icc"); 0600 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0601 filename = "IdentityRGB-elle-V2-g10.icc"; 0602 cmsSaveProfileToFile(profile, filename); 0603 cmsMLUfree(description); 0604 0605 /* gamma=2.2 */ 0606 tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma220[0]; 0607 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve ); 0608 cmsWriteTag(profile, cmsSigCopyrightTag, copyright); 0609 /* V4 */ 0610 description = cmsMLUalloc(NULL, 1); 0611 cmsMLUsetASCII(description, "en", "US", "IdentityRGB-elle-V4-g22.icc"); 0612 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0613 filename = "IdentityRGB-elle-V4-g22.icc"; 0614 cmsSaveProfileToFile(profile, filename); 0615 cmsMLUfree(description); 0616 /* V2 */ 0617 cmsSetProfileVersion(profile, 2.1); 0618 description = cmsMLUalloc(NULL, 1); 0619 cmsMLUsetASCII(description, "en", "US", "IdentityRGB-elle-V2-g22.icc"); 0620 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0621 filename = "IdentityRGB-elle-V2-g22.icc"; 0622 cmsSaveProfileToFile(profile, filename); 0623 cmsMLUfree(description); 0624 0625 /* sRGB TRC */ 0626 tone_curve[0] = tone_curve[1] = tone_curve[2] = srgb_parametric[0]; 0627 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve ); 0628 cmsWriteTag(profile, cmsSigCopyrightTag, copyright); 0629 /* V4 */ 0630 description = cmsMLUalloc(NULL, 1); 0631 cmsMLUsetASCII(description, "en", "US", "IdentityRGB-elle-V4-srgbtrc.icc"); 0632 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0633 filename = "IdentityRGB-elle-V4-srgbtrc.icc"; 0634 cmsSaveProfileToFile(profile, filename); 0635 cmsMLUfree(description); 0636 /* V2 */ 0637 cmsSetProfileVersion(profile, 2.1); 0638 description = cmsMLUalloc(NULL, 1); 0639 cmsMLUsetASCII(description, "en", "US", "IdentityRGB-elle-V2-srgbtrc.icc"); 0640 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0641 filename = "IdentityRGB-elle-V2-srgbtrc.icc"; 0642 cmsSaveProfileToFile(profile, filename); 0643 cmsMLUfree(description); 0644 0645 /* labl TRC */ 0646 tone_curve[0] = tone_curve[1] = tone_curve[2] = labl_parametric[0]; 0647 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve ); 0648 cmsWriteTag(profile, cmsSigCopyrightTag, copyright); 0649 /* V4 */ 0650 description = cmsMLUalloc(NULL, 1); 0651 cmsMLUsetASCII(description, "en", "US", "IdentityRGB-elle-V4-labl.icc"); 0652 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0653 filename = "IdentityRGB-elle-V4-labl.icc"; 0654 cmsSaveProfileToFile(profile, filename); 0655 cmsMLUfree(description); 0656 /* V2 */ 0657 cmsSetProfileVersion(profile, 2.1); 0658 description = cmsMLUalloc(NULL, 1); 0659 cmsMLUsetASCII(description, "en", "US", "IdentityRGB-elle-V2-labl.icc"); 0660 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0661 filename = "IdentityRGB-elle-V2-labl.icc"; 0662 cmsSaveProfileToFile(profile, filename); 0663 cmsMLUfree(description); 0664 0665 0666 /* ***** Make profile: Romm/Prophoto, D50, gamma=1.80 */ 0667 /* Reference Input/Output Medium Metric RGB Color Encodings (RIMM/ROMM RGB) 0668 * Kevin E. Spaulding, Geoffrey J. Woolfe and Edward J. Giorgianni 0669 * Eastman Kodak Company, Rochester, New York, U.S.A. 0670 * Above document is available at https://photo-lovers.org/pdf/color/romm.pdf 0671 * Kodak designed the Romm (ProPhoto) color gamut to include all printable 0672 * and most real world colors. It includes some imaginary colors and excludes 0673 * some of the real world blues and violet blues that can be captured by 0674 * digital cameras. For high bit depth image editing only. 0675 */ 0676 cmsCIExyYTRIPLE romm_primaries = { 0677 {0.7347, 0.2653, 1.0}, 0678 {0.1596, 0.8404, 1.0}, 0679 {0.0366, 0.0001, 1.0} 0680 }; 0681 primaries = romm_primaries; 0682 whitepoint = d50_romm_spec; 0683 /* gamma 1.80 */ 0684 tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma180[0]; 0685 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve ); 0686 cmsWriteTag(profile, cmsSigCopyrightTag, copyright); 0687 /* V4 */ 0688 description = cmsMLUalloc(NULL, 1); 0689 cmsMLUsetASCII(description, "en", "US", "LargeRGB-elle-V4-g18.icc"); 0690 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0691 filename = "LargeRGB-elle-V4-g18.icc"; 0692 cmsSaveProfileToFile(profile, filename); 0693 cmsMLUfree(description); 0694 /* V2 */ 0695 cmsSetProfileVersion(profile, 2.1); 0696 description = cmsMLUalloc(NULL, 1); 0697 cmsMLUsetASCII(description, "en", "US", "LargeRGB-elle-V2-g18.icc"); 0698 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0699 filename = "LargeRGB-elle-V2-g18.icc"; 0700 cmsSaveProfileToFile(profile, filename); 0701 cmsMLUfree(description); 0702 0703 /* linear gamma */ 0704 tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma100[0]; 0705 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve ); 0706 cmsWriteTag(profile, cmsSigCopyrightTag, copyright); 0707 /* V4 */ 0708 description = cmsMLUalloc(NULL, 1); 0709 cmsMLUsetASCII(description, "en", "US", "LargeRGB-elle-V4-g10.icc"); 0710 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0711 filename = "LargeRGB-elle-V4-g10.icc"; 0712 cmsSaveProfileToFile(profile, filename); 0713 cmsMLUfree(description); 0714 /* V2 */ 0715 cmsSetProfileVersion(profile, 2.1); 0716 description = cmsMLUalloc(NULL, 1); 0717 cmsMLUsetASCII(description, "en", "US", "LargeRGB-elle-V2-g10.icc"); 0718 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0719 filename = "LargeRGB-elle-V2-g10.icc"; 0720 cmsSaveProfileToFile(profile, filename); 0721 cmsMLUfree(description); 0722 0723 /* gamma=2.2 */ 0724 tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma220[0]; 0725 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve ); 0726 cmsWriteTag(profile, cmsSigCopyrightTag, copyright); 0727 /* V4 */ 0728 description = cmsMLUalloc(NULL, 1); 0729 cmsMLUsetASCII(description, "en", "US", "LargeRGB-elle-V4-g22.icc"); 0730 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0731 filename = "LargeRGB-elle-V4-g22.icc"; 0732 cmsSaveProfileToFile(profile, filename); 0733 cmsMLUfree(description); 0734 /* V2 */ 0735 cmsSetProfileVersion(profile, 2.1); 0736 description = cmsMLUalloc(NULL, 1); 0737 cmsMLUsetASCII(description, "en", "US", "LargeRGB-elle-V2-g22.icc"); 0738 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0739 filename = "LargeRGB-elle-V2-g22.icc"; 0740 cmsSaveProfileToFile(profile, filename); 0741 cmsMLUfree(description); 0742 0743 /* sRGB TRC */ 0744 tone_curve[0] = tone_curve[1] = tone_curve[2] = srgb_parametric[0]; 0745 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve ); 0746 cmsWriteTag(profile, cmsSigCopyrightTag, copyright); 0747 /* V4 */ 0748 description = cmsMLUalloc(NULL, 1); 0749 cmsMLUsetASCII(description, "en", "US", "LargeRGB-elle-V4-srgbtrc.icc"); 0750 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0751 filename = "LargeRGB-elle-V4-srgbtrc.icc"; 0752 cmsSaveProfileToFile(profile, filename); 0753 cmsMLUfree(description); 0754 /* V2 */ 0755 cmsSetProfileVersion(profile, 2.1); 0756 description = cmsMLUalloc(NULL, 1); 0757 cmsMLUsetASCII(description, "en", "US", "LargeRGB-elle-V2-srgbtrc.icc"); 0758 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0759 filename = "LargeRGB-elle-V2-srgbtrc.icc"; 0760 cmsSaveProfileToFile(profile, filename); 0761 cmsMLUfree(description); 0762 0763 /* labl TRC */ 0764 tone_curve[0] = tone_curve[1] = tone_curve[2] = labl_parametric[0]; 0765 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve ); 0766 cmsWriteTag(profile, cmsSigCopyrightTag, copyright); 0767 /* V4 */ 0768 description = cmsMLUalloc(NULL, 1); 0769 cmsMLUsetASCII(description, "en", "US", "LargeRGB-elle-V4-labl.icc"); 0770 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0771 filename = "LargeRGB-elle-V4-labl.icc"; 0772 cmsSaveProfileToFile(profile, filename); 0773 cmsMLUfree(description); 0774 /* V2 */ 0775 cmsSetProfileVersion(profile, 2.1); 0776 description = cmsMLUalloc(NULL, 1); 0777 cmsMLUsetASCII(description, "en", "US", "LargeRGB-elle-V2-labl.icc"); 0778 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0779 filename = "LargeRGB-elle-V2-labl.icc"; 0780 cmsSaveProfileToFile(profile, filename); 0781 cmsMLUfree(description); 0782 0783 0784 0785 /* ***** Make profile: WidegamutRGB, D50, gamma=2.19921875 */ 0786 /* Pascale's primary values produce a profile that matches 0787 * old V2 Widegamut profiles from Adobe and Canon. 0788 * Danny Pascale: A review of RGB color spaces 0789 * http://www.babelcolor.com/download/A%20review%20of%20RGB%20color%20spaces.pdf 0790 * WideGamutRGB was designed by Adobe to be a wide gamut color space that uses 0791 * spectral colors as its primaries. For high bit depth image editing only. */ 0792 cmsCIExyYTRIPLE widegamut_pascale_primaries = { 0793 {0.7347, 0.2653, 1.0}, 0794 {0.1152, 0.8264, 1.0}, 0795 {0.1566, 0.0177, 1.0} 0796 }; 0797 primaries = widegamut_pascale_primaries; 0798 whitepoint = d50_romm_spec; 0799 /* gamma 2.20 */ 0800 tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma220[0]; 0801 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve ); 0802 cmsWriteTag(profile, cmsSigCopyrightTag, copyright); 0803 /* V4 */ 0804 description = cmsMLUalloc(NULL, 1); 0805 cmsMLUsetASCII(description, "en", "US", "WideRGB-elle-V4-g22.icc"); 0806 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0807 filename = "WideRGB-elle-V4-g22.icc"; 0808 cmsSaveProfileToFile(profile, filename); 0809 cmsMLUfree(description); 0810 /* V2 */ 0811 cmsSetProfileVersion(profile, 2.1); 0812 description = cmsMLUalloc(NULL, 1); 0813 cmsMLUsetASCII(description, "en", "US", "WideRGB-elle-V2-g22.icc"); 0814 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0815 filename = "WideRGB-elle-V2-g22.icc"; 0816 cmsSaveProfileToFile(profile, filename); 0817 cmsMLUfree(description); 0818 0819 /* linear gamma */ 0820 tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma100[0]; 0821 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve ); 0822 cmsWriteTag(profile, cmsSigCopyrightTag, copyright); 0823 /* V4 */ 0824 description = cmsMLUalloc(NULL, 1); 0825 cmsMLUsetASCII(description, "en", "US", "WideRGB-elle-V4-g10.icc"); 0826 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0827 filename = "WideRGB-elle-V4-g10.icc"; 0828 cmsSaveProfileToFile(profile, filename); 0829 cmsMLUfree(description); 0830 /* V2 */ 0831 cmsSetProfileVersion(profile, 2.1); 0832 description = cmsMLUalloc(NULL, 1); 0833 cmsMLUsetASCII(description, "en", "US", "WideRGB-elle-V2-g10.icc"); 0834 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0835 filename = "WideRGB-elle-V2-g10.icc"; 0836 cmsSaveProfileToFile(profile, filename); 0837 cmsMLUfree(description); 0838 0839 /* sRGB TRC */ 0840 tone_curve[0] = tone_curve[1] = tone_curve[2] = srgb_parametric[0]; 0841 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve ); 0842 cmsWriteTag(profile, cmsSigCopyrightTag, copyright); 0843 /* V4 */ 0844 description = cmsMLUalloc(NULL, 1); 0845 cmsMLUsetASCII(description, "en", "US", "WideRGB-elle-V4-srgbtrc.icc"); 0846 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0847 filename = "WideRGB-elle-V4-srgbtrc.icc"; 0848 cmsSaveProfileToFile(profile, filename); 0849 cmsMLUfree(description); 0850 /* V2 */ 0851 cmsSetProfileVersion(profile, 2.1); 0852 description = cmsMLUalloc(NULL, 1); 0853 cmsMLUsetASCII(description, "en", "US", "WideRGB-elle-V2-srgbtrc.icc"); 0854 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0855 filename = "WideRGB-elle-V2-srgbtrc.icc"; 0856 cmsSaveProfileToFile(profile, filename); 0857 cmsMLUfree(description); 0858 0859 /* labl TRC */ 0860 tone_curve[0] = tone_curve[1] = tone_curve[2] = labl_parametric[0]; 0861 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve ); 0862 cmsWriteTag(profile, cmsSigCopyrightTag, copyright); 0863 /* V4 */ 0864 description = cmsMLUalloc(NULL, 1); 0865 cmsMLUsetASCII(description, "en", "US", "WideRGB-elle-V4-labl.icc"); 0866 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0867 filename = "WideRGB-elle-V4-labl.icc"; 0868 cmsSaveProfileToFile(profile, filename); 0869 cmsMLUfree(description); 0870 /* V2 */ 0871 cmsSetProfileVersion(profile, 2.1); 0872 description = cmsMLUalloc(NULL, 1); 0873 cmsMLUsetASCII(description, "en", "US", "WideRGB-elle-V2-labl.icc"); 0874 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0875 filename = "WideRGB-elle-V2-labl.icc"; 0876 cmsSaveProfileToFile(profile, filename); 0877 cmsMLUfree(description); 0878 0879 0880 /* D65 PROFILES */ 0881 0882 /* ***** Make profile: ClayRGB (AdobeRGB), D65, gamma=2.19921875 */ 0883 /* The Adobe RGB 1998 color gamut covers a higher percentage of 0884 * real-world greens than sRGB, but still doesn't include all printable 0885 * greens, yellows, and cyans. 0886 * When made using the gamma=2.19921875 tone response curve, 0887 * this profile can be used for 8-bit image editing 0888 * if used with appropriate caution to avoid posterization. 0889 * When made with the gamma=2.19921875 tone response curve 0890 * this profile can be applied to DCF R98 camera-generated jpegs. 0891 * */ 0892 cmsCIExyYTRIPLE adobe_primaries = { 0893 {0.6400, 0.3300, 1.0}, 0894 {0.2100, 0.7100, 1.0}, 0895 {0.1500, 0.0600, 1.0} 0896 }; 0897 cmsCIExyYTRIPLE adobe_primaries_prequantized = { 0898 {0.639996511, 0.329996864, 1.0}, 0899 {0.210005295, 0.710004866, 1.0}, 0900 {0.149997606, 0.060003644, 1.0} 0901 }; 0902 primaries = adobe_primaries_prequantized; 0903 whitepoint = d65_srgb_adobe_specs; 0904 /* gamma 2.20 */ 0905 tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma220[0]; 0906 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve ); 0907 cmsWriteTag(profile, cmsSigCopyrightTag, copyright); 0908 /* V4 */ 0909 description = cmsMLUalloc(NULL, 1); 0910 cmsMLUsetASCII(description, "en", "US", "ClayRGB-elle-V4-g22.icc"); 0911 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0912 filename = "ClayRGB-elle-V4-g22.icc"; 0913 cmsSaveProfileToFile(profile, filename); 0914 cmsMLUfree(description); 0915 /* V2 */ 0916 cmsSetProfileVersion(profile, 2.1); 0917 description = cmsMLUalloc(NULL, 1); 0918 cmsMLUsetASCII(description, "en", "US", "ClayRGB-elle-V2-g22.icc"); 0919 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0920 filename = "ClayRGB-elle-V2-g22.icc"; 0921 cmsSaveProfileToFile(profile, filename); 0922 cmsMLUfree(description); 0923 0924 /* linear gamma */ 0925 tone_curve[0] = tone_curve[1] = tone_curve[2] = gamma100[0]; 0926 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve ); 0927 cmsWriteTag(profile, cmsSigCopyrightTag, copyright); 0928 /* V4 */ 0929 description = cmsMLUalloc(NULL, 1); 0930 cmsMLUsetASCII(description, "en", "US", "ClayRGB-elle-V4-g10.icc"); 0931 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0932 filename = "ClayRGB-elle-V4-g10.icc"; 0933 cmsSaveProfileToFile(profile, filename); 0934 cmsMLUfree(description); 0935 /* V2 */ 0936 cmsSetProfileVersion(profile, 2.1); 0937 description = cmsMLUalloc(NULL, 1); 0938 cmsMLUsetASCII(description, "en", "US", "ClayRGB-elle-V2-g10.icc"); 0939 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0940 filename = "ClayRGB-elle-V2-g10.icc"; 0941 cmsSaveProfileToFile(profile, filename); 0942 cmsMLUfree(description); 0943 0944 /* sRGB TRC */ 0945 tone_curve[0] = tone_curve[1] = tone_curve[2] = srgb_parametric[0]; 0946 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve ); 0947 cmsWriteTag(profile, cmsSigCopyrightTag, copyright); 0948 /* V4 */ 0949 description = cmsMLUalloc(NULL, 1); 0950 cmsMLUsetASCII(description, "en", "US", "ClayRGB-elle-V4-srgbtrc.icc"); 0951 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0952 filename = "ClayRGB-elle-V4-srgbtrc.icc"; 0953 cmsSaveProfileToFile(profile, filename); 0954 cmsMLUfree(description); 0955 /* V2 */ 0956 cmsSetProfileVersion(profile, 2.1); 0957 description = cmsMLUalloc(NULL, 1); 0958 cmsMLUsetASCII(description, "en", "US", "ClayRGB-elle-V2-srgbtrc.icc"); 0959 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0960 filename = "ClayRGB-elle-V2-srgbtrc.icc"; 0961 cmsSaveProfileToFile(profile, filename); 0962 cmsMLUfree(description); 0963 0964 /* labl TRC */ 0965 tone_curve[0] = tone_curve[1] = tone_curve[2] = labl_parametric[0]; 0966 profile = cmsCreateRGBProfile ( &whitepoint, &primaries, tone_curve ); 0967 cmsWriteTag(profile, cmsSigCopyrightTag, copyright); 0968 /* V4 */ 0969 description = cmsMLUalloc(NULL, 1); 0970 cmsMLUsetASCII(description, "en", "US", "ClayRGB-elle-V4-labl.icc"); 0971 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0972 filename = "ClayRGB-elle-V4-labl.icc"; 0973 cmsSaveProfileToFile(profile, filename); 0974 cmsMLUfree(description); 0975 /* V2 */ 0976 cmsSetProfileVersion(profile, 2.1); 0977 description = cmsMLUalloc(NULL, 1); 0978 cmsMLUsetASCII(description, "en", "US", "ClayRGB-elle-V2-labl.icc"); 0979 cmsWriteTag(profile, cmsSigProfileDescriptionTag, description); 0980 filename = "ClayRGB-elle-V2-labl.icc"; 0981 cmsSaveProfileToFile(profile, filename); 0982 cmsMLUfree(description); 0983 0984 0985 0986 /* ***** Make profile: Rec.2020, D65, Rec709 TRC */ 0987 /* 0988 * */ 0989 cmsCIExyYTRIPLE rec2020_primaries = { 0990 {0.7079, 0.2920, 1.0}, 0991 {0.1702, 0.7965, 1.0}, 0992 {0.1314, 0.0459, 1.0} 0993 }; 0994 0995 cmsCIExyYTRIPLE rec2020_primaries_prequantized = { 0996 {0.708012540607, 0.291993664388, 1.0}, 0997 {0.169991652439, 0.797007778423, 1.0}, 0998 {0.130997824007, 0.045996550894, 1.0} 0999 }; 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 /* https://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 * https://www.ledtuning.nl/en/cie-convertor 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 /* https://www.dpreview.com/forums/post/3902882 1534 * https://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 /* https://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 /* https://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 /* https://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 }