Skip to content

Instantly share code, notes, and snippets.

@xadn
Created March 13, 2026 18:08
Show Gist options
  • Select an option

  • Save xadn/236f90238501229ad4262af1f505e516 to your computer and use it in GitHub Desktop.

Select an option

Save xadn/236f90238501229ad4262af1f505e516 to your computer and use it in GitHub Desktop.
Claude Code skill: Edit GIF files with gifsicle for PR demos
name description args
gif-edit
Edit GIF files with gifsicle for PR demos. Replicate frames, delete frames, adjust timing, set looping, and more. Use when asked to "edit a gif", "slow down a gif", "hold on a frame", "fix gif timing", or optimize recorded demo GIFs.
(optional) path to GIF file and/or editing instructions

GIF Edit

Edit GIF files using gifsicle for polishing PR demo recordings.

Workflow

Step 1: Identify the GIF

  • If a path is provided in args, use it
  • Otherwise check ~/Downloads/ for recent GIFs
  • If ambiguous, ask the user which file

Step 2: Inspect the GIF

Always start by running:

gifsicle -I <path>

This shows frame count, dimensions, and per-frame delays. Share a summary with the user:

GIF: <filename>
Frames: <count> (#0 through #N)
Dimensions: <W>x<H>
Total duration: ~<sum of delays>s
Frame delays: <list or pattern>

Step 3: Apply Edits

Parse the user's instructions and translate to gifsicle commands. Common operations:

Replicate frames (hold longer on a frame)

Use frame selection to repeat a frame N times:

gifsicle input.gif "#0" "#1" "#1" "#1" "#1" "#1" "#2" "#3" -o output.gif

This repeats frame #1 five times. When replicating, the frame keeps its original delay.

Delete frames

Omit unwanted frames from the selection:

# Delete frame #0 (skip it in the sequence)
gifsicle input.gif "#1" "#2" "#3" "#4" -o output.gif

# Delete a range
gifsicle input.gif "#0" "#5-9" -o output.gif

Change frame delays

# Set all frames to 100ms (10 = 1/100s units)
gifsicle input.gif -d10 -o output.gif

# Set specific frame delays
gifsicle input.gif -d80 "#0" -d30 "#1" -d80 "#2" -o output.gif

Delay units: gifsicle uses 1/100s. So -d100 = 1 second, -d30 = 0.3s, -d200 = 2s.

Set looping

# Loop forever
gifsicle input.gif --loop -o output.gif

# Loop N times
gifsicle input.gif --loop=3 -o output.gif

# No loop (play once)
gifsicle input.gif --no-loop -o output.gif

Optimize file size

# Optimize (lossless)
gifsicle -O3 input.gif -o output.gif

# Reduce colors
gifsicle --colors 128 input.gif -o output.gif

# Lossy compression (higher = more compression)
gifsicle --lossy=80 -O3 input.gif -o output.gif

Crop

gifsicle --crop x0,y0-x1,y1 input.gif -o output.gif

Resize

gifsicle --resize WxH input.gif -o output.gif
gifsicle --resize-width 800 input.gif -o output.gif

Step 4: Verify

After editing, always run gifsicle -I again and report the result so the user can confirm.

Important Notes

  • Frame numbering: gifsicle uses 0-indexed frames (#0 is the first frame). If the user uses 1-indexed numbering, convert accordingly and confirm.
  • In-place editing: Use -o <same-file> to overwrite. gifsicle handles this safely.
  • Color warnings: too many colors, using local colormaps is harmless — gifsicle handles it automatically.
  • Combining operations: Chain multiple edits in one command when possible. Frame selection, delays, and options can be combined.
  • Order of operations: When replicating AND deleting frames, work from the original frame indices. Build the complete desired frame sequence in one command.

Tips for PR Demo GIFs

  • Hold on results: Replicate the final frame 3-5x so viewers can see the end state
  • Hold on before-state: Replicate the first meaningful frame so viewers orient themselves
  • Remove setup frames: Delete early frames that show navigation/setup not relevant to the demo
  • Consistent pacing: Use -d to normalize frame delays if recording was inconsistent
  • Always loop: PR GIFs should loop forever (--loop) so reviewers can rewatch
  • Target size: Keep under 10MB for GitHub/Graphite PR descriptions; use --lossy=80 -O3 if too large
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment