1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2025-02-02 11:34:20 +02:00

Flatten image with alpha when saving to jpeg; Make white default background

This commit is contained in:
DarthSim 2018-11-14 17:06:52 +06:00
parent 431dad235c
commit 7ac390621d
2 changed files with 2 additions and 1 deletions

View File

@ -336,7 +336,7 @@ func transformImage(ctx context.Context, img **C.struct__VipsImage, data []byte,
checkTimeout(ctx)
}
if hasAlpha && po.Flatten {
if hasAlpha && (po.Flatten || po.Format == imageTypeJPEG) {
if err = vipsFlatten(img, po.Background); err != nil {
return err
}

View File

@ -702,6 +702,7 @@ func defaultProcessingOptions(headers *processingHeaders) (*processingOptions, e
Enlarge: false,
Quality: conf.Quality,
Format: imageTypeUnknown,
Background: color{255, 255, 255},
Blur: 0,
Sharpen: 0,
Watermark: watermarkOptions{Opacity: 1, Replicate: false, Gravity: gravityCenter},