All Projects → benwiley4000 → Gif Frames

benwiley4000 / Gif Frames

Licence: mit
🖼 Extract frames from an animated GIF with pure JS

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Gif Frames

Essential Image Optimization
Essential Image Optimization - an eBook
Stars: ✭ 1,950 (+1850%)
Mutual labels:  images, gif
Lilliput
Resize images and animated GIFs in Go
Stars: ✭ 1,690 (+1590%)
Mutual labels:  images, gif
Awesomeimagepicker
Awesome Image Picker library will pick images/gifs with beautiful interface. Supports image or gif, Single and Multiple Image selection.
Stars: ✭ 160 (+60%)
Mutual labels:  images, gif
Transferee
一个帮助您完成从缩略视图到原视图无缝过渡转变的神奇框架
Stars: ✭ 2,697 (+2597%)
Mutual labels:  images, gif
KGySoft.Drawing
KGy SOFT Drawing is a library for advanced image, icon and graphics handling.
Stars: ✭ 27 (-73%)
Mutual labels:  images, gif
Gifmagic
💈 Gif maker and extractor in Swift
Stars: ✭ 38 (-62%)
Mutual labels:  extract, gif
Npm Gif
Replace NPM install's progress bar with a GIF!
Stars: ✭ 332 (+232%)
Mutual labels:  images, gif
Devtools Timeline Images
Extract images from Chrome DevTools report.
Stars: ✭ 44 (-56%)
Mutual labels:  extract, images
Openfintech
Opensource FinTech standards & payment provider data
Stars: ✭ 87 (-13%)
Mutual labels:  images
Mzip Android
An Android compress and extract library support popular compression format such as rar, zip
Stars: ✭ 95 (-5%)
Mutual labels:  extract
Flowabot
Modular Discord bot with fun features including twitch commands and advanced osu! commands. 🌷
Stars: ✭ 86 (-14%)
Mutual labels:  gif
Gittar
🎸 Download and/or Extract git repositories (GitHub, GitLab, BitBucket). Cross-platform and Offline-first!
Stars: ✭ 87 (-13%)
Mutual labels:  extract
Vbasync
Cross-platform tool to synchronize macros from an Office VBA-enabled file with a version-controlled folder
Stars: ✭ 98 (-2%)
Mutual labels:  extract
Imscript
a collection of small and standalone utilities for image processing, written in C
Stars: ✭ 86 (-14%)
Mutual labels:  images
Pdflayouttextstripper
Converts a pdf file into a text file while keeping the layout of the original pdf. Useful to extract the content from a table in a pdf file for instance. This is a subclass of PDFTextStripper class (from the Apache PDFBox library).
Stars: ✭ 1,369 (+1269%)
Mutual labels:  extract
Gifcompressor
An Android tool to compresses your GIFs into lightweight MP4 video using fast, hardware-accelerated encoders. Supports cropping, rotation, GIF concatenation and much more.
Stars: ✭ 85 (-15%)
Mutual labels:  gif
Lqip Modern
Modern approach to Low Quality Image Placeholders (LQIP) using webp and sharp.
Stars: ✭ 85 (-15%)
Mutual labels:  images
Imgix Php
A PHP client library for generating URLs with imgix
Stars: ✭ 100 (+0%)
Mutual labels:  images
Nider
Python package to add text to images, textures and different backgrounds
Stars: ✭ 100 (+0%)
Mutual labels:  images
Kgif
Tool for creating gif file from capturing active window.
Stars: ✭ 94 (-6%)
Mutual labels:  gif

gif-frames

A pure JavaScript tool for extracting GIF frames and saving to file. Works in Node or the browser. Uses get-pixels and save-pixels under the hood.

NPM

Install

npm install gif-frames

CDN scripts

If you're not using npm, you can include one of these in your HTML file:

<!-- unminified -->
<script src="https://unpkg.com/[email protected]?main=bundled"></script>

<!-- minified -->
<script src="https://unpkg.com/[email protected]?main=bundled-min"></script>

This will expose gifFrames as a global variable.

require('gif-frames')(options[, callback])

var gifFrames = require('gif-frames');
var fs = require('fs');

gifFrames({ url: 'image.gif', frames: 0 }).then(function (frameData) {
  frameData[0].getImage().pipe(fs.createWriteStream('firstframe.jpg'));
});

Options:

  • url (required): The pathname to the file, or an in-memory Buffer
  • frames (required): The set of frames to extract. Can be one of:
  • outputType (optional, default 'jpg'): Type to use for output (see type for save-pixels)
  • quality (optional): Jpeg quality (see quality for save-pixels)
  • cumulative (optional, default false): Many animated GIFs will only contain partial image information in each frame after the first. Specifying cumulative as true will compute each frame by layering it on top of previous frames. Note: the cost of this computation is proportional to the size of the last requested frame index.

The callback accepts the arguments (error, frameData).

Returns:

A Promise resolving to the frameData array (if promises are supported in the running environment)

frameData

An array of objects of the form:

{
  getImage,
  frameIndex,
  frameInfo
}

getImage()

Returns one of:

  • A drawn canvas DOM element, if options.outputType is 'canvas'
  • A data stream which can be piped to file output, otherwise

frameIndex

The index corresponding to the frame's position in the original GIF (not necessarily the same as the frame's position in the result array)

frameInfo

It is an Object with metadata of the frame. Fields:

Name Type Description
x Integer Image Left Position
y Integer Image Top Position
width Integer Image Width
height Integer Image Height
has_local_palette Boolean Image local palette presentation flag
palette_offset Integer Image palette offset
palette_size Integer Image palette size
data_offset Integer Image data offset
data_length Integer Image data length
transparent_index Integer Transparent Color Index
interlaced Boolean Interlace Flag
delay Integer Delay Time (1/100ths of a second)
disposal Integer Disposal method

See GIF spec for details

Examples

Writing selected frames to the file system in Node:

var gifFrames = require('gif-frames');
var fs = require('fs');

gifFrames(
  { url: 'image.gif', frames: '0-2,7', outputType: 'png', cumulative: true },
  function (err, frameData) {
    if (err) {
      throw err;
    }
    frameData.forEach(function (frame) {
      frame.getImage().pipe(fs.createWriteStream(
        'image-' + frame.frameIndex + '.png'
      ));
    });
  }
);

Drawing first frame to canvas in browser (and using a Promise):

var gifFrames = require('gif-frames');

gifFrames({ url: 'image.gif', frames: 0, outputType: 'canvas' })
  .then(function (frameData) {
    document.body.appendChild(frameData[0].getImage());
  }).catch(console.error.bind(console));
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].