[Please note that this post is part of a series describing my first wobbly steps into the world of ICC color profiles. The aim is to build an ICC color profile editor from scratch. Seeing how I started this project with no knowledgde whatsoever on the subject, it's wise to realise that some of my findings described in these posts are incorrect. The incorrect conclusions are usually corrected in later posts. For the whole series in one go, click here.]
I'm starting to understand why color software is so expensive, and seriously, people programming that stuff must be extreme geeks... my rating has gone up quite a bit since I dove into this project, and I think if you read it all, you'll agree... I gained quite a few points on the geek meter!
And seriously folks, I haven't even scratched the surface. In my color quest I have run into some pretty scary math... let's not talk about that yet...
If you want to read my earlier posts on the subject, click
here, that will show you all four posts, that's including this one.
I left you last time with a little bit of knowledge about TRC tags and their content.
I was right in that post: The Tone Reproduction Curve isn't the thing that's loaded into the video card. For the calibration I needed the separate vendor specific tag, called VCGT (Video Card Gamma Table). It was developed by Apple, and my mysterious spyder profile uses it.
And yes, I succeeded in loading that data straight into my video card and see the immediate effect it has on my desktop (ugly yellow grays).
My application now shows all the color profiles on my system, and if it's a display profile it gets loaded immediately when I select it (my whole screen changes) and then the color bit is applied to a photo and the photo is converted.
It's a two step process and works pretty well.
And yes, now my photo does show the yellowish grays, because my screen changed.
But wait... I also have my regular profile with the nice grays, so comparing the bad profile with the good one would be nice.
But of course, nothing is easy in computer land: the good profile doesn't have a VCGT tag!
So where to get my calibration data from, I wondered? Obviously it's in the profile somewhere.
Well, that profile is made by Microsoft.
They don't use an Apple tag (who can blame them), but in stead they integrate their own system (called Windows Color System or WCS) in the ICC profile with their own 'MS00' tag.
So there you have it... there's:
- TRC tags with data and sometimes just stating 'gamma #.#' (I now think that's dependant on the ICC profile version, 2 or 4)
- VCGT tag, which holds the calibration data for the video card
- MS00 tag, which holds the WCS implementation as XML (mind you, that's way more than just the calibration data, it's a full WCS profile)
So far I've only seen either VCGT or MS00, but not together.
So what happens if both are lacking? I don't know. Perhaps no calibration is done then, or the TRC is used after all. It's something I can figure out once the application can also edit the curves.
I proceeded with the MS00 tag and extracted the XML from the ICC profile and had a look.
Confusingly enough (remember, even with TRC tags in the spyder profile, the calibration data came from the VCGT tag), Microsoft calls its calibration data also TRC... and more confusing, they store it differently (not as a collection of 256 numbers per color channel but as parameterized curves). Took me a few hours of futile experimenting (I was close but not close enough) and then the Internet, but then I found it: WCS uses the GOG model (Gain / Offset / Gamma) to describe the gamma ramp. The first math I found looked incomprehensible, but eventually I found some documentation describing it, and it's quite a simple formula.
And it works.
Now I can select profiles containing the VCGT tag or the MS00 tag, and the effect is shown immediately on my screen, and in pretty curves too and the desktop looks exactly the same as loading them through the official Windows Color Management module...
Obviously there's a big hurdle to take, because of the WCS and GOG approach: it calculates curves based on three numbers. How to get back to the three numbers after editing the curve? Something tells me that might be complicated if the curve is edited out of shape too much... oh well, I will deal with that when I get there...
Here's the curves for the spyder profile (VCGT) and the second picture are the curves (GOG) from my regular profile. Only the top curves are used in the calibration of the monitor. At this point I'm not sure what the TRC's are used for exactly but I'm sure once I can change them and see the effect, I'll find out... You can see where the yellow is coming from in the spyder profile (overlapping red and green with blue pushed down too much...)... A white curve means all colors are blended together, so the three curves are similar...
The curves of the dirty gray profile (curves are coming from the VCGT tag)...
Curves of the clean grays profile (the one I'm using now - curves are based on the WCS GOG model)...