Functions Index :: R :: Resize

[<< up one level]

Module:

filters :: resize

Definition:

Resize(clip c, int target_width, int target_height, float "src_left", float "src_top", float "src_width", float "src_height", string "resizer", val "rsz_param1", val "rsz_param2", bool "interlaced")

Description:

A generic resize filter. Uses any of the standard Avisynth resize filters, either set previously by a call to SetDefaultResizer() or directly requested through the resizer argument.

Useful when full flexibility regarding the specific resizer used is wanted (for example in library functions or modules). Moreover, since it is implemented in C++, the speed penalty from using the filter compared to a standard Avisynth resizer is negligible.

Arguments:

c, target_width, target_height and (optional) src_left, src_top, src_width, src_height: Same as the corresponding standard Avisynth ResizeXXX filters' arguments.

resizer, rsz_param1, rsz_param2 (Optional): See the SetDefaultResizer() documentation.

interlaced (Optional, defaults to false): Set it to true if the clip c is an interlaced one.

Notes and conditions on arguments relations:

1] The filter always returns a clip with the correct width and height for its colorspace (taking also into account the value of interlaced argument), regardless of the values of target_width, target_height. This makes it especially suitable for size animation, since it does not produces errors for intermediate values of those parameters.

2] If a very small width or height (down to zero) is requested, the filter does not throw an error as the standard Avisynth resizers do, but instead it uses Crop to achieve the requested dimensions (zero results in the least dimension supported by the clip's colorspace). Condition 1] above applies also in this case.

The actual (width,height) threshold values where a call to Crop is triggered are (12,8), respectively. These are higher by 4 from the minimum allowable values of standard Avisynth resizers in order to provide improved resistance in generation of errors from GetResamplingPattern when very steep resize ratios are requested from resizers with large support value.

3] The library default resizer (the one that is used when no resizer argument is passed to the filter and no calls to SetDefaultResizer() have been made previously) is BilinearResize.

Examples:

c = AVISource()

# resize with current / default resizer

d = c.Resize(720, 480)

# do a bicubic resize (b=0, c=1/2)

e = c.Resize(720, 480, resizer="Bicubic", rsz_param1=0, rsz_param2=1/2)

...

# make bicubic, b=0, c=1/2 the default

dummy = SetDefaultResizer("Bicubic", 0, 1/2)

f = c.Resize(720, 480)

# now f == e

 

[<< top]