Skip to content

Commit 2e64cbc

Browse files
committed
use quality option for webp
1 parent 0a89d43 commit 2e64cbc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

transform.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,12 @@ func Transform(img []byte, opt Options) ([]byte, error) {
108108
return nil, err
109109
}
110110
case "webp":
111+
quality := opt.Quality
112+
if quality == 0 {
113+
quality = defaultQuality
114+
}
111115
m = transformImage(m, opt)
112-
err = webp.Encode(buf, m)
116+
err = webp.Encode(buf, m, webp.Quality(float32(quality/100)))
113117
if err != nil {
114118
return nil, err
115119
}

0 commit comments

Comments
 (0)