diff --git a/go/images/resizing.go b/go/images/resizing.go index 1f4b71fd4..d130163f9 100644 --- a/go/images/resizing.go +++ b/go/images/resizing.go @@ -11,6 +11,11 @@ import ( "github.com/disintegration/imaging" ) +const defaultJpegQuality = 85 + +// TODO resize image with vipsthumbnail +// use `/dev/shm` as memory file system + func Resized(ext string, data []byte, width, height int) (resized []byte, w int, h int) { if width == 0 && height == 0 { return data, 0, 0 @@ -34,7 +39,7 @@ func Resized(ext string, data []byte, width, height int) (resized []byte, w int, case ".png": png.Encode(&buf, dstImage) case ".jpg", ".jpeg": - jpeg.Encode(&buf, dstImage, nil) + jpeg.Encode(&buf, dstImage, &jpeg.Options{Quality: defaultJpegQuality}) case ".gif": gif.Encode(&buf, dstImage, nil) }