Help using filter.colorPolynomial with hex values

Anyone know how to convert hexadecimal values into the ‘cubic polynomials’ needed by the colorPolynomial filter?

For instance I have a known color: #1B0800 (a dark brown) 

and I want to apply that color to an image but have no idea how to represent that value as a cubic polynomial 

Like this:

object.fill.effect.coefficients =
{
0, 0, 1, 0, --red coefficients
0, 0, 1, 0, --green coefficients
0, 1, 0, 0, --blue coefficients
0, 0, 0, 1 --alpha coefficients
}

Any help would be greatly appreciated! 

You can use the string.sub() functions to pick off the various components.  The 1st two bytes are the red component, 2nd two the green component and the 3rd two the blue component.  These values are in Hexadecimal.  You can use this code:

http://snipplr.com/view/13086/number-to-hex/

to convert the hex string to it’s decimal equivalent.   Most hex values for colors only include Red, Green and Blue values and don’t specify alpha, so your alpha would default to 1 if the string  only has the three components.

Rob

You can use the string.sub() functions to pick off the various components.  The 1st two bytes are the red component, 2nd two the green component and the 3rd two the blue component.  These values are in Hexadecimal.  You can use this code:

http://snipplr.com/view/13086/number-to-hex/

to convert the hex string to it’s decimal equivalent.   Most hex values for colors only include Red, Green and Blue values and don’t specify alpha, so your alpha would default to 1 if the string  only has the three components.

Rob