Images to GIF API

Category: media

Combine multiple images into an animated GIF with customizable delay and size. Runs entirely in the browser using FFmpeg.wasm.

Endpoint

N/A Browser API (FFmpeg.wasm)
No Server API

Response

Content-Type: N/A

This tool creates animated GIFs from images in the browser using FFmpeg.wasm. No server-side API is available.

// Browser-only: processed via FFmpeg.wasm

cURL Example

# No cURL equivalent — this tool uses FFmpeg.wasm in the browser

Code Samples

// Animated GIF from images using FFmpeg.wasm
import { FFmpeg } from '@ffmpeg/ffmpeg';

const ffmpeg = new FFmpeg();
await ffmpeg.load();

// Write images
await ffmpeg.writeFile('img0000.png', imgData1);
await ffmpeg.writeFile('img0001.png', imgData2);

// Create file list
const list = "file 'img0000.png'\nduration 0.5\nfile 'img0001.png'\n";
await ffmpeg.writeFile('filelist.txt', new TextEncoder().encode(list));

await ffmpeg.exec(['-f', 'concat', '-safe', '0', '-i', 'filelist.txt',
    '-vf', 'scale=480:-1:flags=lanczos', '-loop', '0', 'output.gif']);

const gifData = await ffmpeg.readFile('output.gif');
# For server-side animated GIF from images:
import subprocess
subprocess.run(['ffmpeg', '-f', 'concat', '-safe', '0',
    '-i', 'filelist.txt', '-vf', 'scale=480:-1',
    '-loop', '0', 'output.gif'])
// For server-side animated GIF from images:
ProcessBuilder pb = new ProcessBuilder(
    "ffmpeg", "-f", "concat", "-safe", "0",
    "-i", "filelist.txt", "-vf", "scale=480:-1",
    "-loop", "0", "output.gif");
pb.start().waitFor();