Pages: [1]   Go Down

Author Topic: Possible to generate a 2-decimal Lab or RGB colour patch?  (Read 6272 times)

guyburns

  • Full Member
  • ***
  • Offline Offline
  • Posts: 101
Possible to generate a 2-decimal Lab or RGB colour patch?
« on: May 27, 2011, 11:40:38 pm »

Is it possible to generate in any available software, a Lab colour to two decimal places? e.g. I might want a colour patch for which I specify, say:

L = 1.27
a = 23.87
b = 45.98

Two-decimal RGB would be okay.
Logged

Bart_van_der_Wolf

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 8914
Re: Possible to generate a 2-decimal Lab or RGB colour patch?
« Reply #1 on: May 28, 2011, 06:04:57 am »

Is it possible to generate in any available software, a Lab colour to two decimal places? e.g. I might want a colour patch for which I specify, say:

L = 1.27
a = 23.87
b = 45.98

Two-decimal RGB would be okay.

Hi Guy,

While you could save color coordinates as floating point values in a TIFF, most output modalities (Graphic cards/displays/printers/...) still require integer RGB or CMYK colors as input. What is it that you want to achieve? Do you want to maintain color accuracy throughout the calculation chain of events, or do you want to display/print a color that's closer to the ideal coordinates than a rounded integer approach can deliver? Do you think it is visually relevant to try and do that?

With integer based systems, I can imagine using a dithering pattern to blend different colors, at the expense of absolute resolution.

Cheers,
Bart
Logged
== If you do what you did, you'll get what you got. ==

crames

  • Full Member
  • ***
  • Offline Offline
  • Posts: 210
    • http://sites.google.com/site/clifframes/
Re: Possible to generate a 2-decimal Lab or RGB colour patch?
« Reply #2 on: May 28, 2011, 09:11:04 pm »

Here is a Photoshop plugin that will do it. It will fill a selection (or the whole image if there isn't a selection) with the specified Lab values. The document must be in Lab Mode, 8 or 16 bit.

Sorry, Windows only. Copy to the Plug-Ins folder. It will appear in the Filter menu under "Color Tools."

LabWriter.8bf
Logged
Cliff

guyburns

  • Full Member
  • ***
  • Offline Offline
  • Posts: 101
Re: Possible to generate a 2-decimal Lab or RGB colour patch?
« Reply #3 on: May 28, 2011, 11:37:09 pm »

Cliff – I didn't know you could write scripts. And so quick about it.

A suggested improvement: because of Photoshop's inane scaling of a and b (0-127 or 0-128 depending on polarity), the target values given in the IT8 data have to be scaled by 1.27 or 1.28 to give the correct values in the patch. Is it possible to change the script so that it assumes 0-100 for all input values? A message would be needed in the window to clarify the situation.
Logged

crames

  • Full Member
  • ***
  • Offline Offline
  • Posts: 210
    • http://sites.google.com/site/clifframes/
Re: Possible to generate a 2-decimal Lab or RGB colour patch?
« Reply #4 on: May 29, 2011, 12:40:45 am »

A suggested improvement: because of Photoshop's inane scaling of a and b (0-127 or 0-128 depending on polarity), the target values given in the IT8 data have to be scaled by 1.27 or 1.28 to give the correct values in the patch. Is it possible to change the script so that it assumes 0-100 for all input values? A message would be needed in the window to clarify the situation.

I think the scaling is being handled properly. The chosen Lab numbers are the numbers you get when you check the result in the Photoshop Info Window (to the accuracy of the integer size).

Here's the source: LabWriter.fml.

This is the relevant part:

if ( imageMode==Lab48Mode )
{
scaleLstar = 32768.0 / 100.0;
scaleabstar = 128.0;
}else
{
scaleLstar = 255.0 / 100.0;
scaleabstar = 1.0;
}
....
// the following section scales the output Lab values to match Photoshop's internal representation
L = L * scaleLstar;                 // expand L* range from 100 to 255 or 32768
aa = (aa + 128.0) * scaleabstar; // offset so that all a* and b* values are positive integers
bb = (bb + 128.0) * scaleabstar;        // and scale a* and b* to fill the integer range

After this, the float values L, aa, and bb are rounded to integers and written to their respective channels.

Let me know if this is not correct. If you want, you can modify the source and run it in the Filtermeister plug-in environment (free download: http://www.filtermeister.com).
Logged
Cliff

guyburns

  • Full Member
  • ***
  • Offline Offline
  • Posts: 101
Re: Possible to generate a 2-decimal Lab or RGB colour patch?
« Reply #5 on: May 29, 2011, 02:49:04 am »

Yes, your script is handling the PS scaling correctly, but I meant regarding the "a" and "b" values from the IT8 tables. I guess it is best to stick with PS's method of scaling to make the script of general use, and adjust the input and output as described below when inputting IT8 values.

[Removed what followed as it was not correct. GB 29/05/2011]

« Last Edit: May 29, 2011, 10:55:53 am by guyburns »
Logged

crames

  • Full Member
  • ***
  • Offline Offline
  • Posts: 210
    • http://sites.google.com/site/clifframes/
Re: Possible to generate a 2-decimal Lab or RGB colour patch?
« Reply #6 on: May 29, 2011, 04:19:44 am »

Where is it defined that the a* and b* in an IT8 are a percentage of a range? What is the range? I'm not aware of a* and b* being limited to a specific range.

You may be right, I just don't remember seeing that anywhere.
Logged
Cliff

guyburns

  • Full Member
  • ***
  • Offline Offline
  • Posts: 101
Re: Possible to generate a 2-decimal Lab or RGB colour patch?
« Reply #7 on: May 29, 2011, 04:58:28 am »

I don't know the range of "a" and "b". I was just assuming that because IT8 values for "a" and "b" never go above 100, that 100 was the limit, like it is for "L". Are you saying that the IT8 values for "a" and "b" are absolute, not relative, and that PS has allowed them to go as high as 128? Makes sense. In that case, the values can be entered into your script as they come out of the IT8 data. I don't really understand what "a" and "b" represent anyway. "L" I can sort of follow, but "a" and "b" …

Makes it a lot simpler to enter and measure if they are not relative, but absolute.

The things you learn while trying to profile!
Logged

crames

  • Full Member
  • ***
  • Offline Offline
  • Posts: 210
    • http://sites.google.com/site/clifframes/
Re: Possible to generate a 2-decimal Lab or RGB colour patch?
« Reply #8 on: May 29, 2011, 07:54:32 am »

Yes, they are absolute values, and a measure of colorfulness in a way . Depending on the color, a difference in a* or b* has to be 0.25 to 1.0 or more to be visible, so the 0.01 levels we are measuring are quite imperceptible.

If you Assign a scanner profile, then Convert to Lab Space using Absolute Colorimetric Intent, you can measure the Lab values that you get through the profile - what the profile gives as it's best approximation of the Lab values specified in the Q60 target file.

Over in the other thread, for example, the Kodachrome K3199910.Q60 file says that patch K21 should have Lab values of L* = 56.64,  a* = 22.77,  b* = 23.54. Using averaging, I measured the Gamma 1.6 scan to be 57, 24, 23 in 8-bit, or 57.87 23.32 23.02 after converting from the 15-bit numbers.

Target: 56.64 22.77 23.54
8-bit : 57    23    23
15-bit: 57.87 23.32 23.02
Written:56.64 22.77 23.54

Using the LabWriter plug-in I was able re-write the patch with the exact target Lab numbers.(see attached)
Logged
Cliff

ejmartin

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 575
Re: Possible to generate a 2-decimal Lab or RGB colour patch?
« Reply #9 on: May 29, 2011, 08:24:32 am »

Where is it defined that the a* and b* in an IT8 are a percentage of a range? What is the range? I'm not aware of a* and b* being limited to a specific range.


Bruce Lindbloom has an interesting perspective on what he calls the "Lab gamut", though I suspect it's not standard usage:

http://www.brucelindbloom.com/index.html?LabGamutDisplayHelp.html
Logged
emil

digitaldog

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 20651
  • Andrew Rodney
    • http://www.digitaldog.net/
Re: Possible to generate a 2-decimal Lab or RGB colour patch?
« Reply #10 on: May 29, 2011, 11:31:46 am »

ColorThink Pro (and ColorThink) can provide this.
Logged
http://www.digitaldog.net/
Author "Color Management for Photographers".

crames

  • Full Member
  • ***
  • Offline Offline
  • Posts: 210
    • http://sites.google.com/site/clifframes/
Re: Possible to generate a 2-decimal Lab or RGB colour patch?
« Reply #11 on: May 29, 2011, 02:12:57 pm »

Bruce Lindbloom has an interesting perspective on what he calls the "Lab gamut", though I suspect it's not standard usage:

http://www.brucelindbloom.com/index.html?LabGamutDisplayHelp.html

Hi Emil,

Thanks, he shows that for "real world colors " even -128..128 is not enough range to contain all possible a* and b*. Yet Kodachrome's gamut can fit within +-100.

I suppose that a* and b* can go way higher if a reference illuminant other than the usual D50 is used. (Doesn't Raw Therapee use D65?) 
Logged
Cliff
Pages: [1]   Go Up