Compositing#

Perceptual and subtractive mixers, backgrounds, and the shared dispatcher. Concepts: Color compositing.

Modes & dispatcher#

combine_colorized_layers

Combine a list of already-colorized RGB layers into a final image, applying a compositing mode / blend / gamma / inverse / background.

combine_multicolor_colorspace

Combine colorized RGB layers in a perceptual color space instead of by direct RGB channel addition.

combine_multicolor_alpha

Combine colorized layers by compositing over a chosen background.

COMBINE_MODES

Built-in immutable sequence.

COLORSPACES

Built-in immutable sequence.

BLENDS

Built-in immutable sequence.

Backgrounds & paint mix#

composite_over_background

Composite a black-background (premultiplied-alpha) colorized/combined image over a solid background color, or produce a transparent RGBA image.

layer_coverage

Per-pixel coverage (HSV-style "value") of a colorized layer.

rgb_to_ryb

Vectorized sRGB -> RYB conversion (Sugita & Takahashi 2017).

ryb_to_rgb

Vectorized RYB -> sRGB conversion (Sugita & Takahashi 2017).

rgb_to_cmyk

Vectorized sRGB -> CMYK conversion (standard, no UCR/GCR).

cmyk_to_rgb

Vectorized CMYK -> sRGB conversion.

Lab / HSV / HSL helpers#

rgb_to_lab

Convert an sRGB image (values in [0,1], shape (...,3)) to CIE L*a*b*.

lab_to_rgb

Convert a CIE L*a*b* image back to sRGB in [0,1].

rgb_to_hsl

Vectorized RGB to HSL conversion.

hsl_to_rgb

Vectorized HSL to RGB conversion.

mix_colors_hex

Mix solid colors (not images) in a chosen color space.

greyscale_image

Convert a finished RGB composite to greyscale, e.g. to check how it will look in a B&W print.

simulate_colorblindness

Simulate how an RGB composite appears with a color vision deficiency, to help pick layer colors that stay distinguishable for all viewers.

Swatches#

combo_swatch

Render the composite-mode-aware color-combination swatch.

swatch_layout

Circle centers/radii (pixel coords of a size x size canvas) for the overlapping color-combination swatch.

Transparent cutouts#

make_transparent_cutout

Build a transparent-sky RGBA cutout from an RGB (or RGBA) composite.

save_transparent_cutout

Write an RGBA cutout to PNG or TIFF (format from the file extension).

preview_cutout_on_backgrounds

Show the cutout over several backgrounds (default: checkerboard, dark, light).

batch_transparent_cutouts

Apply make_transparent_cutout() to a list of RGB images with shared settings.

deblend_background

Recover an RGBA foreground from a composite flattened onto a known solid background color (un-premultiply) — the inverse of flatten_rgba() and the principled sibling of make_transparent_cutout().

flatten_rgba

Composite an RGBA image onto a solid background color (the inverse of deblend_background()).

luminance

Rec.

alpha_from_intensity

Build a soft alpha matte from a 2D intensity map.

make_checkerboard

Soft grey checkerboard background for previewing transparency.