Skip to content

Commit 3a062bc

Browse files
committed
add --text "AWESOME!"
1 parent 3892ac8 commit 3a062bc

File tree

5 files changed

+29
-2
lines changed

5 files changed

+29
-2
lines changed

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
example/
22
screencast.gif
33
22.gif
4+
back.gif

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ npm install -g gifify
5959
--resize <W:H> Resize output, use -1 when specifying only width or height. `350:100`, `400:-1`, `-1:200`
6060
--speed <n> Movie speed, defaults to 1
6161
--subtitles <filepath> Subtitle filepath to burn to the GIF
62+
--text <string> Add some text at the bottom of the movie
6263
--to <position> End position, hh:mm:ss or seconds, defaults to end of movie
6364
```
6465

@@ -101,6 +102,18 @@ When using direct file input from command line, we pass the `-i filename` option
101102

102103
Be careful when `|piping`.
103104

105+
## Adding some text
106+
107+
You can burn some simple text into your GIF:
108+
109+
```shell
110+
gifify back.mp4 -o back.gif --from 01:48:23.200 --to 01:48:25.300 --text "What?..What?What?"
111+
```
112+
113+
Result:
114+
115+
![back](back.gif)
116+
104117
## Subtitles
105118

106119
You can burn subtitles into your GIF, it's that easy:

back.gif

772 KB
Loading

bin/gifify

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ var options =
2020
.option('--resize <W:H>', 'Resize output, use -1 when specifying only width or height. `350:100`, `400:-1`, `-1:200`')
2121
.option('--speed <n>', 'Movie speed, defaults to 1', parseFloat, 1)
2222
.option('--subtitles <filepath>', 'Subtitle filepath to burn to the GIF')
23+
.option('--text <string>', 'Add some text at the bottom of the movie')
2324
.option('--to <position>', 'End position, hh:mm:ss or seconds, defaults to end of movie'
2425
)
2526
.parse(process.argv);

index.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,15 +136,27 @@ function computeFFmpegArgs(opts) {
136136

137137
function computeConvertArgs(opts) {
138138
// Convert options
139-
// http://www.imagemagick.org/script/convert.php#options
139+
// http://www.imagemagick.rg/script/convert.php#options
140140
var args = [
141141
'-',
142142
'+dither',
143143
'-layers', 'Optimize',
144144
'-delay', 100 / opts.fps / opts.speed,
145-
'gif:-'
146145
];
147146

147+
if (opts.text) {
148+
args.push(
149+
'-gravity', 'South',
150+
'-fill', 'white',
151+
'-stroke', 'black',
152+
'-strokewidth', '1',
153+
'-pointsize', '40',
154+
'-annotate', '+20+20', opts.text
155+
);
156+
}
157+
158+
args.push('gif:-');
159+
148160
debug('convert args: %j', args);
149161

150162
return args;

0 commit comments

Comments
 (0)