moviepy.tools.compute_position#

moviepy.tools.compute_position(clip1_size: tuple, clip2_size: tuple, pos: any, relative: bool = False) tuple[int, int][source]#

Return the position to put clip 1 on clip 2 based on both clip size and the position of clip 1, as return by clip1.pos() method

Parameters:
  • clip1_size (tuple) -- The width and height of clip1 (e.g., (width, height)).

  • clip2_size (tuple) -- The width and height of clip2 (e.g., (width, height)).

  • pos (Any) -- The position of clip1 as returned by the clip1.pos() method.

  • relative (bool) -- Is the position relative (% of clip size), default False.

Returns:

A tuple (x, y) representing the top-left corner of clip1 relative to clip2.

Return type:

tuple[int, int]

Notes

For more information on pos, see the documentation for VideoClip.with_position.