Loading...
Loading...
Create animated GIFs for messaging platforms. Generates animated content optimized for sharing in chat applications.
npx skill4agent add qodex-ai/ai-agent-skills animated-message-composerfrom core.gif_builder import GIFBuilder
from PIL import Image, ImageDraw
# 1. Create builder
builder = GIFBuilder(width=128, height=128, fps=10)
# 2. Generate frames
for i in range(12):
frame = Image.new('RGB', (128, 128), (240, 248, 255))
draw = ImageDraw.Draw(frame)
# Draw your animation using PIL primitives
# (circles, polygons, lines, etc.)
builder.add_frame(frame)
# 3. Save with optimization
builder.save('output.gif', num_colors=48, optimize_for_emoji=True)templates/from templates.shake import create_shake_animation
frames = create_shake_animation(
object_type='circle',
object_data={'radius': 30, 'color': (100, 150, 255)},
num_frames=20,
direction='both'
)
builder.add_frames(frames)from PIL import Image
uploaded = Image.open('file.png')
# Use directly, or just as reference for colors/stylefrom PIL import ImageDraw
draw = ImageDraw.Draw(frame)
# Circles/ovals
draw.ellipse([x1, y1, x2, y2], fill=(r, g, b), outline=(r, g, b), width=3)
# Stars, triangles, any polygon
points = [(x1, y1), (x2, y2), (x3, y3), ...]
draw.polygon(points, fill=(r, g, b), outline=(r, g, b), width=3)
# Lines
draw.line([(x1, y1), (x2, y2)], fill=(r, g, b), width=5)
# Rectangles
draw.rectangle([x1, y1, x2, y2], fill=(r, g, b), outline=(r, g, b), width=3)draw_emojidraw_emoji_enhancedwidth=2create_gradient_backgroundcore.gif_builderbuilder = GIFBuilder(width=128, height=128, fps=10)
builder.add_frame(frame) # Add PIL Image
builder.add_frames(frames) # Add list of frames
builder.save('out.gif', num_colors=48, optimize_for_emoji=True, remove_duplicates=True)core.validatorsfrom core.validators import (
validate_gif,
is_slack_ready,
check_slack_size,
validate_dimensions
)
# Detailed validation
passes, info = validate_gif('my.gif', is_emoji=True, verbose=True)
# Quick check
if is_slack_ready('my.gif'):
print("Ready!")
# Focused checks
passes, info = check_slack_size('my.gif', is_emoji=True)
passes, info = validate_dimensions(128, 128, is_emoji=True)core.easingfrom core.easing import interpolate
# Progress from 0.0 to 1.0
t = i / (num_frames - 1)
# Apply easing
y = interpolate(start=0, end=400, t=t, easing='ease_out')
# Available: linear, ease_in, ease_out, ease_in_out,
# bounce_out, elastic_out, back_outcore.frame_composerfrom core.frame_composer import (
create_blank_frame, # Solid color background
create_gradient_background, # Vertical gradient
draw_circle, # Helper for circles
draw_rectangle, # Helper for rectangles
draw_line, # Helper for lines
draw_text, # Simple text rendering
draw_emoji, # Emoji rendering (platform-dependent)
draw_star # 5-pointed star
)draw_emoji_enhanceddraw_circle_with_shadowdraw_rounded_rectangleadd_vignettecore.color_palettesfrom core.color_palettes import get_palette, get_text_color_for_background
palette = get_palette('vibrant')
text_color = get_text_color_for_background(palette['background'])core.typographyfrom core.typography import draw_text_with_outline
draw_text_with_outline(frame, "SALE!", position=(240, 240), font_size=48, centered=True)core.visual_effectsfrom core.visual_effects import ParticleSystem
particles = ParticleSystem()
particles.emit(240, 240, count=20)templates/GIFBuildermath.sin()math.cos()math.sin(t * frequency * 2 * math.pi)interpolate()easing='bounce_out'easing='ease_in'image.rotate(angle, resample=Image.BICUBIC)Image.blend(image1, image2, alpha)interpolate()easing='ease_out'easing='back_out'x += vxy += vyvy += gravity_constantnum_colors=48remove_duplicates=Trueoptimize_for_emoji=True# Maximum optimization for emoji
builder.save(
'emoji.gif',
num_colors=48,
optimize_for_emoji=True,
remove_duplicates=True
)pip install pillow imageio numpy