Nighttime Peanut Migrations


1.0.9 • Public • Published

Reversomatic is a simple utility for reversing GIFs. Setup and usage are straighforward processes.


var Reversomatic = require('reversomatic')
// creates a new instance of Reversomatic with:
// Temp Directory: ./
// Output Directory: ./out
// Max Input GIF Duration (in milliseconds): 30000 (30 seconds)
// Max Input GIF Size (in MB, 0 for unlimited): 25 MB
// Defaults are ./temp, ./output, 30000ms, and unlimited, respectively
var ro = new Reversomatic('./', './out', 30000, 25)
// reverses a GIF file with arguments:
// Input File: image.gif
// Output File: image-reversed.gif (in the ./out folder)
// Options: forcedFrameDelay: 90 (milliseconds)
// Callback: Provides any errors, if applicable, and gifInfo, which contains the GIF's relative path,
// duration and frame delay (which are both in milliseconds)
ro.processGif('image.gif', 'image-reversed.gif', { forcedFrameDelay: 90 }, (err, gifInfo) => {
    if(err) throw err
    console.log(gifInfo.path, gifInfo.duration, gifInfo.frameDelay)


Reversomatic will create a temporary folder, inside the specified temp directory, for every call to processGif() with a valid input GIF. This folder is used to store the temporary frames (in .png format) of the input GIF during the reversal process. The folder will be cleaned up before control is passed to the callback provided to processGif(), whether the reversal was successful or otherwise.

Every call to processGif() runs asynchronously, and neither performs disk space checks nor keeps a 'thread pool' or similar mechanism. The responsibility falls to the user to ensure that usage is kept to within available system resources.

processGif() Options

Reversomatic will average the delay of each of the input GIF's frames to determine the output GIF's frame delay rate if averageFrameDelay is true. averageFrameDelay takes precedence over all other delay settings if enabled.
Reversomatic will floor the value provided in forcedFrameDelay and use it as the constant frame delay in the output GIF.

If neither of the above options are set, Reversomatic will use the input GIF's first frame delay to determine the output GIF's constant frame delay.

Known Bugs & Limitations

  • Certain GIFs do not report the correct duration and/or frame delay, and so may not display correctly, or may falsely trigger your duration limit
  • Does not support GIFs with a variable frame delay. Either the first frame's delay is used as the delay for the entire GIF, or the delays of all frames are averaged.


Please make every effort to adhere to the established code style.

Global prerequesites (TypeScript, uglify, and npm-watch) can be installed by running:

npm run preinstall_global_deps

A file watcher can be started, after installing the prerequesites, by running:

npm run watch

Which will build .ts files in the src folder and put them in reversomatic.js in the lib folder.


1.0.9 - January 1, 2018

  • Made all main processes in processGif() async
  • Cleaned up code
  • README updates

1.0.8 & 1.0.8b/c - December 31, 2017

  • processGif() now returns correct output GIF duration
  • (b) Values provided in the forcedFrameDelay option are now converted to floored integers before processing begins
  • README updates

1.0.7 & 1.0.7b/c/d - December 31, 2017

  • Added additional option, forcedFrameDelay, to processGif() options
  • (c) Removed unnecessary dependencies
  • (d) Remembered to actually build ;)
  • README updates

1.0.6 & 1.0.6b - December 30, 2017

  • Made unlimited input file size the default so as not to cause any surprises
  • README updates

1.0.5 - December 30, 2017

  • Code style updates and fixes
  • Fixed GIF duration calculation
  • Added max input GIF size (4th constructor argument)
  • Removed mangling option in uglify (to get descriptive argument names for Intellisense and similar)
  • README updates



npm i reversomatic

Downloadsweekly downloads









last publish


  • avatar
Report a vulnerability