Skip to content

Commit

Permalink
feat(vips): filter max_frames(n) (#195)
Browse files Browse the repository at this point in the history
* feat(vips): filter max_frames(n)

* test: update golden files
  • Loading branch information
cshum authored Oct 6, 2022
1 parent f5efd67 commit 5b3e578
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion vips/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func (v *Processor) watermark(ctx context.Context, img *Image, load imagor.LoadF
return
}

func frames(ctx context.Context, img *Image, _ imagor.LoadFunc, args ...string) (err error) {
func frames(_ context.Context, img *Image, _ imagor.LoadFunc, args ...string) (err error) {
ln := len(args)
if ln == 0 {
return
Expand Down
5 changes: 5 additions & 0 deletions vips/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ func (v *Processor) Process(
}
}
break
case "max_frames":
if n, _ := strconv.Atoi(p.Args); n > 0 {
maxN = n
}
break
case "stretch":
stretch = true
break
Expand Down
1 change: 1 addition & 0 deletions vips/processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ func TestProcessor(t *testing.T) {
{name: "original no animate", path: "filters:fill(white):format(jpeg)/dancing-banana.gif"},
{name: "original animated", path: "dancing-banana.gif"},
{name: "original animated quality", path: "filters:quality(60)/dancing-banana.gif"},
{name: "original animated max_frames", path: "filters:max_frames(3)/dancing-banana.gif"},
{name: "rotate animated", path: "fit-in/100x150/filters:rotate(90):fill(yellow)/dancing-banana.gif"},
{name: "crop animated", path: "30x20:100x150/dancing-banana.gif"},
{name: "crop-percent animated", path: "0.1x0.2:0.89x0.72/dancing-banana.gif"},
Expand Down

0 comments on commit 5b3e578

Please sign in to comment.