mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Support modulate op with non-sRGB pipeline colourspace #3620
This commit is contained in:
@@ -186,6 +186,7 @@ namespace sharp {
|
||||
|
||||
VImage Modulate(VImage image, double const brightness, double const saturation,
|
||||
int const hue, double const lightness) {
|
||||
VipsInterpretation colourspaceBeforeModulate = image.interpretation();
|
||||
if (HasAlpha(image)) {
|
||||
// Separate alpha channel
|
||||
VImage alpha = image[image.bands() - 1];
|
||||
@@ -195,7 +196,7 @@ namespace sharp {
|
||||
{ brightness, saturation, 1},
|
||||
{ lightness, 0.0, static_cast<double>(hue) }
|
||||
)
|
||||
.colourspace(VIPS_INTERPRETATION_sRGB)
|
||||
.colourspace(colourspaceBeforeModulate)
|
||||
.bandjoin(alpha);
|
||||
} else {
|
||||
return image
|
||||
@@ -204,7 +205,7 @@ namespace sharp {
|
||||
{ brightness, saturation, 1 },
|
||||
{ lightness, 0.0, static_cast<double>(hue) }
|
||||
)
|
||||
.colourspace(VIPS_INTERPRETATION_sRGB);
|
||||
.colourspace(colourspaceBeforeModulate);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user