Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Export Layer Color - Inaccurate RGBA conversion

New Here ,
Jul 24, 2023 Jul 24, 2023

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...?

 

 
TOPICS
Import and export , Resources , Scripting
228
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 24, 2023 Jul 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 24, 2023 Jul 24, 2023
LATEST

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines