From 1a61589ad6a42f9efa6ab4772769d63aada23bce Mon Sep 17 00:00:00 2001 From: Will Norris Date: Wed, 8 May 2024 20:41:19 -0700 Subject: [PATCH] use quality option for webp --- transform.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/transform.go b/transform.go index 80870215..abb9ebb9 100644 --- a/transform.go +++ b/transform.go @@ -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 }