Re: Decimal precision in Photoshop's info palette
Re: Decimal precision in Photoshop's info palette
- Subject: Re: Decimal precision in Photoshop's info palette
- From: Ken Fleisher <email@hidden>
- Date: Fri, 19 May 2006 14:39:31 -0400
Marco,
This isn't really so hard to understand. Let's take your example and
examine what's happening:
On May 19, 2006, at 2:45 AM, Marco Ugolini wrote:
2) Click on the color picker's foreground patch, and enter the
following
color values in the Color Picker dialog box: C 14, M 89, Y 64, K 22;
3) Run your "get the foreground color" script; the results will be
{class:CMYK color, cyan:14.0, magenta:89.0, yellow:64.0, black:22.0}:
just
like they should be. All good so far;
In this case the numbers that you have entered in the color picker are
simply stored as 8-bit integers (even though they represent
percentages), because that's how you entered them, as integers. The
script simply pulls them out directly and reports an extra decimal
place.
4) Now fill the CMYK document with this very same foreground color
(using
either Option-Delete or Shift-Delete at 100% -- it doesn't matter
which of
the two ways);
Okay, what really happened here? When you filled the color in the
document, Photoshop needed to convert the numbers that you entered as
0-100% into 8-bit integers. Let's look at just magenta as an example.
You entered 89. To convert to 8-bit integer, take 89% of 255, or 0.89 *
255 = 226.95. Well, Photoshop can't store 226.95, so it rounds to the
nearest integer and fills magenta with an 8-bit value of 227.
5) Now sample the color in the CMYK document with the eyedropper; then
run
again the "get the foreground color" script;
Here you have an 8-bit value of 227 as the magenta in the foreground.
6) The results this time will be {class:CMYK color, cyan:14.12,
magenta:89.02, yellow:63.92, black:21.96}. The colors have shifted,
albeit
slightly, but nonetheless they are not exactly what they are supposed
to be.
Convert this back to a percentage and you get:
227 / 255 = 0.89019607, or 89.019607%
All those decimals don't really mean anything. Actually you get one
decimal place (three significant figures) so 89.0% is really the
correct percentage. Exactly what you started with! The applescript is
simply reporting too many decimals. When you report two decimals,
89.019 gets rounded to 89.02 because the "9" dictates that you round
up. It's more correct to only evaluate the first decimal place though.
So in your example, it's only storing 8-bit precision, exactly as you
told it to by working with an 8-bit document. Sure, some of the math
uses floating point which is probably the standard IEEE floating point
64-bit precision, but when reporting the numbers at any stage be
careful how you interpret the decimal places...
I hope this clears it up a little.
Ken Fleisher
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Colorsync-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden