moviepy.video.fx.Resize#
- class moviepy.video.fx.Resize.Resize(new_size: tuple | float | callable = None, height: int = None, width: int = None, apply_to_mask: bool = True)[source]#
Effect returning a video clip that is a resized version of the clip.
- Parameters:
new_size (tuple or float or function, optional) – Can be either -
(width, height)in pixels or a float representing - A scaling factor, like0.5. - A function of time returning one of these.height (int, optional) – Height of the new clip in pixels. The width is then computed so that the width/height ratio is conserved.
width (int, optional) – Width of the new clip in pixels. The height is then computed so that the width/height ratio is conserved.
Examples
clip.with_effects([vfx.Resize((460,720))]) # New resolution: (460,720) clip.with_effects([vfx.Resize(0.6)]) # width and height multiplied by 0.6 clip.with_effects([vfx.Resize(width=800)]) # height computed automatically. clip.with_effects([vfx.Resize(lambda t : 1+0.02*t)]) # slow clip swelling
- copy()#
Return a shallow copy of an Effect.
You must always copy an
Effectbefore applying, because some of them will modify their own attributes when applied. For example, setting a previously unset property by using target clip property.If we was to use the original effect, calling the same effect multiple times could lead to different properties, and different results for equivalent clips.
By using copy, we ensure we can use the same effect object multiple times while maintaining the same behavior/result.
In a way, copy makes the effect himself being kind of idempotent.