Browse Source

Always flatten if the resulting format does not support alpha

DarthSim 4 years ago
parent
commit
98ee337b00
1 changed files with 1 additions and 1 deletions
  1. 1 1
      process.go

+ 1 - 1
process.go

@@ -432,7 +432,7 @@ func transformImage(ctx context.Context, img *vipsImage, data []byte, po *proces
 
 
 	transparrentBg := po.Format.SupportsAlpha() && !po.Flatten
 	transparrentBg := po.Format.SupportsAlpha() && !po.Flatten
 
 
-	if hasAlpha && (po.Flatten || po.Format == imageTypeJPEG) {
+	if hasAlpha && !transparrentBg {
 		if err = img.Flatten(po.Background); err != nil {
 		if err = img.Flatten(po.Background); err != nil {
 			return err
 			return err
 		}
 		}