Skip to content

Commit

Permalink
Ensure extend op stays sequential when copying px #3928
Browse files Browse the repository at this point in the history
  • Loading branch information
lovell committed Jan 4, 2024
1 parent 4aacee8 commit 9bcf399
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/changelog.md
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions src/pipeline.cc
Expand Up @@ -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,
Expand Down
14 changes: 14 additions & 0 deletions test/unit/extend.js
Expand Up @@ -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)
Expand Down

0 comments on commit 9bcf399

Please sign in to comment.