Skip to content

color

Classes:

InvalidColorspacePathError

InvalidColorspacePathError(
    func: FuncExceptT, message: SupportsString | None = None, **kwargs: Any
)

Bases: CustomValueError

Raised when there is no path between two colorspaces.

Methods:

  • check

    Check if there's a valid colorspace path for the given clip.

Source code
34
35
36
37
38
39
40
41
42
43
44
def __init__(self, func: FuncExceptT, message: SupportsString | None = None, **kwargs: Any) -> None:
    def_msg = "Unable to convert between colorspaces! "
    def_msg += "Please provide more colorspace information (e.g., matrix, transfer, primaries)."

    if isinstance(message, vs.Error):
        error_msg = str(message)
        if "Resize error:" in error_msg:
            kwargs["reason"] = error_msg[error_msg.find("(") + 1 : error_msg.rfind(")")]
            message = def_msg

    super().__init__(message or def_msg, func, **kwargs)

check staticmethod

check(func: FuncExceptT, to_check: VideoNode) -> None

Check if there's a valid colorspace path for the given clip.

Parameters:

  • func

    (FuncExceptT) –

    Function returned for custom error handling. This should only be set by VS package developers.

  • to_check

    (VideoNode) –

    Value to check. Must be a VideoNode.

Raises:

Source code
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
@staticmethod
def check(func: FuncExceptT, to_check: vs.VideoNode) -> None:
    """
    Check if there's a valid colorspace path for the given clip.

    Args:
        func: Function returned for custom error handling. This should only be set by VS package developers.
        to_check: Value to check. Must be a VideoNode.

    Raises:
        InvalidColorspacePathError: If there's no valid colorspace path.
    """

    try:
        to_check.get_frame(0).close()
    except vs.Error as e:
        if "no path between colorspaces" in str(e):
            raise InvalidColorspacePathError(func, e)
        raise

InvalidMatrixError

InvalidMatrixError(
    func: FuncExceptT,
    matrix: int = 2,
    message: SupportsString = "You can't set a matrix of {matrix}!",
    **kwargs: Any
)

Bases: CustomValueError

Raised when an invalid matrix is passed.

Source code
 94
 95
 96
 97
 98
 99
100
101
def __init__(
    self,
    func: FuncExceptT,
    matrix: int = 2,
    message: SupportsString = "You can't set a matrix of {matrix}!",
    **kwargs: Any,
) -> None:
    super().__init__(message, func, matrix=matrix, **kwargs)

InvalidPrimariesError

InvalidPrimariesError(
    func: FuncExceptT,
    primaries: int = 2,
    message: SupportsString = "You can't set primaries of {primaries}!",
    **kwargs: Any
)

Bases: CustomValueError

Raised when an invalid matrix is passed.

Source code
168
169
170
171
172
173
174
175
def __init__(
    self,
    func: FuncExceptT,
    primaries: int = 2,
    message: SupportsString = "You can't set primaries of {primaries}!",
    **kwargs: Any,
) -> None:
    super().__init__(message, func, primaries=primaries, **kwargs)

InvalidTransferError

InvalidTransferError(
    func: FuncExceptT,
    transfer: int = 2,
    message: SupportsString = "You can't set a transfer of {transfer}!",
    **kwargs: Any
)

Bases: CustomValueError

Raised when an invalid matrix is passed.

Source code
131
132
133
134
135
136
137
138
def __init__(
    self,
    func: FuncExceptT,
    transfer: int = 2,
    message: SupportsString = "You can't set a transfer of {transfer}!",
    **kwargs: Any,
) -> None:
    super().__init__(message, func, transfer=transfer, **kwargs)

ReservedMatrixError

Bases: CustomPermissionError

Raised when a reserved matrix is requested.

ReservedPrimariesError

Bases: CustomPermissionError

Raised when reserved primaries are requested.

ReservedTransferError

Bases: CustomPermissionError

Raised when a reserved transfer is requested.

UndefinedMatrixError

Bases: CustomValueError

Raised when an undefined matrix is passed.

UndefinedPrimariesError

Bases: CustomValueError

Raised when an undefined primaries value is passed.

UndefinedTransferError

Bases: CustomValueError

Raised when an undefined transfer is passed.

UnsupportedColorRangeError

Bases: CustomValueError

Raised when a unsupported color range value is passed.

UnsupportedMatrixError

Bases: CustomValueError

Raised when an unsupported matrix is passed.

UnsupportedPrimariesError

Bases: CustomValueError

Raised when a unsupported primaries value is passed.

UnsupportedTransferError

Bases: CustomValueError

Raised when an unsupported transfer is passed.