Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Extracts frames from a GIF including inter-frame coalescing.

NotificationsYou must be signed in to change notification settings

transitive-bullshit/gif-extract-frames

Repository files navigation

Extracts frames from GIFs including inter-frame coalescing.

NPMBuild StatusJavaScript Style Guide

Why?

Some GIFs store delta information between frames instead of storing complete frames. Here's an example:


Original gif (source).

Input gif bubbles


5 extracted frameswithout coalescing.

Example without coalescing


5 extracted frameswith coalescing.

Example without coalescing


Install

This module requiresnode >= 8.

npm install --save gif-extract-frames

Usage

constextractFrames=require('gif-extract-frames')constresults=awaitextractFrames({input:'./media/bubbles.gif',output:'frame-%d.png'})console.log('number of frames',results.shape[0])

API

extractFrames(opts)

Returns:Promise<ndarray>

Returns a modified version of thendarray returned byget-pixels.

opts.input

Type:StringRequired

Path to a GIF file.

opts.output

Type:StringExample:'output/frame-%d.png'

Optional frame pattern if you want to write each frame to disk. Should contain a%d that will be replaced with the frame number (starting at 0).

The resultingndarray will be returned whether or not anoutput is given.

opts.coalesce

Type:BooleanDefault:true

Whether or not to perform inter-frame coalescing.

Related

  • gifsicle - GIF manipulation library capable ofexploding gifs, but AFAIK does not support frame coalescing when exporting frames.
  • gif-explode - Alternative which usesgifsicle but does not support frame coalescing.
  • omggif - JavaScript GIF encoder & decoder used under the hood.
  • ffmpeg-extract-frames - Analogous module for extracting frames from video files.

License

MIT ©Travis Fischer

Support my OSS work byfollowing me on twittertwitter

About

Extracts frames from a GIF including inter-frame coalescing.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp