mirror of
https://github.com/willnorris/imageproxy.git
synced 2024-12-16 21:56:43 -05:00
move jpeg quality to const
This commit is contained in:
parent
1bf3ccab06
commit
c5b279b947
1 changed files with 4 additions and 1 deletions
|
@ -25,6 +25,9 @@ import (
|
||||||
"github.com/disintegration/imaging"
|
"github.com/disintegration/imaging"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// compression quality of resized jpegs
|
||||||
|
const jpegQuality = 95
|
||||||
|
|
||||||
// Transform the provided image.
|
// Transform the provided image.
|
||||||
func Transform(img []byte, opt *Options) ([]byte, error) {
|
func Transform(img []byte, opt *Options) ([]byte, error) {
|
||||||
if opt == nil || reflect.DeepEqual(opt, emptyOptions) {
|
if opt == nil || reflect.DeepEqual(opt, emptyOptions) {
|
||||||
|
@ -98,7 +101,7 @@ func Transform(img []byte, opt *Options) ([]byte, error) {
|
||||||
case "gif":
|
case "gif":
|
||||||
gif.Encode(buf, m, nil)
|
gif.Encode(buf, m, nil)
|
||||||
case "jpeg":
|
case "jpeg":
|
||||||
jpeg.Encode(buf, m, &jpeg.Options{95})
|
jpeg.Encode(buf, m, &jpeg.Options{Quality: jpegQuality})
|
||||||
case "png":
|
case "png":
|
||||||
png.Encode(buf, m)
|
png.Encode(buf, m)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue