0
Fork 0
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:
Will Norris 2014-11-19 21:59:12 -08:00
parent 1bf3ccab06
commit c5b279b947

View file

@ -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)
} }