slack-gif-creator by anthropics/skills
npx skills add https://github.com/anthropics/skills --skill slack-gif-creator一个提供实用工具和知识的工具包,用于创建针对 Slack 优化的动画 GIF。
尺寸:
参数:
from core.gif_builder import GIFBuilder
from PIL import Image, ImageDraw
# 1. 创建构建器
builder = GIFBuilder(width=128, height=128, fps=10)
# 2. 生成帧
for i in range(12):
frame = Image.new('RGB', (128, 128), (240, 248, 255))
draw = ImageDraw.Draw(frame)
# 使用 PIL 基本图形绘制你的动画
# (圆形、多边形、线条等)
builder.add_frame(frame)
# 3. 保存并优化
builder.save('output.gif', num_colors=48, optimize_for_emoji=True)
如果用户上传了图片,请考虑他们是否希望:
使用 PIL 加载和处理图片:
from PIL import Image
uploaded = Image.open('file.png')
# 直接使用,或仅作为颜色/风格的参考
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
从零开始绘制图形时,使用 PIL ImageDraw 的基本图形:
from PIL import ImageDraw
draw = ImageDraw.Draw(frame)
# 圆形/椭圆形
draw.ellipse([x1, y1, x2, y2], fill=(r, g, b), outline=(r, g, b), width=3)
# 星星、三角形、任何多边形
points = [(x1, y1), (x2, y2), (x3, y3), ...]
draw.polygon(points, fill=(r, g, b), outline=(r, g, b), width=3)
# 线条
draw.line([(x1, y1), (x2, y2)], fill=(r, g, b), width=5)
# 矩形
draw.rectangle([x1, y1, x2, y2], fill=(r, g, b), outline=(r, g, b), width=3)
请勿使用: 表情符号字体(跨平台不可靠)或假设此技能中存在预打包的图形。
图形应该看起来精致且有创意,而不是基础简陋。方法如下:
使用更粗的线条 - 始终为轮廓和线条设置 width=2 或更高。细线(width=1)看起来生涩且业余。
增加视觉深度:
create_gradient_background)让形状更有趣:
注意颜色:
对于复杂形状(心形、雪花等):
要有创意和注重细节!一个好的 Slack GIF 应该看起来精致,而不是像占位符图形。
core.gif_builder)组装帧并为 Slack 优化:
builder = GIFBuilder(width=128, height=128, fps=10)
builder.add_frame(frame) # 添加 PIL Image
builder.add_frames(frames) # 添加帧列表
builder.save('out.gif', num_colors=48, optimize_for_emoji=True, remove_duplicates=True)
core.validators)检查 GIF 是否符合 Slack 要求:
from core.validators import validate_gif, is_slack_ready
# 详细验证
passes, info = validate_gif('my.gif', is_emoji=True, verbose=True)
# 快速检查
if is_slack_ready('my.gif'):
print("Ready!")
core.easing)平滑运动而非线性:
from core.easing import interpolate
# 进度从 0.0 到 1.0
t = i / (num_frames - 1)
# 应用缓动
y = interpolate(start=0, end=400, t=t, easing='ease_out')
# 可用选项:linear, ease_in, ease_out, ease_in_out,
# bounce_out, elastic_out, back_out
core.frame_composer)为常见需求提供的便利函数:
from core.frame_composer import (
create_blank_frame, # 纯色背景
create_gradient_background, # 垂直渐变
draw_circle, # 绘制圆形的辅助函数
draw_text, # 简单文本渲染
draw_star # 五角星
)
用振荡偏移对象位置:
math.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 += vx, y += vyvy += gravity_constant仅当被要求减小文件大小时,才实施以下几种方法:
num_colors=48 而不是 128remove_duplicates=Trueoptimize_for_emoji=True 自动优化# 表情符号的最大优化
builder.save(
'emoji.gif',
num_colors=48,
optimize_for_emoji=True,
remove_duplicates=True
)
此技能提供:
它不提供:
关于用户上传的说明:此技能不包含预构建的图形,但如果用户上传了图片,请使用 PIL 加载并处理它 - 根据他们的请求解释他们是希望直接使用它还是仅作为灵感来源。
发挥创意!组合概念(弹跳 + 旋转、脉动 + 滑动等)并充分利用 PIL 的功能。
pip install pillow imageio numpy
每周安装量
14.6K
代码仓库
GitHub 星标数
101.0K
首次出现
2026年1月20日
安全审计
安装于
opencode11.7K
gemini-cli11.4K
codex11.1K
cursor10.7K
claude-code10.6K
github-copilot10.1K
A toolkit providing utilities and knowledge for creating animated GIFs optimized for Slack.
Dimensions:
Parameters:
from 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)
If a user uploads an image, consider whether they want to:
Load and work with images using PIL:
from PIL import Image
uploaded = Image.open('file.png')
# Use directly, or just as reference for colors/style
When drawing graphics from scratch, use PIL ImageDraw primitives:
from 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)
Don't use: Emoji fonts (unreliable across platforms) or assume pre-packaged graphics exist in this skill.
Graphics should look polished and creative, not basic. Here's how:
Use thicker lines - Always set width=2 or higher for outlines and lines. Thin lines (width=1) look choppy and amateurish.
Add visual depth :
create_gradient_background)Make shapes more interesting :
Pay attention to colors :
For complex shapes (hearts, snowflakes, etc.):
Be creative and detailed! A good Slack GIF should look polished, not like placeholder graphics.
core.gif_builder)Assembles frames and optimizes for Slack:
builder = 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.validators)Check if GIF meets Slack requirements:
from core.validators import validate_gif, is_slack_ready
# Detailed validation
passes, info = validate_gif('my.gif', is_emoji=True, verbose=True)
# Quick check
if is_slack_ready('my.gif'):
print("Ready!")
core.easing)Smooth motion instead of linear:
from 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_out
core.frame_composer)Convenience functions for common needs:
from core.frame_composer import (
create_blank_frame, # Solid color background
create_gradient_background, # Vertical gradient
draw_circle, # Helper for circles
draw_text, # Simple text rendering
draw_star # 5-pointed star
)
Offset object position with oscillation:
math.sin() or math.cos() with frame indexScale object size rhythmically:
math.sin(t * frequency * 2 * math.pi) for smooth pulseObject falls and bounces:
interpolate() with easing='bounce_out' for landingeasing='ease_in' for falling (accelerating)Rotate object around center:
image.rotate(angle, resample=Image.BICUBIC)Gradually appear or disappear:
Image.blend(image1, image2, alpha)Move object from off-screen to position:
interpolate() with easing='ease_out' for smooth stopeasing='back_out'Scale and position for zoom effect:
Create particles radiating outward:
x += vx, y += vyvy += gravity_constantOnly when asked to make the file size smaller, implement a few of the following methods:
num_colors=48 instead of 128remove_duplicates=True in save()optimize_for_emoji=True auto-optimizes# Maximum optimization for emoji
builder.save(
'emoji.gif',
num_colors=48,
optimize_for_emoji=True,
remove_duplicates=True
)
This skill provides:
It does NOT provide:
Note on user uploads : This skill doesn't include pre-built graphics, but if a user uploads an image, use PIL to load and work with it - interpret based on their request whether they want it used directly or just as inspiration.
Be creative! Combine concepts (bouncing + rotating, pulsing + sliding, etc.) and use PIL's full capabilities.
pip install pillow imageio numpy
Weekly Installs
14.6K
Repository
GitHub Stars
101.0K
First Seen
Jan 20, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode11.7K
gemini-cli11.4K
codex11.1K
cursor10.7K
claude-code10.6K
github-copilot10.1K
97,600 周安装