veditor.elements.animation module

class veditor.elements.animation.AnimationElement(animation_path: str, pos_frames: Tuple[int, Optional[int]] = (0, None), period: Optional[int] = None, margin: Union[int, List[int]] = 0, width: Optional[int] = None, height: Optional[int] = None, top: Optional[Union[veditor.elements.base.BaseElement, int]] = 0, right: Optional[Union[veditor.elements.base.BaseElement, int]] = None, left: Optional[Union[veditor.elements.base.BaseElement, int]] = 0, bottom: Optional[Union[veditor.elements.base.BaseElement, int]] = None)[source]

Bases: veditor.elements.base.FixedElement

calc_element_size(animation_path: Optional[str] = None, width: Optional[int] = None, height: Optional[int] = None, **kwargs)Tuple[int, int][source]

Basic method for calculating the element size.

Parameters
  • width (Optional[int], optional) – Element width. Defaults to None.

  • height (Optional[int], optional) – Element height. Defaults to None.

Returns

Tu

Return type

Tuple[int, int]

set_animation_attributes(animation_path: str, period: Optional[int] = None)None[source]
property arr_frame_count
property pil_frame_count
get_all_pil(animation_path: str)List[PIL.Image.Image][source]
get_all_arr(animation_path: str)List[numpy.ndarray[Any, numpy.dtype[numpy.uint8]]][source]
get_pos_pil(pos: int)PIL.Image.Image[source]
get_pos_arr(pos: int)numpy.ndarray[Any, numpy.dtype[numpy.uint8]][source]
show_all_frames(start: int = 0, end: Optional[int] = None, step: int = 1, ncols: int = 6, figsize: Optional[Tuple[int, int]] = None, fig: Optional[matplotlib.figure.Figure] = None)matplotlib.figure.Figure[source]
edit(frame: numpy.ndarray[Any, numpy.dtype[numpy.uint8]], pos: int)numpy.ndarray[Any, numpy.dtype[numpy.uint8]][source]

Edit a pos-th frame in the video vide_path.

Parameters
  • frame (npt.NDArray[np.uint8]) – The current frame (BGR image) in the video.

  • pos (int) – The current position in the video.

Returns

An editied frame.

Return type

npt.NDArray[np.uint8]