Friday, 15 May 2026
May 15, 2026
samueldpoetry
No comments
from moviepy.editor import ImageClip, concatenate_videoclips
from PIL import Image, ImageDraw, ImageFont
import textwrap
slides = [
("Introduction", "Analysis of 'New Tongue' by Elizabeth L. A. Kamara."),
("Background", "The poem criticizes abandonment of African culture."),
("Themes", "Change, cultural clash, disunity, and disrespect for elders."),
("Devices", "Symbolism, imagery, simile, and biblical allusion."),
("Conclusion", "Modernization should not erase cultural identity.")
]
width, height = 1280, 720
try:
title_font = ImageFont.truetype("DejaVuSans-Bold.ttf", 52)
body_font = ImageFont.truetype("DejaVuSans.ttf", 34)
except:
title_font = ImageFont.load_default()
body_font = ImageFont.load_default()
paths = []
for i, (title, body) in enumerate(slides):
img = Image.new("RGB", (width, height), (250, 250, 250))
draw = ImageDraw.Draw(img)
draw.text((70, 100), title, fill=(0, 0, 0), font=title_font)
wrapped = textwrap.fill(body, width=40)
draw.multiline_text((70, 260), wrapped, fill=(0, 0, 0), font=body_font, spacing=12)
path = f"/mnt/data/frame_{i}.png"
img.save(path)
paths.append(path)
clips = [ImageClip(p).set_duration(3) for p in paths]
video = concatenate_videoclips(clips, method="compose")
output = "/mnt/data/new_tongue_short_video.mp4"
video.write_videofile(output, fps=12, codec="libx264", audio=False)
print(output)
Subscribe to:
Post Comments (Atom)




0 comments:
Post a Comment