MoviePy - 创建文本剪辑
在本文中,我们将了解如何在 MoviePy 中创建文本剪辑。 MoviePy 是一个用于视频编辑的Python模块,可用于视频和 GIF 的基本操作。视频是由帧组成的,帧的组合创建一个视频,每一帧都是一个单独的图像。文本剪辑基本上是一个剪辑,我们可以说它是包含文本的图像。
In order to do this we will use TextClip
method
Syntax : TextClip(text)
Argument : It takes string as necessary argument and color size other styling effect are optional argument
Return : It returns TextClip object
下面是实现
# importing editor from movie py
from moviepy.editor import *
# text
text = "GeeksforGeeks"
# creating a text clip
# having font arial-bold
# with font size = 70
# and color = green
clip = TextClip(text, font ="Arial-Bold", fontsize = 70, color ="green")
# showing clip
clip.ipython_display()
输出 :
另一个例子
# importing editor from movie py
from moviepy.editor import *
# text
text = "Hello"
# creating a text clip
# having font arial-bold
# with font size = 50
# and color = black
clip = TextClip(text, font ="Arial-Bold", fontsize = 50, color ="black")
# showing clip
clip.ipython_display()
输出 :