pyflink.multimodal.operators.image_rescale#
- image_rescale(*columns, scale, method='lanczos', concurrency=None)[source]#
Rescale an image by a multiplicative factor, preserving aspect ratio.
Each dimension is scaled by
scaleand rounded to the nearest pixel (minimum 1).- Parameters
*columns – Optional image columns. When provided, the UDF is applied directly instead of returning a factory.
scale – Positive scale factor.
0.5halves each dimension;2.0doubles them.method – Resize interpolation method —
"lanczos"(default),"bilinear","bicubic", or"nearest". Accepted case-insensitively and normalized to lowercase.concurrency – UDF concurrency.
Noneuses the framework default.
- Returns
A UDF producing decoded image values.
- Example::
>>> # As a reusable variable >>> rescale = image_rescale(scale=0.5) >>> df = df.with_columns("small", rescale(col("img"))) >>> >>> # Inline >>> df = df.with_columns("small", image_rescale(col("img"), scale=0.5))