Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(vips): filter max_frames(n) #195

Merged
merged 2 commits into from
Oct 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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