Skip to content

Commit

Permalink
use quality option for webp
Browse files Browse the repository at this point in the history
  • Loading branch information
willnorris committed May 9, 2024
1 parent 0a89d43 commit 1a61589
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion transform.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,12 @@ func Transform(img []byte, opt Options) ([]byte, error) {
return nil, err
}
case "webp":
quality := opt.Quality
if quality == 0 {
quality = defaultQuality
}
m = transformImage(m, opt)
err = webp.Encode(buf, m)
err = webp.Encode(buf, m, webp.Quality(float32(quality)/100))
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 1a61589

Please sign in to comment.