SuperAPI AI Directory

gif-maker

Design & creation

View repository

Updated 10-15 21:56

About this skill

GIF Animation Generator (GIF Maker)

This Skill is designed to help users quickly convert a set of sequence frame images or a single sprite sheet into a GIF animation.

Core Features

  • Sequence frames to GIF: Supports reading the png, jpg sequence in a folder, and compositing a GIF sorted by filename.
  • Sprite sheet to GIF: Supports reading a single Grid image (such as a 4x4 sprite sheet), automatically splitting and compositing it into a GIF.
  • Smart compression: Supports specifying the target file size (such as 950KB) via the --max-size parameter, automatically adjusting compression parameters to meet the size limits of platforms such as WeChat stickers.
  • Parameter control:
    • --fps: Specify frames per second (default is 12).
    • --layout: Specify the sprite sheet layout (such as 4x4), only needed in this mode.
    • --loop: Defaults to looping forever.
    • --max-size: Specify the maximum size (KB).

Usage Guide

1. Quick Start

No manual dependency installation is required; just run the script directly. The tool will automatically create a virtual environment (.venv) and install the required dependencies.

# 基本用法 1:从文件夹读取序列帧
./skills/gif-maker/scripts/run.sh /path/to/frame_folder --output my_anim.gif

# 基本用法 2:从单张精灵表生成 (需要指定布局)
./skills/gif-maker/scripts/run.sh /path/to/sheet.png --layout 4x4 --output my_sheet_anim.gif

# 常用选项:
# - 指定 FPS (例如 24)
./skills/gif-maker/scripts/run.sh /path/to/folder --fps 24

# - 开启自动压缩 (限制文件大小在 950KB 以内)
./skills/gif-maker/scripts/run.sh /path/to/folder --max-size 950

2. (Optional) Manual Installation

If you want to manage the environment manually (note: the compression feature depends on the gifsicle tool, please ensure it is installed on your system):

  • macOS: brew install gifsicle
  • Ubuntu: sudo apt-get install gifsicle
python3 -m venv skills/gif-maker/.venv
source skills/gif-maker/.venv/bin/activate
pip install -r skills/gif-maker/requirements.txt
python3 skills/gif-maker/scripts/make_gif.py ...

Parameter Description

  • source: Input path. It can be a folder containing images or a single image file.
  • --output (-o): Output GIF filename, default is output.gif。
  • --fps: Frame rate, default is 12.
  • --layout: Only used when source is a single file, in the format 行数x列数 (such as 4x4)。
  • --max-size: (Optional) Enable GIF compression and specify the target maximum file size (KB). Compression will only be attempted when the original file exceeds this size.

Example

Suppose you have a folder frames/ containing 01.png, 02.png ... 10.png:

./skills/gif-maker/scripts/run.sh frames/ -o animation.gif --fps 15

Suppose you have a sheet.png that is a 4x4 action sequence, and you need to generate a GIF that complies with WeChat sticker specifications (<1MB):

./skills/gif-maker/scripts/run.sh sheet.png --layout 4x4 -o action.gif --max-size 950