gif-edit

GitHub

提供GIF动画编辑的最佳实践,涵盖使用ffmpeg和sharp进行重定向、替换文本、调整时序及编码。强调逐帧处理、避免拉伸失真、正确处理循环及字体渲染陷阱,确保动画质量。

skills/gif-edit/SKILL.md langchain-ai/design-agent

Trigger Scenarios

需要编辑或优化GIF动画文件 涉及GIF尺寸调整、文本替换或时序修改 处理屏幕录制生成的GIF

Install

npx skills add langchain-ai/design-agent --skill gif-edit -g -y
More Options

Use without installing

npx skills use langchain-ai/design-agent@gif-edit

指定 Agent (Claude Code)

npx skills add langchain-ai/design-agent --skill gif-edit -a claude-code -g -y

安装 repo 全部 skill

npx skills add langchain-ai/design-agent --all -g -y

预览 repo 内 skill

npx skills add langchain-ai/design-agent --list

SKILL.md

Frontmatter
{
    "name": "gif-edit",
    "description": "Edit animated GIFs and screen-recording GIFs with ffmpeg and sharp (reframe to exact dimensions, swap on-frame text, retime, trim or reorder the loop, add a zoom-and-pan camera, encode small). Still images go to image-ops."
}

gif-edit

A GIF is the format where the obvious approach is usually wrong: frames animate, so a decision that looks right on the settled frame breaks during the build-in. Work from frames, check across the whole timeline, encode last.

A mechanical change (resize, retime, trim, text swap) is: make it, check the encoded file, deliver. The camera and size work in references/camera-retime-size.md is for screen recordings that need it.

cd /workspace/projects/<slug>
ffprobe -v error -select_streams v:0 -show_entries stream=width,height,nb_frames,avg_frame_rate in.gif
mkdir -p frames && ffmpeg -i in.gif -fps_mode passthrough frames/f-%04d.png   # edit frames, not the gif
ffmpeg -framerate 20 -i frames/f-%04d.png -filter_complex \
  "[0:v]split[a][b];[a]palettegen=stats_mode=diff[p];[b][p]paletteuse=dither=bayer" renders/out.gif

The traps

  • Never judge a crop on the settled frame alone. A crop that frames the headline at rest can be full of graphic mid-build. Sample start, build and settle before committing.
  • Never fillborders=smear over animated content. Smear replicates edge pixels; a moving graphic touching that edge drags into vertical streaks. Crop to the true target aspect instead.
  • Crop to the target ratio, then scale both axes by the same factor. Stretching to hit exact dimensions distorts type. If the crop clips something important, that is a composition question for the person, not a scaling one: ask.
  • Open the loop on real content. Previews and some email clients show only frame 0, so an animation that fades in from blank reads as an empty asset. Rotate the loop to open on the settled state (frames[k:] + frames[:k]).
  • To slow motion down, add real frames; do not lower the frame rate. Dropping fps reads as choppy. Re-extract more source frames and keep playback at a normal rate. Do not interpolate: minterpolate ghosts hard-edged UI type and the cursor.
  • Hold before you cut, and trim to still water. A hold is the last frame repeated; a trim ends the clip where motion settles, not where the task finished. Find the still water, end there, then add the hold.
  • Keep the build-in, rest on a clean frame. Assemble [intro frames] + [one clean end frame repeated]. Both must use identical crop and scale geometry or the headline jumps at the join, and only ever erase a region on the static end frame.
  • Re-typeset text; never upscale it. Scaled raster type is what "grainy" means. Remove the old text region and set the copy fresh at final size in the brand's fonts (var(--brand-font-display), var(--brand-font-text) from /workspace/brand/tokens.css), rendered with node /workspace/tools/html2png.mjs <page.html> --out <dir> --size WxH --require-font <family>, which fails rather than ship a fallback font. Match the source's own alignment.
  • Gradient banding is the format, not your work. 256 indexed colours cannot hold a smooth gradient; the source has the same dithering. If someone wants it truly smooth, offer MP4 or animated WebP beside the GIF they asked for.

Removing something from the frame

In order of preference: crop it out (no seam), reframe so it never enters, cover it only when the background behind it is flat. Painting over a gradient seams; painting over a moving element has to be redone per frame.

Delivering

Check the encoded GIF itself, not an extracted PNG: ffprobe its dimensions, frame count, rate and duration, look at an early and a late frame (visual-verify), then deliver with upload_files. Quote the numbers that matter to the ask (size in MB, magnification, duration) in plain words.

Version History

  • 8134d7c Current 2026-11-20 21:40

Same Skill Collection

.agents/skills/brand-onboarding/SKILL.md
.agents/skills/deep-agents-core/SKILL.md
.agents/skills/deep-agents-memory/SKILL.md
.agents/skills/deep-agents-orchestration/SKILL.md
.agents/skills/design-agent-customize/SKILL.md
.agents/skills/design-agent-deploy/SKILL.md
.agents/skills/design-agent-evals/SKILL.md
.agents/skills/design-agent-onboarding/SKILL.md
.agents/skills/design-agent-troubleshoot/SKILL.md
.agents/skills/design-agent-update/SKILL.md
.agents/skills/langsmith-evaluator/SKILL.md
.agents/skills/vendor-sync/SKILL.md
skills/brand-design/SKILL.md
skills/content-brief/SKILL.md
skills/data-viz/SKILL.md
skills/design-wiki/SKILL.md
skills/faceless-explainer/SKILL.md
skills/film-breakdown/SKILL.md
skills/general-video/SKILL.md
skills/hyperframes-core/SKILL.md
skills/hyperframes-creative/SKILL.md
skills/hyperframes-keyframes/SKILL.md
skills/image-generation/SKILL.md
skills/image-ops/SKILL.md
skills/launch-film/SKILL.md
skills/media-production/SKILL.md
skills/motion-direction/SKILL.md
skills/music-to-video/SKILL.md
skills/paper-design/SKILL.md
skills/pr-to-video/SKILL.md
skills/reference-study/SKILL.md
skills/remotion-to-hyperframes/SKILL.md
skills/slideshow/SKILL.md
skills/sound/SKILL.md
skills/stills/SKILL.md
skills/storyboard/SKILL.md
skills/thumbnails/SKILL.md
skills/visual-verify/SKILL.md
.agents/skills/managed-deep-agents/SKILL.md
skills/embedded-captions/SKILL.md
skills/hyperframes-animation/SKILL.md
skills/hyperframes-audio/SKILL.md
skills/hyperframes-cli/SKILL.md
skills/hyperframes-registry/SKILL.md
skills/hyperframes/SKILL.md
skills/media-use/SKILL.md
skills/motion-graphics/SKILL.md

Metadata

Files
0
Version
8134d7c
Hash
7806da43
Indexed
2026-11-20 21:40

inicio - Wiki
Copyright © 2011-2026 iteam. Current version is 2.156.0. UTC+08:00, 2026-11-22 01:10
浙ICP备14020137号-1