diff --git a/docs/changelog.md b/docs/changelog.md index 4286bff3a..4be464821 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -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. diff --git a/src/pipeline.cc b/src/pipeline.cc index 198a7364c..3e76cf8bf 100644 --- a/src/pipeline.cc +++ b/src/pipeline.cc @@ -561,6 +561,7 @@ class PipelineWorker : public Napi::AsyncWorker { VImage::option()->set("extend", baton->extendWith)->set("background", background)); } else { std::vector ignoredBackground(1); + image = sharp::StaySequential(image, baton->input->access); image = nPages > 1 ? sharp::EmbedMultiPage(image, baton->extendLeft, baton->extendTop, baton->width, baton->height, diff --git a/test/unit/extend.js b/test/unit/extend.js index c06b709ad..4d57ba977 100644 --- a/test/unit/extend.js +++ b/test/unit/extend.js @@ -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)