Files
hermes-mcp/product/animateit.py
2026-04-29 09:52:53 -04:00

36 lines
757 B
Python

from PIL import Image
src = "squaremcp_storyboard.png" # save the generated grid image with this name
out = "squaremcp_launch.gif"
poster_out = "squaremcp_launch_poster.png"
img = Image.open(src).convert("RGB")
w, h = img.size
# 2 rows x 4 columns
cols, rows = 4, 2
frame_w = w // cols
frame_h = h // rows
frames = []
for r in range(rows):
for c in range(cols):
left = c * frame_w
top = r * frame_h
right = left + frame_w
bottom = top + frame_h
frame = img.crop((left, top, right, bottom))
frames.append(frame)
frames[0].save(poster_out, format="PNG")
frames[0].save(
out,
save_all=True,
append_images=frames[1:],
duration=1200
)
print(f"Saved {out}")
print(f"Saved {poster_out}")