Created
July 29, 2023 13:35
-
-
Save shinshin86/48704e8e20c0fb80a64e4e55d172c1ba to your computer and use it in GitHub Desktop.
Revisions
-
shinshin86 created this gist
Jul 29, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ (async() => { const gifFrames = require('gif-frames'); const fs = require('fs'); const path = require('path'); const gifPath = process.argv[2]; if(!gifPath) { console.log('Please provide an gif file as an argument'); process.exit(1); } const gifAbsPath = path.resolve(gifPath); if(!fs.existsSync(gifAbsPath)) { console.log('The provided gif file does not exists'); process.exit(1); } gifFrames({ url: gifAbsPath, frames: 'all', outputType: 'png', cumulative: true }) .then(function (frameData) { if (frameData.length > 1) { console.log('This GIF is animated.'); } else { console.log('This GIF is not animated.'); } }) .catch(function (err) { console.error('An error occurred: ', err); }); })()