feat(tools): remove background from animated GIFs (WebP, APNG) (#502)

Adds a dedicated remove-gif-background AI tool: removes the background from an animated GIF, WebP, or APNG frame by frame and reassembles a transparent (or composited) animation in WebP, APNG, or GIF, with full per-frame effects. Reuses the background-removal bundle. Verified end-to-end with the real rembg model.

Closes #496.
This commit is contained in:
SnapOtter
2026-07-11 19:53:00 +08:00
committed by GitHub
parent e7cfc00fe1
commit cb5db59f77
50 changed files with 2240 additions and 6 deletions
+11
View File
@@ -352,6 +352,17 @@ async function main() {
"animated-simpsons.gif",
);
// ── Animated APNG (multi-frame, full alpha) for remove-gif-background ──
// The committed file is a 4-frame RGBA APNG. This regenerates a small animated
// APNG only if the fixture is missing (bytes will differ from the committed one).
console.log("Animated APNG (for remove-gif-background):");
const apngOut = join(IMAGE_VALID, "animated.apng");
ffIfMissing(
apngOut,
`-f lavfi -i "testsrc=duration=1:size=48x48:rate=4" -pix_fmt rgba -plays 0 -f apng -y "${apngOut}"`,
"animated.apng",
);
// ── Synthetic audio/video (A) ──
// NOTE: media-30s.mp4 and media-30s.wav are no longer generated here.
// media-30s.mp4 is now a real Big Buck Bunny CC-BY hero clip (committed).