mirror of
https://github.com/lovell/sharp.git
synced 2026-02-09 16:16:16 +01:00
Allow ensureAlpha to set alpha transparency level #2634
This commit is contained in:
@@ -799,10 +799,10 @@ namespace sharp {
|
||||
/*
|
||||
Ensures alpha channel, if missing.
|
||||
*/
|
||||
VImage EnsureAlpha(VImage image) {
|
||||
VImage EnsureAlpha(VImage image, double const value) {
|
||||
if (!HasAlpha(image)) {
|
||||
std::vector<double> alpha;
|
||||
alpha.push_back(sharp::MaximumImageAlpha(image.interpretation()));
|
||||
alpha.push_back(value * sharp::MaximumImageAlpha(image.interpretation()));
|
||||
image = image.bandjoin_const(alpha);
|
||||
}
|
||||
return image;
|
||||
|
||||
Reference in New Issue
Block a user