Friday, September 9, 2011

Them colors...

So, any color news this week?

Well, yes...

First I wanted a proper solution for the Y problem.

As you might remember, I did solve Y with a manual slider, but wasn't totally happy with that, because in every profile I inspected, green has the biggest Y and blue the smallest (poor blue).

It seemed to me there's a relationship between the color points and Y.

If I swap red and green, green needs to get the Y of red, and red needs to get the Y of green, else the colors go wonky (apart from switched).

Then I thought: why not adapt Y within the 'plane' of Y?

Which means: when I manually shift green to red, as soon as green arrives at red, it should have the same Y as red (get lower during shifting towards red) and v.v.

So now, when moving any point around, the 'height' of the point (its Y) will be decided by its position within the fixed plane defined by the three points of the triangle (which all have a different height).

Yes dear reader, that involved some math indeed, and it wasn't easy to find the proper solution of how to find the height of a random point if it needs to be in a specific plane, but I found it.

Now there's a choice in the point editor: either lock Y in the plane of 'Y' (defined by the Y's of the triangle) and have Y adapt automatically when you shift the color points around, or change Y manually per point. In fact, I also introduced a third option: let the big Y move with the small y.

You decide...

Then I concentrated on the proofing picture. I can now load my own photo, and split it, so I can see the difference of the edits compared to the original, and I can save the changed photo, since the color tranlation is done on the pixel level of the photo (mind you, this saving of the photo is just a bonus and not the aim... it's about changing a color profile, not about editing individual photos through messing up a profile, although that is a possibility now)... let me show you...

Point editor and proofing photo, with the results of the changes in the left part of the photo (blue and red swapped - funny detail: notice how green stays green in the leaves on the changed left side)... this point swapping is useless mind you... when editing a profile it should be about small changes... this is just to show you the contrast between the changes and the original... obviously this works also for the curve editor...

It's too early to call the application finished - I still have a myriad of small issues to solve, but all the essential building blocks for editing display profiles are in place now...

Sunday, September 4, 2011

Problem solved...

Well, I still have to read up on the XYZ space, to more or less confirm my idea, but I at least solved the missing Y problem.

The grid to edit on is 2D, so the third dimension is lacking. Then after adding the slider for Y it turned out that Y actually changes the luminosity of the color in the proofing photo.

The color gets brighter or darker (again opposite of what you would expect: when Y goes down, the color becomes brighter. I suspect that has to do with the fact that the content of the edited profile is compared in the translation with the standard profile and the difference of values is taken...).

Then I thought: that third dimension, imagined on a 2D grid, is as if you're actually pushing the point away from the viewer, or pulling it back, towards the viewer.

So... when 'pulling' it towards the viewer (by increasing Y) the point in the grid (red, green, blue or white) should get larger.

And when Y decreases, the point on the grid should get smaller (the point gets further away in the imaginary third dimension).

That third dimension isn't there, but you can simulate it this way, as if you're looking into a cube.

It gives a very nice impression of the amounts of the color.

So now you can shift the point, and make it larger or smaller.

Problem solved without complicated 3D DirectX efforts...

The improved point editor, with possibility to edit Y... the bigger the point, the higher Y, the 'closer' it is... in this example blue is pushed away the most, with green being the closest...

Mistakes... oh my...

Playing around with the point editor, I suddenly realised I'm overlooking something important.

I have a color profile made by Microsoft, and in that profile the color points are swapped.

However, when I did that in some of my profiles, the colors turned ugly: the colors didn't swap properly in the proofing photo.

So, comparing the two profiles and looking at the raw data, I suddenly realised that editing the 2D representation (xyY) skips over the 3D Y component (the big Y stays the same).

I already knew that (it led to the problems with the black point), but in my somewhat rushed efforts to experience the color changes, I didn't realise the importance of a static Y.

I then included a swap function in the point editor, which simply copies color point red to say color point green, but this time all three values: not just a recalculated xy, but the full XYZ in one go.

That worked perfectly with nicely swapped colors.

My conclusion for now: the 2D should just be a representation and the editing should be done on the full XYZ values.

In 3D?

Well, I don't know... first I will add a slider for the Y, to see what the effect actually is of a changing Y component, because obviously: building a 3D editor is a whole different ballgame! Then we're talking DirectX and such... it's not out of the realm of possibilities I suppose, but it won't be finished tomorrow...

I guess a somewhat limped 2D editor with a third component on a slider will have to do for a while, untill I get a clearer picture of what's necessary exactly for a full intuitive XYZ edit.

It is funny though, how my color quest keeps answering my own questions about the lack of color profile editors and the price of existing ones...

Saturday, September 3, 2011

The Black Point

Covering the white point and the color end points (red, green and blue) in previous post, I forgot about the black point.

It's the reference point for 'black'.

I tried to incorporate it, but I only have a few profiles which contain a black point setting.

And the problem is: all values for XYZ are zero in those profiles.

And zero for all values is a problem, because the conversion functions (from XYZ (3D) to xyY (2D) and then back) all result into zero if the big Y is zero.

It means: dragging the point doesn't lead to updated XYZ values. The zero Y (which is used unchanged in the conversion from xyY to XYZ) spoils it.

To actually still see the effect I fiddled a bit with Y (give it a value bigger than zero) but it doesn't seem to matter for the color conversion. XYZ then do update, but there's no changes in my proofing photo in none of the rendering intents (perceptual, relative, saturation or absolute).

It seems the black point isn't taken into consideration at all.

Could be that it only does 'something' in say Output profiles (for printers for instance). The color conversion functions in the Windows API only handle Display profiles, not Output profiles, but it could also be that it only has an effect when changed in the start profile (which I have to find out by using the multi-profile proofing, which isn't in place yet for the editors).

I'll investigate this a bit further, see if the photo should update or not and if I'm at fault here...

Friday, September 2, 2011

The Point

And another one bites the dust...

Concentrating on the white point brought me mainly more knowledge about color spaces, but it's a bit much to try to explain it here.

The white point is the point within the color space that 'defines' white and is then taken as a reference point for the colors surrounding it. It's stored in the ICC profiles with three values (XYZ). However, shifting it around within the color space, only leads to changes in the proofing photo when the rendering intent is set to ' Absolute'. The other rendering intents (perceptual, relative and saturation) do not react on a changed white point, as I found out by building this thing.

Let me just tell you that I had to collect some knowledge about the XYZ color space (which is a 3D representation of infinite colors) and how to convert it to a 2D xyY representation (and back again). After that things became easy.

Monitors most of the time work in the sRGB color space, which is basically just a small defined chunk out of the XYZ space and actually quite limited. Other working color spaces are CMYK (for printers) and for instance AdobeRGB, which covers more of the XYZ space than sRGB.

So, I designed myself a second editor, one for color points (and the white point), and on the grid you can drag the points around and see the changes in the photo.

The point editor, showing the white point, the three primary color points and the reference sRGB triangle, with the standard proofing photo on the right...

Some funny results can be achieved by dragging the white point out of the sRGB color space (defined by the triangle) or by reversing the color points (make blue change to red and v.v).

The color points define the boundries of the color space of the profile, and dragging them around has an effect in all rendering intents (not just in the Absolute one like the white point). The editor handles all the points in one screen: the white point and the three primary color points.

After profiling a monitor, the software that comes with the colorimeter (in my case the Spyder 3) usually shifts the color points a bit within the produced profile, depending on the measurements of the colors on the screen. In theory these points (red, green and blue) are the three corners of the sRGB triangle but in a produced profile they usually form their own triangle that doesn't totally match. It really depends on your hardware how well it fits into the actual sRGB space.

The point editor, showing the proofing image with all the color points swapped... compare it with previous picture and you' ll see that all the colors in the proofing picture have changed place...

The triangle as written, represents the sRGB working space, the usual space for display color profiles. I can also select other 'triangles' in the drop down on the left, covering AdobeRGB, Adobe Wide Gamut RGB, ProPhotoRGB, AppleRGB and some more obscure other formats. They are just a reference though. The colored triangle doesn't have any influence on the color profile.

All these color spaces are bound by defined coordinates within the total XYZ space and easy to reproduce as shapes on a 2D grid. For editing the white and end points in display profiles these additional triangles are only a nice to have, because they don't provide very useful information on a sRGB device. Mind you, the XYZ space is much larger and embeds basically all those sRGB/AdobeRGB/AppleRGB etc. shapes.

I decided not to paint the XYZ one, as to keep the grid simple, but also because it's not easy to draw without the right formulas. It's not a simple triangle like the sRGB space. Another problem is that the examples of pictures of this XYZ color space are deceiving. They are usually colored in, but because your monitor can only show colors within the sRGB space, the colors you see in those examples are never correct.

Here's a youtube that explains what XYZ actually means: http://www.youtube.com/watch?v=x0-qoXOCOow

In essence this is the whole point of color profiles: to translate and convert between the different color spaces.

Is it useful to edit these details in a color profile?

Well, I'm not sure. I do see some potential for creativity, because you can create some bizare effects on whole batches of photos by creating whacky color profiles and yes, in some cases you might want to adapt these points slightly if you're not happy with an automatically produced profile.

And if anything, playing around with this type of software does give you a pretty good insight in what the different parts of a color profile actually do, and what results to expect when you select it in your color managed application.

The point editor, showing another very whacky result, accomplished by dragging away the white point...

Personally I find it strange that the supplied software of the Spyder3 doesn't give this level of control, since it's not that difficult to edit this stuff (as proven by a complete color novice). If it's wise, smart or stupid to wánt to edit a color profile, that's nobody's business but the user's...

Ah well, I can now more or less do what I wanted to do with my produced display profiles.

After this there's one more tag to inspect, the CHAD, or CHromatic ADaptation and I have to see if I need to incorporate data about the for now somewhat mysterious D50/D65 parameters... At this point I just know it's kind of a translation thing and probably has no effect on the rendering when changed, but it's in version 4 display profiles, so let's investigate...