Skip to content

pixtreme.composite

composite

Image compositing operations.

__all__ = ('merge',) module-attribute

merge(background, foreground, *, blend='normal', opacity=1.0, mask=None, alpha='premultiplied', position=None, scale=1.0, rotation=0.0, interpolation='bilinear', adapt=False)

Transform and composite a foreground Frame over a background Frame.

The background fixes output geometry, channels, colorspace, and gamma. position places the foreground center in background continuous coordinates; scale applies per axis before rotation in degrees. interpolation samples transparent zero beyond foreground edges.

alpha declares both inputs and the output as straight or premultiplied when an A channel exists. Foreground A, mask, and opacity determine source coverage. Blend and source-over arithmetic are float32 and never clamp scene values. adapt=True uses deterministic RGB/YCbCr channel conversion plus colorspace/gamma transformation; dtype is never adapted. Inputs must be float32 Frames. The result always has new storage and never shares its allocation with either input.