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

resize

resize(
  input: Clip,
  #{
    width: Int,
    height: Int,
    kernel?: String,
    b?: Float,
    c?: Float,
    taps?: Int,
    linear?: Bool,
    sigmoid?: Bool,
  }
)

Rescales a clip to a new width and height with a selectable scalar kernel.

The input must be one fixed-format, fixed-resolution planar Gray, YUV, or planar RGB clip. width and height must be positive. b and c are only valid with kernel: "bicubic", and taps is only valid with kernel: "lanczos". YUV resize uses core:chroma_siting metadata when present and defaults to center when that metadata is missing or None; unsupported chroma-siting values fail render.

Set linear: true to resize light-bearing planes in linear light. Linear-light resize requires supported core:transfer and core:range metadata. Chroma difference planes in YUV clips remain in normal code-value space because resize preserves the input format.

Set sigmoid: true when upscaling to apply a fixed sigmoid curve before resampling and invert it after resampling. sigmoid implies linear; for pure downscales it is a silent no-op.

Examples

output = source("input.mkv").std.resize(#{ width: 1280, height: 720, kernel: "lanczos" })
output = source("input.mkv").std.resize(#{
    width: 1920,
    height: 1080,
    kernel: "bicubic",
    b: 0.33333334,
    c: 0.33333334,
})
output = source("input.mkv").std.resize(#{
    width: 3840,
    height: 2160,
    kernel: "lanczos",
    sigmoid: true,
})

Input

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

Output

A clip with the same format, timing, and metadata, resized to the requested dimensions.

Options

  • width (Int) – Set the output width.
  • height (Int) – Set the output height.
  • kernel (String, default: "bicubic") – Select the resize kernel; supported values are "nearest", "bilinear", "bicubic", "lanczos", "spline16", and "spline36".
  • b (Float, default: 0.33333334) – Set the bicubic blur parameter when kernel is "bicubic".
  • c (Float, default: 0.33333334) – Set the bicubic ringing parameter when kernel is "bicubic".
  • taps (Int, default: 3) – Set the Lanczos lobe count when kernel is "lanczos".
  • linear (Bool, default: false) – Resize light-bearing planes in linear light using core:transfer metadata.
  • sigmoid (Bool, default: false) – Use sigmoidized linear-light upscaling to reduce ringing artifacts; implies linear and is a no-op for pure downscales.