mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Ensure extend op is sequential for multi-page TIFF #4069
This commit is contained in:
@@ -73,20 +73,6 @@ 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)
|
||||
@@ -127,6 +113,39 @@ 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('multi-page extend uses ordered read', async () => {
|
||||
const multiPageTiff = await sharp(fixtures.inputGifAnimated, { animated: true })
|
||||
.resize({ width: 8, height: 48 })
|
||||
.tiff()
|
||||
.toBuffer();
|
||||
|
||||
const data = await sharp(multiPageTiff, { pages: -1 })
|
||||
.extend({
|
||||
background: 'red',
|
||||
top: 1
|
||||
})
|
||||
.png({ compressionLevel: 0 })
|
||||
.toBuffer();
|
||||
|
||||
const { width, height } = await sharp(data).metadata();
|
||||
assert.strictEqual(8, width);
|
||||
assert.strictEqual(1470, height);
|
||||
});
|
||||
|
||||
it('missing parameter fails', function () {
|
||||
assert.throws(function () {
|
||||
sharp().extend();
|
||||
|
||||
Reference in New Issue
Block a user