Gathering detailed insights and metrics for @nsfw-filter/gif-frames
Gathering detailed insights and metrics for @nsfw-filter/gif-frames
Gathering detailed insights and metrics for @nsfw-filter/gif-frames
Gathering detailed insights and metrics for @nsfw-filter/gif-frames
🖼 Extract frames from an animated GIF with pure JS
npm install @nsfw-filter/gif-frames
Typescript
Module System
Node Version
NPM Version
73.2
Supply Chain
92.2
Quality
69.6
Maintenance
50
Vulnerability
97.3
License
JavaScript (100%)
Total Downloads
680,945
Last Day
101
Last Week
1,086
Last Month
4,073
Last Year
147,526
MIT License
32 Stars
70 Commits
4 Forks
1 Watchers
2 Branches
1 Contributors
Updated on Apr 18, 2023
Minified
Minified + Gzipped
Latest Version
1.0.2
Package Id
@nsfw-filter/gif-frames@1.0.2
Unpacked Size
0.99 MB
Size
246.10 kB
File Count
8
NPM Version
6.14.6
Node Version
12.18.3
Cumulative downloads
Total Downloads
5
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.
1npm install gif-frames
If you're not using npm, you can include one of these in your HTML file:
1<!-- unminified --> 2<script src="https://unpkg.com/gif-frames@1.0.1?main=bundled"></script> 3 4<!-- minified --> 5<script src="https://unpkg.com/gif-frames@1.0.1?main=bundled-min"></script>
This will expose gifFrames
as a global variable.
require('gif-frames')(options[, callback])
1var gifFrames = require('gif-frames'); 2var fs = require('fs'); 3 4gifFrames({ url: 'image.gif', frames: 0 }).then(function (frameData) { 5 frameData[0].getImage().pipe(fs.createWriteStream('firstframe.jpg')); 6});
url
(required): The pathname to the file, or an in-memory Bufferframes
(required): The set of frames to extract. Can be one of:
'all'
(gets every frame)Initializer
accepted by the multi-integer-range libraryoutputType
(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)
.
A Promise
resolving to the frameData
array (if promises are supported in the running environment)
frameData
An array of objects of the form:
1{ 2 getImage, 3 frameIndex, 4 frameInfo 5}
getImage()
Returns one of:
options.outputType
is 'canvas'
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 |
Writing selected frames to the file system in Node:
1var gifFrames = require('gif-frames'); 2var fs = require('fs'); 3 4gifFrames( 5 { url: 'image.gif', frames: '0-2,7', outputType: 'png', cumulative: true }, 6 function (err, frameData) { 7 if (err) { 8 throw err; 9 } 10 frameData.forEach(function (frame) { 11 frame.getImage().pipe(fs.createWriteStream( 12 'image-' + frame.frameIndex + '.png' 13 )); 14 }); 15 } 16);
Drawing first frame to canvas in browser (and using a Promise
):
1var gifFrames = require('gif-frames'); 2 3gifFrames({ url: 'image.gif', frames: 0, outputType: 'canvas' }) 4 .then(function (frameData) { 5 document.body.appendChild(frameData[0].getImage()); 6 }).catch(console.error.bind(console));
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 1/29 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
43 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreLast Day
31.2%
101
Compared to previous day
Last Week
20.5%
1,086
Compared to previous week
Last Month
12.5%
4,073
Compared to previous month
Last Year
-37.3%
147,526
Compared to previous year