Skip to content

pixtreme.channel

channel

Channel routing operations.

__all__ = ('shuffle',) module-attribute

shuffle(*, adapt=False, **outputs)

Route source channels and numeric fills into a new float32 Frame.

Each keyword is one literal output label whose value is (frame, source_label) or a non-bool real fill; keyword insertion order is output channel order. At least one Frame source is required. Every source Frame must contain the requested label, use float32 data, and have the same geometry as the first Frame source, which supplies width, height, colorspace, and gamma.

With adapt=False, all source colorspace and gamma metadata must match the first Frame. With adapt=True, each mismatched source identity is converted once through :func:px.color.rgb_to_rgb; conversion therefore requires that source to contain R, G, and B. Routing then bit-copies source slices or writes float32 fills without clipping.

Matrix provenance is cleared for RGB or mixed RGB/YCbCr output. YCbCr-only output retains one shared non-None source claim, preserves native literally, and clears provenance when any contributing claim is None. Conflicting non-None claims raise rather than performing implicit rematrix.

Returns a new Frame backed by C-contiguous float32 data with the requested channels and the first Frame's geometry, colorspace, and gamma. Invalid options, labels, sources, dtypes, geometry, metadata, or matrix provenance raise :class:ValueError with actionable context.