Merge pull request #333 from nickago/MM-1181

MM-1181 Drawing all images onto a white background, thus removing transparency
Этот коммит содержится в:
Christopher Speller
2015-08-06 10:28:53 -04:00
родитель f3c5b67588 530d498141
Коммит 41adcc8305

Просмотреть файл

@@ -15,6 +15,8 @@ import (
"github.com/nfnt/resize" "github.com/nfnt/resize"
_ "golang.org/x/image/bmp" _ "golang.org/x/image/bmp"
"image" "image"
"image/color"
"image/draw"
_ "image/gif" _ "image/gif"
"image/jpeg" "image/jpeg"
"io" "io"
@@ -138,6 +140,12 @@ func fireAndForgetHandleImages(filenames []string, fileData [][]byte, teamId, ch
return return
} }
// Remove transparency due to JPEG's lack of support of it
temp := image.NewRGBA(img.Bounds())
draw.Draw(temp, temp.Bounds(), image.NewUniform(color.White), image.Point{}, draw.Src)
draw.Draw(temp, temp.Bounds(), img, img.Bounds().Min, draw.Over)
img = temp
// Create thumbnail // Create thumbnail
go func() { go func() {
thumbWidth := float64(utils.Cfg.ImageSettings.ThumbnailWidth) thumbWidth := float64(utils.Cfg.ImageSettings.ThumbnailWidth)