Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

limit

limit(
  input: Clip,
  #{
    min: Int | Float,
    max: Int | Float,
    planes?: Array<Int>,
  }
)

Clamps pixel values to the inclusive range from min to max.

The input must be one fixed-format planar Gray, YUV, or planar RGB clip. min and max must match the clip’s sample type: integer formats use Int, and float formats use Float values in 0.0..=1.0. min may not be greater than max.

For float clips, non-finite input samples are coerced to min so the output still remains inside the requested inclusive range.

If planes is omitted, every plane is processed. If planes is provided, only the listed zero-based plane indexes are processed; all other planes are preserved without modification.

Examples

output = source("input.mkv").std.limit(#{ min: 16, max: 235 })
output = source("input.mkv").std.limit(#{ min: 16, max: 235, planes: [0] })
output = source("input.mkv")
  .std.convert_format(#{ format: "grayf32" })
  .std.limit(#{ min: 0.0, max: 1.0 })

Input

One fixed-format planar Gray, YUV, or planar RGB clip.

Output

A clip with the same format, resolution, timing, and metadata, with selected planes clamped to the requested range.

Options

  • min (Int | Float) – Inclusive lower clamp bound. Use Int for integer sample formats and Float in 0.0..=1.0 for float sample formats.
  • max (Int | Float) – Inclusive upper clamp bound. Use Int for integer sample formats and Float in 0.0..=1.0 for float sample formats.
  • planes (Array<Int>, default: all planes) – Zero-based plane indexes to process. Unlisted planes are preserved without modification.