mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Ensure fit=contain resizing supports multiple alpha channels #4382
This commit is contained in:
@@ -1001,9 +1001,11 @@ namespace sharp {
|
||||
0.0722 * colour[2])
|
||||
};
|
||||
}
|
||||
// Add alpha channel to alphaColour colour
|
||||
// Add alpha channel(s) to alphaColour colour
|
||||
if (colour[3] < 255.0 || image.has_alpha()) {
|
||||
alphaColour.push_back(colour[3] * multiplier);
|
||||
do {
|
||||
alphaColour.push_back(colour[3] * multiplier);
|
||||
} while (alphaColour.size() < static_cast<size_t>(image.bands()));
|
||||
}
|
||||
// Ensure alphaColour colour uses correct colourspace
|
||||
alphaColour = sharp::GetRgbaAsColourspace(alphaColour, image.interpretation(), premultiply);
|
||||
|
||||
Reference in New Issue
Block a user