Convert_LinearRGB_To_sRGB result is weird

Dear OCCT, Hello.

I have a question about the sRGB color. Actually, the latest OCCT uses the sRGB color profile. But the color converting seems to be a little weird.

For example, here is a sample RGB (19, 25, 31).

I converted the values by using the Convert_LinearRGB_To_sRGB function like this.

double srgb_r = Quantity_Color::Convert_LinearRGB_To_sRGB(19 / 255.0);
double srgb_g = Quantity_Color::Convert_LinearRGB_To_sRGB(25 / 255.0);
double srgb_b = Quantity_Color::Convert_LinearRGB_To_sRGB(31 / 255.0);

The result is 0.302554 / 0.345869 / 0.383458

When setting the background color with the color, it's really brighter than I expected.

And I converted the RGB to sRGB value by using the EasyRGB website ( (Options: AdobeRGB(0-255) to sRGB)

The result is 0.02865 / 0.07061 / 0.09901

The background color seems to be normal with the color.

Why the sRGB color is different each other?

Is there something I missed?

Kirill Gavrilov's picture

Quantity_Color is defined in linear RGB color space, Convert_LinearRGB_To_sRGB() does conversion in opposite direction.

Quantity_Color aColor (19 / 255.0, 25 / 255.0, 31 / 255.0, Quantity_TOC_sRGB);

The following article might be helpful.

Luc Wens's picture

Would there be a way to have the gradient background in 7.5 back to the way it was in 7.4?

Kirill Gavrilov's picture

Luc Wens wrote:

Would there be a way to have the gradient background in 7.5 back to the way it was in 7.4?

For the moment, there is no option to define different color interpolation within gradient background. However, you may render a pre-generated image with desired colors, or draw background rectangle with custom GLSL program. You may also propose a patch to OCCT adding color interpolation option for gradient background.