Skip to main content
Participant
July 24, 2023
Question

Export Layer Color - Inaccurate RGBA conversion

  • July 24, 2023
  • 1 reply
  • 240 views

Hello,

 

I'm trying to export layer colours with my own AE scripts with the 'Color' property on each 'Effects' (

effect.property("Color").value). The output RGBAs are stored in 0-1 range. However, when I try to convert them back to 0-255 range RGB, their values are not accurate any more, not close to integers. Did I do anything wrong with it or it is designed to be like that? Is there any alternatives that I can get accurate RGBs?

 

For example, this is an array I exported from AE:

0.66467523574829

0.24122732877731

0.10007803142071

1

 

The background color is white, so background RGBs are all zero.

The conversion should be simply multiplying those RGBs by 255, and I got these:

 

169.4921851158

61.51296883821405

25.51989801228105

 

Does anyone have a clue why those values not even close to integers...?

 

 
This topic has been closed for replies.

1 reply

Mylenium
Legend
July 24, 2023

As usual: Color math is complicated and none of this means anything if you are not correctly honoring color mangement and different color ranges as well as quantization. no, just simply multiplying will not give the correct result. At the very least you need to add a Math.round() to quantize your values, but as I said, none of this may mean anything if your initial conversion is based on a wrong setup.

 

Mylenium

Participant
July 24, 2023

Thanks for reply. I'm trying to get the hex colors of all layers for use further in sRGB space. AE projects for now are using AdobeRGB. So is there a way to convert them?

 

Also, is there any way to get the hex color values? In the color picker, I can see the color is #A93E1A. Is it possible to get this hex color from script?