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:
parent
0a89d43f75
commit
1a61589ad6
1 changed files with 5 additions and 1 deletions
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue