mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 18:40:16 +02:00
Improve perf of ops that introduce non-opaque background #3465
This commit is contained in:
parent
0265d305fe
commit
9d760f3958
@ -18,6 +18,9 @@ Requires libvips v8.13.3
|
|||||||
* Ignore `sequentialRead` option when calculating image statistics.
|
* Ignore `sequentialRead` option when calculating image statistics.
|
||||||
[#3462](https://github.com/lovell/sharp/issues/3462)
|
[#3462](https://github.com/lovell/sharp/issues/3462)
|
||||||
|
|
||||||
|
* Small performance improvement for operations that introduce a non-opaque background.
|
||||||
|
[#3465](https://github.com/lovell/sharp/issues/3465)
|
||||||
|
|
||||||
* Ensure integral output of `linear` operation.
|
* Ensure integral output of `linear` operation.
|
||||||
[#3468](https://github.com/lovell/sharp/issues/3468)
|
[#3468](https://github.com/lovell/sharp/issues/3468)
|
||||||
|
|
||||||
|
@ -913,7 +913,7 @@ namespace sharp {
|
|||||||
// Add non-transparent alpha channel, if required
|
// Add non-transparent alpha channel, if required
|
||||||
if (colour[3] < 255.0 && !HasAlpha(image)) {
|
if (colour[3] < 255.0 && !HasAlpha(image)) {
|
||||||
image = image.bandjoin(
|
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);
|
return std::make_tuple(image, alphaColour);
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ describe('Rotation', function () {
|
|||||||
it('Rotate by 30 degrees with solid background', function (done) {
|
it('Rotate by 30 degrees with solid background', function (done) {
|
||||||
sharp(fixtures.inputJpg)
|
sharp(fixtures.inputJpg)
|
||||||
.resize(320)
|
.resize(320)
|
||||||
.rotate(30, { background: { r: 255, g: 0, b: 0, alpha: 0.5 } })
|
.rotate(30, { background: { r: 255, g: 0, b: 0 } })
|
||||||
.toBuffer(function (err, data, info) {
|
.toBuffer(function (err, data, info) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
assert.strictEqual('jpeg', info.format);
|
assert.strictEqual('jpeg', info.format);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user