Description
gif.js is an open source JavaScript library by Johan Nordberg for creating animated GIFs directly in the browser. You create a GIF object with options such as the number of web workers and the quality, add frames from image elements, canvas elements or a canvas context with a per-frame delay, and call render. Encoding runs in the background in web workers so the page stays responsive, and a finished event returns the result as a blob you can display or download. The project page includes a live demo where you can compare output against reference images rendered in Photoshop, and adjust quality, frame delay, repeat behaviour and dithering methods such as Atkinson, Floyd-Steinberg and Stucki. Further tests show canvas rendering and converting video to GIF. Downloads and documentation are on GitHub.…
Highlights
- Encodes animated GIFs in the browser
- Frames from images, canvases or canvas contexts
- Background encoding with web workers
- Adjustable quality, delay and repeat
- Several dithering algorithms
Ratings & Reviews
No ratings yet
Be the first to rate gif.js.
People also visit
gif.js FAQ
What is gif.js?
A JavaScript library that encodes animated GIF images in the browser.
How do I add frames?
Call gif.addFrame with an image element, a canvas element, or a canvas context (with {copy: true}), optionally setting a delay per frame, then call gif.render().
Does it block the page while encoding?
No. GIFs are generated in the background using web workers, and you receive a blob when the finished event fires.
Which dithering options are available?
None, Atkinson, FalseFloydSteinberg, FloydSteinberg and Stucki, each with a serpentine variant.
Where can I download it?
From the GitHub repository jnordberg/gif.js, which also hosts the documentation.
What are the best gif.js alternatives?
Popular alternatives to gif.js include gif.gg, Gifski and image2gif. See all gif.js alternatives


