mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 18:40:16 +02:00
Prevent over-compute in affine rotate #3722
This commit is contained in:
parent
0da55bab7e
commit
14c3346800
@ -16,6 +16,9 @@ Requires libvips v8.14.2
|
|||||||
[#3674](https://github.com/lovell/sharp/pull/3674)
|
[#3674](https://github.com/lovell/sharp/pull/3674)
|
||||||
[@bianjunjie1981](https://github.com/bianjunjie1981)
|
[@bianjunjie1981](https://github.com/bianjunjie1981)
|
||||||
|
|
||||||
|
* Prevent over-compute in affine-based rotate before resize.
|
||||||
|
[#3722](https://github.com/lovell/sharp/issues/3722)
|
||||||
|
|
||||||
### v0.32.1 - 27th April 2023
|
### v0.32.1 - 27th April 2023
|
||||||
|
|
||||||
* Add experimental `unflatten` operation.
|
* Add experimental `unflatten` operation.
|
||||||
|
@ -116,7 +116,7 @@ class PipelineWorker : public Napi::AsyncWorker {
|
|||||||
MultiPageUnsupported(nPages, "Rotate");
|
MultiPageUnsupported(nPages, "Rotate");
|
||||||
std::vector<double> background;
|
std::vector<double> background;
|
||||||
std::tie(image, background) = sharp::ApplyAlpha(image, baton->rotationBackground, FALSE);
|
std::tie(image, background) = sharp::ApplyAlpha(image, baton->rotationBackground, FALSE);
|
||||||
image = image.rotate(baton->rotationAngle, VImage::option()->set("background", background));
|
image = image.rotate(baton->rotationAngle, VImage::option()->set("background", background)).cache();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -473,4 +473,20 @@ describe('Rotation', function () {
|
|||||||
assert.strictEqual(g, 64);
|
assert.strictEqual(g, 64);
|
||||||
assert.strictEqual(b, 30);
|
assert.strictEqual(b, 30);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('Resize after affine-based rotation does not overcompute', async () =>
|
||||||
|
sharp({
|
||||||
|
create: {
|
||||||
|
width: 4640,
|
||||||
|
height: 2610,
|
||||||
|
channels: 3,
|
||||||
|
background: 'black'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.rotate(28)
|
||||||
|
.resize({ width: 640, height: 360 })
|
||||||
|
.raw()
|
||||||
|
.timeout({ seconds: 5 })
|
||||||
|
.toBuffer()
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user