简体   繁体   中英

How to enlarge text clips without distortion in moviepy?

I simply use resize to enlarge the text clip. The result is poor.

result

How to increase the text's font size while keep the text clear?

from moviepy.editor import *

screensize = (720,460)
txtClip = TextClip('enlarge', color='white', font="Amiri-Bold",
                    kerning=5, fontsize=50)
text_annimation = txtClip.set_duration(2).resize(lambda t : (1 + 2*t/2)).set_pos('center')

final_clip = CompositeVideoClip([text_annimation],size=screensize).set_fps(24)

First generate a very big text clip ( fontsize=200 ) then start the resizing from a smaller factor ( resize(lambda t : (0.5 + t/4)) ). this way your clip will always be a scaled-down version of the original image, and you won't have any pixelation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM