Skip to content

Commit

Permalink
fix: border issue on GIFs where terminal height does not match perfec…
Browse files Browse the repository at this point in the history
…tly with pixel height (rows)
  • Loading branch information
maaslalani committed Oct 20, 2022
1 parent 26f01da commit 045bd7e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions examples/commands/arrow.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 4 additions & 3 deletions video.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,11 @@ func MakeGIF(opts VideoOptions) *exec.Cmd {
"-framerate", fmt.Sprint(opts.Framerate),
"-i", opts.Input+cursorFrameFormat,
"-filter_complex",
fmt.Sprintf(`[0][1]overlay[merged];[merged]scale=%d:%d[scaled];[scaled]pad=width=%d:height=%d:x=%d:y=%d[padded];[padded]fillborders=left=%d:right=%d:top=%d:bottom=%d:mode=fixed:color=%s[bordered];[bordered]split[a][b];[a]palettegen=max_colors=256[p];[b][p]paletteuse[out]`,
opts.Width-2*opts.Padding, opts.Height-2*opts.Padding,
fmt.Sprintf(`[0][1]overlay[merged];[merged]scale=%d:-1[scaled];[scaled]pad=%d:%d:(ow-iw)/2:(oh-ih)/2:%s[padded];[padded]fillborders=left=%d:right=%d:top=%d:bottom=%d:mode=fixed:color=%s[bordered];[bordered]split[a][b];[a]palettegen=max_colors=256[p];[b][p]paletteuse[out]`,
opts.Width-2*opts.Padding,
opts.Width, opts.Height,
opts.Padding, opts.Padding, opts.Padding, opts.Padding, opts.Padding, opts.Padding,
opts.BackgroundColor,
opts.Padding, opts.Padding, opts.Padding, opts.Padding,
opts.BackgroundColor,
),
"-map", "[out]",
Expand Down

0 comments on commit 045bd7e

Please sign in to comment.