Improve perf of ops that introduce non-opaque background #3465

This commit is contained in:
Lovell Fuller
2022-12-05 20:40:41 +00:00
parent 0265d305fe
commit 9d760f3958
3 changed files with 5 additions and 2 deletions

View File

@@ -913,7 +913,7 @@ namespace sharp {
// Add non-transparent alpha channel, if required
if (colour[3] < 255.0 && !HasAlpha(image)) {
image = image.bandjoin(
VImage::new_matrix(image.width(), image.height()).new_from_image(255 * multiplier));
VImage::new_matrix(image.width(), image.height()).new_from_image(255 * multiplier).cast(image.format()));
}
return std::make_tuple(image, alphaColour);
}