cutcutcodec.core.classes.colorspace.Colorspace
- class cutcutcodec.core.classes.colorspace.Colorspace(space: str | Self, primaries: str | None = None, transfer: str | None = None)[source]
Structure to ensure color space consistency.
See
cutcutcodec.core.colorspacefor more details and explanations.Attributes
- spacestr
The main space name, one of « y’pbpr », « r’g’b” », « rgb », « xyz ». It is defined in
cutcutcodec.core.colorspace.cst.SYMBS.- primariesstr or None
The tristimulus primaries colors name (gamut). All available values are the keys of
cutcutcodec.core.colorspace.cst.PRIMARIES, defined in the modulecutcutcodec.core.colorspace.cst.- symbolstuple[sympy.Symbol, sympy.Symbol, sympy.Symbol]
The sympy symbols used as input of the expression given by the methode
to.- transferstr or None
The non-linear transfer function name (gamma). All available values are the keys of
cutcutcodec.core.colorspace.cst.TRC, defined in the modulecutcutcodec.core.colorspace.cst.
Parse the colorspace.
Parameters
- spaceColorspace | str
The colorspace formatted as {name}[_{colorspace}], with name in « y’pbpr », « r’g’b” », « rgb », « xyz » (readonly). When several names are given, the first matching in alphabetic order is taken.
- primariesstr, optional
If supplied, this is given priority over
spacefor the gamut (read and write).- transferstr, optional
If supplied, this is given priority over
spacefor the gamma (read and write).
- classmethod from_default_target() Self[source]
Create the default y’pbpr working colorspace.
The default primaries and transfer are taken from the attributes
target_primandtarget_trcof the classcutcutcodec.config.config.Config.The default value can be overwitten in the file ~/.config/cutcutcodec/conf.ini
Examples
>>> from cutcutcodec.core.classes.colorspace import Colorspace >>> Colorspace.from_default_target() Colorspace("y'pbpr", 'bt709', 'iec61966-2-1, iec61966_2_1') >>>
- classmethod from_default_target_rgb() Self[source]
Construct same as
from_default_targetin r’g’b” space.
- classmethod from_default_working() Self[source]
Create the default rgb working colorspace.
The default primaries is taken from the attribute
working_primof the classcutcutcodec.config.config.Config.The default value can be overwitten in the file ~/.config/cutcutcodec/conf.ini
Examples
>>> from cutcutcodec.core.classes.colorspace import Colorspace >>> Colorspace.from_default_working() Colorspace('rgb', 'bt709') >>>