Color conversion¶

This class provides functionality to convert between different color spaces, e.g. sRGB and HCL.

To use any functionality in this module, pass a list with 3 floating point values in a function, e.g.:

color_in_sRGB = [1.0, 0.0, 0.0] # red color in sRGB color space
color_in_HCL = sam.DataModel.Type.ColorCoversion.toHCL(color_in_sRGB)

Note that the conversion is not exact. For example, a converstion from sRGB to HCL and then back from HCL to sRGB will result in values that will slightly differ from the original ones by some numerical error due to approximations in conversion functions.

See also

SAMSON API: sbdtypecolorconversion

class samson.DataModel.Type.ColorConversion¶

Bases: pybind11_builtins.pybind11_object

This class class provides functions to transform colors between different color spaces. To use any functionality in this module, pass a list with 3 floating point values in a function, e.g.: color_in_sRGB = [1.0, 0.0, 0.0] # red color in sRGB color space color_in_HCL = Type.ColorCoversion.toHCL(color_in_sRGB)

Note that the conversion is not exact. For example, a converstion from sRGB to HCL and then back from HCL to sRGB will result in values that will slightly differ from the original ones by some numerical error due to approximations in conversion functions.

static CIELabfromCIEXYZ(arg0: List[float]) → List[float]¶

Converts CIE XYZ D65/2° to CIE L*a*b*

static CIELabfromCylindricalCIELab(arg0: List[float]) → List[float]¶

Converts CIE L*a*b* in cylindrical coordinates (a.k.a. CIE LCh_ab) to CIE L*a*b*

static CIELuvfromCIEXYZ(arg0: List[float]) → List[float]¶

Converts CIE XYZ D65/2° to CIE L*u*v*

static CIELuvfromCylindricalCIELuv(arg0: List[float]) → List[float]¶

Converts CIE L*u*v* in cylindrical coordinates (a.k.a. CIE LCh_uv) to CIE L*u*v*

static CIEXYZfromCIELab(arg0: List[float]) → List[float]¶

Converts CIE L*a*b* to CIE XYZ D65/2°

static CIEXYZfromCIELuv(arg0: List[float]) → List[float]¶

Converts CIE L*u*v* to CIE XYZ D65/2°

static CIEXYZfromRGB(arg0: List[float]) → List[float]¶

Converts linear RGB to CIE XYZ with D65/2° standard illuminant

static CIEXYZfromSRGB(arg0: List[float]) → List[float]¶

Converts device independent standard RGB (sRGB) to CIE XYZ with D65/2° standard illuminant

static CylindricalCIELabfromCIELab(arg0: List[float]) → List[float]¶

Converts CIE L*a*b* to CIE L*a*b* in cylindrical coordinates (a.k.a. CIE LCh_ab)

static CylindricalCIELabfromSRGB(arg0: List[float]) → List[float]¶

Converts standard RGB (sRGB) to CIE L*a*b* in cylindrical coordinates a.k.a. (CIE LCh_ab)

static CylindricalCIELuvfromCIELuv(arg0: List[float]) → List[float]¶

Converts CIE L*u*v* to CIE L*u*v* in cylindrical coordinates (a.k.a. CIE LCh_uv)

static CylindricalCIELuvfromSRGB(arg0: List[float]) → List[float]¶

Converts standard RGB (sRGB) to CIE L*u*v* in cylindrical coordinates (a.k.a. CIE LCh_uv)

static HCLfromSRGB(arg0: List[float]) → List[float]¶

Converts standard RGB (sRGB) color to HCL color (cylindrical representation of CIE L*u*v* a.k.a. CIE LCh_uv)

static HSVfromSRGB(arg0: List[float]) → List[float]¶

Converts sRGB color (as in SBColor) to HSV (Hue Saturation Value)

static RGBfromCIEXYZ(arg0: List[float]) → List[float]¶

Converts CIE XYZ with D65/2° standard illuminant to linear RGB

static RGBfromSRGB(arg0: List[float]) → List[float]¶

Converts standard RGB (sRGB) values to linear RGB values.

static SRGBfromCIEXYZ(arg0: List[float]) → List[float]¶

Converts CIEXYZ with D65/2° standard illuminant to device independent standard RGB (sRGB)

static SRGBfromCylindricalCIELab(arg0: List[float]) → List[float]¶

Converts CIE L*a*b* in cylindrical coordinates (a.k.a. CIE LCh_ab) to standard RGB (sRGB)

static SRGBfromCylindricalCIELuv(arg0: List[float]) → List[float]¶

Converts CIE L*u*v* in cylindrical coordinates (a.k.a. CIE LCh_uv) to standard RGB (sRGB)

static SRGBfromHCL(arg0: List[float]) → List[float]¶

Converts HCL color (cylindrical representation of CIE L*u*v* a.k.a. CIE LCh_uv) to standard RGB (sRGB) color

static SRGBfromHSV(arg0: List[float]) → List[float]¶

Converts HSV color (Hue Saturation Value) to sRGB color (as in SBColor)

static SRGBfromRGB(arg0: List[float]) → List[float]¶

Converts linear RGB values to standard RGB (sRGB) values.

static fromHCL(arg0: List[float]) → List[float]¶

Converts HCL color (cylindrical representation of CIE L*u*v* a.k.a. CIE LCh_uv) to sRGB color (as in SBColor)

static fromHSV(arg0: List[float]) → List[float]¶

Converts HSV color (Hue Saturation Value) to sRGB color (as in SBColor)

static toHCL(arg0: List[float]) → List[float]¶

Converts sRGB color (as in SBColor) to HCL (cylindrical representation of CIE L*u*v* a.k.a. CIE LCh_uv)

static toHSV(arg0: List[float]) → List[float]¶

Converts sRGB color (as in SBColor) to HSV (Hue Saturation Value)