Gifle
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.
Install gifle
$ npm install gifle -g
Requirements
- Node + npm
- FFmpeg
- Imagemagick
- Gifsicle: only requried for 'crush' command or restricting the color palette
Instructions
Gifle uses the source video filename to configure its output to an animated gif.
Rename your source video to include desired configuration settings:
Eg. Change my-movie.mov
to my-movie-3loops-2speed-18fps-55cols-300x.mov
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
or
$ 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
Why?
- 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. - Readability
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.
Documentation
Check out the example filenames in /example/ dir to see gifle output options.
Filename configuration###
Separate each option element in the filename with any of these characters:
(space),
-
or _
.
Settings (all optional):
- dimensions:
%width%x%height%
Sets the output dimensions of the gif, in integer pixel units. Usually set width or height, though always include thex
char. Eg.my-movie-x350.mov
will resize proportionally to 350px height.my-movie-222x.mov
will 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
%rate%fps
Set the resultant frame rate in frames per second. If not set will default to 22. - file size optimisation
crush
Include the term 'crush' eg.my-movie-12fps-crush.mov
to 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
%count%cols
Limit the color palette eg.my-movie-100cols-12fps.mov
to 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
%modifier%speed
Adjust the playback speed with a modifier float value. Eg.my-movie-1.5speed.mov
will be 1.5 times as fast as the original. If not set will default to 1.0, same as source. - looping
%count%loops
Sets how many times the gif will loop. Set to0
to loop forever (default).
## Release History
- v1.0.1 - Updated dependencies