Skip to content

pixtreme.core

core

Core Frame, LUT, channel, and closed-vocabulary types.

Alpha = Literal['premultiplied', 'straight'] module-attribute

Antialiasing = Literal['distance', 'supersample', 'off'] module-attribute

Blend = Literal['normal', 'lighten', 'add', 'screen', 'darken', 'multiply', 'difference', 'overlay', 'hardlight', 'softlight'] module-attribute

Border = Literal['mirror', 'replicate', 'wrap', 'constant'] module-attribute

ChromaSiting = Literal['left', 'center', 'topleft'] module-attribute

ChromaticAdaptation = Literal['Bradford', 'CAT02', 'CAT16', 'von-Kries'] module-attribute

ColorBarsOutput = Literal['normalized', 'code'] module-attribute

ColorBarsStandard = Literal['ARIB-STD-B28', 'SMPTE-RP219', 'BT.2111-HLG', 'BT.2111-PQ', 'BT.2111-PQ-full', 'full-100', 'full-75'] module-attribute

Colorspace = Literal['sRGB', 'Rec.709', 'Rec.2020', 'P3-DCI', 'P3-D60', 'P3-D65', 'SMPTE-C', 'ACES2065-1', 'ACEScg', 'S-Gamut', 'S-Gamut3', 'S-Gamut3.Cine', 'ARRI-Wide-Gamut-3', 'ARRI-Wide-Gamut-4', 'Blackmagic-Wide-Gamut-Gen-5', 'DaVinci-Wide-Gamut', 'REDWideGamutRGB', 'DRAGONcolor', 'DRAGONcolor2', 'REDcolor2', 'REDcolor3', 'REDcolor4', 'Canon-Cinema-Gamut', 'V-Gamut', 'D-Gamut', 'F-Gamut-C', 'Apple-Wide-Gamut'] module-attribute

Dtype = Literal['float32', 'float16', 'uint8', 'uint16', 'uint32'] module-attribute

ExrCompression = Literal['none', 'rle', 'zip', 'zips', 'piz', 'pxr24', 'b44', 'b44a', 'dwaa', 'dwab'] module-attribute

Gamma = Literal['linear', 'sRGB', 'Rec.709', 'BT.1886', 'PQ', 'HLG', 'ACEScc', 'ACEScct', 'S-Log', 'S-Log2', 'S-Log3', 'ARRI-LogC3', 'ARRI-LogC4', 'Blackmagic-Film-Gen-5', 'DaVinci-Intermediate', 'RED-Log3G10', 'REDlogFilm', 'Canon-Log', 'Canon-Log-2', 'Canon-Log-3', 'V-Log', 'D-Log', 'F-Log', 'F-Log2', 'N-Log', 'L-Log', 'Apple-Log', 'Samsung-Log', 'Cineon', 'Gamma-2.2', 'Gamma-2.4', 'Gamma-2.5', 'Gamma-2.6'] module-attribute

GeneratorKind = Literal['linear', 'radial'] module-attribute

ImageFormat = Literal['jpeg', 'png', 'tiff', 'jpeg2000', 'webp', 'bmp', 'pnm'] module-attribute

Interpolation = Literal['nearest', 'bilinear', 'bicubic', 'b-spline', 'mitchell', 'lanczos2', 'lanczos3', 'lanczos4', 'area', 'trilinear', 'tetrahedral', 'linear'] module-attribute

Layout = Literal['HWC', 'NHWC', 'CHW', 'NCHW'] module-attribute

Matrix = Literal['BT.601', 'BT.709', 'BT.2020', 'native'] module-attribute

MorphologyShape = Literal['disk', 'square'] module-attribute

Range = Literal['legal', 'full'] module-attribute

ReferenceWhite = Literal['D65', 'D93', 'D50', 'ACES'] module-attribute

SobelDirection = Literal['x', 'y', 'magnitude'] module-attribute

StackDirection = Literal['vertical', 'horizontal'] module-attribute

TemplateMatchingMethod = Literal['sqdiff', 'sqdiff_normed', 'ccorr', 'ccorr_normed', 'ccoeff', 'ccoeff_normed'] module-attribute

TextAlign = Literal['left', 'center', 'right', 'justify'] module-attribute

TextAnchor = Literal['top-left', 'top-center', 'top-right', 'center-left', 'center-center', 'center-right', 'baseline-left', 'baseline-center', 'baseline-right', 'bottom-left', 'bottom-center', 'bottom-right'] module-attribute

TextFont = Literal['sans', 'mono'] module-attribute

TextLanguage = Literal['ja', 'zh-hans', 'zh-hant', 'ko'] module-attribute

TiffCompression = Literal['none', 'lzw'] module-attribute

Tonemap = Literal['ACES-1.3', 'ACES-2.0', 'BT.2408'] module-attribute

VectorBlurShutter = Literal['centered', 'forward', 'backward'] module-attribute

__all__ = ('Frame', 'Lut', 'Lut1D', 'channels', 'ChromaticAdaptation', 'ReferenceWhite', 'Colorspace', 'Gamma', 'Matrix', 'Dtype', 'Layout', 'Tonemap', 'Range', 'Interpolation', 'Border', 'ChromaSiting', 'StackDirection', 'SobelDirection', 'TemplateMatchingMethod', 'Blend', 'Alpha', 'Antialiasing', 'TextLanguage', 'TextAnchor', 'TextAlign', 'TextFont', 'GeneratorKind', 'ColorBarsStandard', 'ColorBarsOutput', 'MorphologyShape', 'ImageFormat', 'TiffCompression', 'ExrCompression', 'VectorBlurShutter') module-attribute

Frame

Bases: BaseModel

A mutable metadata-bearing HWC image stored on an NVIDIA GPU.

data is always a C-contiguous CuPy array. Keep this Frame alive for as long as a consumer uses a raw pointer obtained from its data. Frame is a DLPack producer: consumer arguments and stream information are passed through unchanged to the underlying CuPy array.

model_config = ConfigDict(arbitrary_types_allowed=True, extra='forbid', validate_assignment=True) class-attribute instance-attribute

data instance-attribute

colorspace instance-attribute

gamma instance-attribute

channels instance-attribute

matrix = None class-attribute instance-attribute

width property

Image width in pixels.

height property

Image height in pixels.

shape property

HWC data shape.

dtype property

Data storage dtype.

__dlpack__(*, stream=None, max_version=None, dl_device=None, copy=None)

Delegate DLPack export to data, preserving consumer arguments.

__dlpack_device__()

Delegate the DLPack device query to data.

__repr__()

Represent known channel labels compactly and preserve custom labels explicitly.

Lut dataclass

A validated 3D RGB lookup grid stored on an NVIDIA GPU.

data has shape (N, N, N, 3) indexed by red, green, and blue, with float32 values and N >= 2. The array is retained by reference, without a construction-time copy; callers are responsible for avoiding mutation while the LUT is in use. domain_min and domain_max map input RGB values onto the grid independently by channel.

data instance-attribute

domain_min = _DEFAULT_DOMAIN_MIN class-attribute instance-attribute

domain_max = _DEFAULT_DOMAIN_MAX class-attribute instance-attribute

__post_init__()

__init__(data, domain_min=_DEFAULT_DOMAIN_MIN, domain_max=_DEFAULT_DOMAIN_MAX)

Lut1D dataclass

A validated per-channel RGB lookup curve stored on an NVIDIA GPU.

data has shape (N, 3) with float32 values and N >= 2. Each column is the independent red, green, or blue output curve. The array is retained by reference without a construction-time copy; callers are responsible for avoiding mutation while the LUT is in use. Per-channel domain_min and domain_max values map inputs onto sample indices. Table outputs may be non-monotonic or outside 0..1.

data instance-attribute

domain_min = _DEFAULT_DOMAIN_MIN class-attribute instance-attribute

domain_max = _DEFAULT_DOMAIN_MAX class-attribute instance-attribute

__post_init__()

__init__(data, domain_min=_DEFAULT_DOMAIN_MIN, domain_max=_DEFAULT_DOMAIN_MAX)

channels(value)

Normalize channel labels to their canonical tuple representation.

Parameters

value: A compact string of known, case-sensitive labels parsed by greedy longest match, or a Sequence of non-empty strings. Sequence input also permits application-defined labels unknown to the compact vocabulary.

Returns

tuple[str, ...] A non-empty tuple preserving the normalized label order.

Raises

ValueError If a compact string is empty or contains an unknown label, or if a sequence is empty or contains a non-string or empty label.