Gifle is a command line node script that provides a very simple means of configuring the output of video files to optimised animated GIFs, using the source filename to set output options.
$ npm install gifle -g
- Node + npm
- Gifsicle: only requried for 'crush' command or restricting the color palette
Gifle uses the source video filename to configure its output to an animated gif.
Rename your source video to include desired configuration settings:
Command line: Run gifle in command line with the source file as the only argument:
$ cd path/to/$ gifle my-movie-3loops-2speed-18fps-55cols-300x.mov
$ gifle ~/abs/path/to/my-movie-3loops-2speed-18fps-55cols-300x.mov
An animated gif called
my-movie.gif will be saved to same directory as the source with
the following settings:
- Loop 3 times
- Double source speed
- 18 frames per second
- Color palette restricted to 55 colors
- Resized proportionally to a 300px width
- One source file
Having the configuration in the filename means that if you ever want to re-output or optimise an existing asset you don't need to remember or guess the previous settings.
The filename format is readable enough to understand the output settings at a glance.
- Ease of use
Just rename source file and re-output gif to get the best optimisation result for any given source file.
Check out the example filenames in /example/ dir to see gifle output options.
Separate each option element in the filename with any of these characters:
Settings (all optional):
Sets the output dimensions of the gif, in integer pixel units. Usually set width or height, though always include the
my-movie-x350.movwill resize proportionally to 350px height.
my-movie-222x.movwill resize proportionally to 222px width. Setting both dimensions is not recommended as it will stretch the output unless they are the same aspect ratio as the source. Will use source dimensions if not set.
- frame rate
Set the resultant frame rate in frames per second. If not set will default to 22.
- file size optimisation
Include the term 'crush' eg.
my-movie-12fps-crush.movto attempt to further optimise the output gif to reduce the file size. Uses gifsicle. This is done automatically if you limit the color palette.
- color palette
Limit the color palette eg.
my-movie-100cols-12fps.movto reduce the file size. Provide an integer between 2 and 256. Uses gifsicle which will choose an adaptive group of colors based on the source video.
- playback speed
Adjust the playback speed with a modifier float value. Eg.
my-movie-1.5speed.movwill be 1.5 times as fast as the original. If not set will default to 1.0, same as source.
Sets how many times the gif will loop. Set to
0to loop forever (default).
## Release History
- v1.0.1 - Updated dependencies