0
Fork 0
mirror of https://github.com/willnorris/imageproxy.git synced 2024-12-16 21:56:43 -05:00

use quality option for webp

This commit is contained in:
Will Norris 2024-05-08 20:41:19 -07:00
parent 0a89d43f75
commit 1a61589ad6

View file

@ -108,8 +108,12 @@ func Transform(img []byte, opt Options) ([]byte, error) {
return nil, err return nil, err
} }
case "webp": case "webp":
quality := opt.Quality
if quality == 0 {
quality = defaultQuality
}
m = transformImage(m, opt) m = transformImage(m, opt)
err = webp.Encode(buf, m) err = webp.Encode(buf, m, webp.Quality(float32(quality)/100))
if err != nil { if err != nil {
return nil, err return nil, err
} }