Ensure extend op stays sequential when copying px #3928

This commit is contained in:
Lovell Fuller 2024-01-04 09:24:41 +00:00
parent 4aacee8055
commit 9bcf399b4c
3 changed files with 18 additions and 0 deletions

View File

@ -10,6 +10,9 @@ Requires libvips v8.15.0
[#3914](https://github.com/lovell/sharp/pull/3914)
[@abhi0498](https://github.com/abhi0498)
* Ensure `extend` operation stays sequential when copying (regression in 0.32.0).
[#3928](https://github.com/lovell/sharp/issues/3928)
### v0.33.1 - 17th December 2023
* Add support for Yarn Plug'n'Play filesystem layout.

View File

@ -561,6 +561,7 @@ class PipelineWorker : public Napi::AsyncWorker {
VImage::option()->set("extend", baton->extendWith)->set("background", background));
} else {
std::vector<double> ignoredBackground(1);
image = sharp::StaySequential(image, baton->input->access);
image = nPages > 1
? sharp::EmbedMultiPage(image,
baton->extendLeft, baton->extendTop, baton->width, baton->height,

View File

@ -73,6 +73,20 @@ describe('Extend', function () {
});
});
it('extend top with mirroring uses ordered read', async () => {
const data = await sharp(fixtures.inputJpg)
.extend({
extendWith: 'mirror',
top: 1
})
.png({ compressionLevel: 0 })
.toBuffer();
const { width, height } = await sharp(data).metadata();
assert.strictEqual(2725, width);
assert.strictEqual(2226, height);
});
it(`extend sides unequally with RGBA (${extendWith})`, function (done) {
sharp(fixtures.inputPngWithTransparency16bit)
.resize(120)