mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 18:40:16 +02:00
Ensure modulate can co-exist with other colour ops #1958
This commit is contained in:
parent
ff98d2e44a
commit
833aaead56
@ -14,6 +14,9 @@ Requires libvips v8.8.1.
|
||||
[#1952](https://github.com/lovell/sharp/pull/1952)
|
||||
[@pouya-eghbali](https://github.com/pouya-eghbali)
|
||||
|
||||
* Ensure `modulate` and other colour-based operations can co-exist.
|
||||
[#1958](https://github.com/lovell/sharp/issues/1958)
|
||||
|
||||
#### v0.23.2 - 28<sup>th</sup> October 2019
|
||||
|
||||
* Add `background` option to tile output operation.
|
||||
|
@ -191,12 +191,20 @@ namespace sharp {
|
||||
VImage alpha = image[image.bands() - 1];
|
||||
return RemoveAlpha(image)
|
||||
.colourspace(VIPS_INTERPRETATION_LCH)
|
||||
.linear({brightness, saturation, 1}, {0, 0, static_cast<double>(hue)})
|
||||
.linear(
|
||||
{ brightness, saturation, 1},
|
||||
{ 0.0, 0.0, static_cast<double>(hue) }
|
||||
)
|
||||
.colourspace(VIPS_INTERPRETATION_sRGB)
|
||||
.bandjoin(alpha);
|
||||
} else {
|
||||
return image
|
||||
.colourspace(VIPS_INTERPRETATION_LCH)
|
||||
.linear({brightness, saturation, 1}, {0, 0, static_cast<double>(hue)});
|
||||
.linear(
|
||||
{ brightness, saturation, 1 },
|
||||
{ 0.0, 0.0, static_cast<double>(hue) }
|
||||
)
|
||||
.colourspace(VIPS_INTERPRETATION_sRGB);
|
||||
}
|
||||
}
|
||||
|
||||
|
BIN
test/fixtures/expected/modulate-linear.jpg
vendored
Normal file
BIN
test/fixtures/expected/modulate-linear.jpg
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 62 KiB |
@ -122,4 +122,21 @@ describe('Modulate', function () {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('should be able to use linear and modulate together', function () {
|
||||
const base = 'modulate-linear.jpg';
|
||||
const actual = fixtures.path('output.' + base);
|
||||
const expected = fixtures.expected(base);
|
||||
|
||||
const contrast = 1.5;
|
||||
const brightness = 0.5;
|
||||
|
||||
return sharp(fixtures.testPattern)
|
||||
.linear(contrast, -(128 * contrast) + 128)
|
||||
.modulate({ brightness })
|
||||
.toFile(actual)
|
||||
.then(function () {
|
||||
fixtures.assertMaxColourDistance(actual, expected);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user