gif-analyzer

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

GIF Analyzer

GIF 分析工具

Analyze animated GIFs by extracting frames and interpreting them as sequential video.
通过提取帧并将其解读为连续视频,来分析GIF动图。

Quick Start

快速开始

When the user uses
/gif
:
Pattern 1: Basic analysis
/gif ./animation.gif
Pattern 2: With specific request
/gif ./animation.gif describe what happens step by step
/gif ./demo.gif what is the character doing?
/gif ./screen.gif summarize this screen recording
当用户使用
/gif
命令时:
模式1:基础分析
/gif ./animation.gif
模式2:带特定请求
/gif ./animation.gif 逐步描述发生的内容
/gif ./demo.gif 这个角色在做什么?
/gif ./screen.gif 总结这段屏幕录制内容

Workflow

工作流程

Step 1: Parse User Input

步骤1:解析用户输入

Extract from the user's message:
  1. GIF path: The file path immediately after
    /gif
  2. User request (optional): Any text after the GIF path
Example parsing:
  • Input:
    /gif ./demo.gif explain the animation
  • GIF path:
    ./demo.gif
  • User request:
    explain the animation
从用户消息中提取:
  1. GIF路径:紧跟在
    /gif
    后的文件路径
  2. 用户请求(可选):GIF路径之后的任何文本
解析示例:
  • 输入:
    /gif ./demo.gif explain the animation
  • GIF路径:
    ./demo.gif
  • 用户请求:
    explain the animation

Step 2: Extract Frames

步骤2:提取帧

bash
python3 ~/.claude/skills/gif-analyzer/extract_gif_frames.py <gif_path> --output-dir /tmp/gif_frames_analysis
Options for long GIFs:
bash
python3 ~/.claude/skills/gif-analyzer/extract_gif_frames.py <gif_path> --max-frames 30 --skip 2
bash
python3 ~/.claude/skills/gif-analyzer/extract_gif_frames.py <gif_path> --output-dir /tmp/gif_frames_analysis
针对长GIF的选项:
bash
python3 ~/.claude/skills/gif-analyzer/extract_gif_frames.py <gif_path> --max-frames 30 --skip 2

Step 3: Read Metadata

步骤3:读取元数据

Check
gif_metadata.json
for:
  • Total frames and duration
  • Individual frame timestamps
  • Resolution and loop information
查看
gif_metadata.json
获取以下信息:
  • 总帧数和时长
  • 单帧时间戳
  • 分辨率和循环信息

Step 4: View and Analyze Frames

步骤4:查看并分析帧

View frames in order:
frame_001.png
,
frame_002.png
, etc.
CRITICAL: Treat frames as a continuous video sequence:
  1. Frame 001 = START of the animation
  2. Frame numbers increase in TIME ORDER
  3. Consecutive frames show MOTION/CHANGE over time
按顺序查看帧:
frame_001.png
frame_002.png
等。
重要提示:将帧视为连续的视频序列:
  1. Frame 001 = 动画起始点
  2. 帧号按时间顺序递增
  3. 连续帧展示了随时间变化的动态/内容变更

Step 5: Respond to User

步骤5:响应用户

If user provided a specific request, focus on answering that. Otherwise, provide a general analysis of the GIF content.
如果用户有特定请求,重点回应该请求。 否则,提供对GIF内容的常规分析。

Script Options

脚本选项

OptionDescriptionDefault
--output-dir
,
-o
Output directory
./gif_frames_<timestamp>
--max-frames
,
-m
Max frames to extract50
--skip
,
-s
Extract every Nth frame1 (all frames)
选项描述默认值
--output-dir
,
-o
输出目录
./gif_frames_<timestamp>
--max-frames
,
-m
最大提取帧数50
--skip
,
-s
每隔N帧提取一次1(提取所有帧)

Frame Analysis Guidelines

帧分析指南

  1. Temporal Awareness: Frame 001 is the beginning
  2. Motion Detection: Compare adjacent frames to identify movement
  3. Key Frames: Identify significant moments (start, middle, end)
  4. Loop Points: Note if the animation appears to loop
  5. Duration Context: Use timestamp info to understand pacing
  1. 时间感知:Frame 001是动画的开始
  2. 动态检测:对比相邻帧以识别运动
  3. 关键帧:识别重要时刻(开始、中间、结束)
  4. 循环点:注意动画是否存在循环
  5. 时长上下文:使用时间戳信息了解节奏

Output Format

输出格式

📹 **GIF Analysis: [filename]**

**Overview:**
[1-2 sentence summary]

**Timeline:**
- [0.0s - 0.5s] Frame 1-5: [Description]
- [0.5s - 1.0s] Frame 6-10: [Description]
...

**[Answer to user's specific question if provided]**
📹 **GIF分析:[文件名]**

**概述:**
[1-2句话总结]

**时间线:**
- [0.0s - 0.5s] 帧1-5:[描述]
- [0.5s - 1.0s] 帧6-10:[描述]
...

**[如果有用户特定问题,此处为答案]**

Troubleshooting

故障排除

  • Pillow not found:
    pip install Pillow
  • Too many frames: Use
    --skip 2
    or higher
  • Large output: Use
    --max-frames 20
  • 未找到Pillow
    pip install Pillow
  • 帧数过多:使用
    --skip 2
    或更高值
  • 输出文件过大:使用
    --max-frames 20