mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Ensure RGBA LZW TIFF info.channel count #2064
This commit is contained in:
@@ -208,11 +208,48 @@ describe('TIFF', function () {
|
||||
.toFile(fixtures.outputTiff, (err, info) => {
|
||||
if (err) throw err;
|
||||
assert.strictEqual('tiff', info.format);
|
||||
assert.strictEqual(3, info.channels);
|
||||
assert(info.size < startSize);
|
||||
rimraf(fixtures.outputTiff, done);
|
||||
});
|
||||
});
|
||||
|
||||
it('TIFF LZW RGBA toFile', () =>
|
||||
sharp({
|
||||
create: {
|
||||
width: 1,
|
||||
height: 1,
|
||||
channels: 4,
|
||||
background: 'red'
|
||||
}
|
||||
})
|
||||
.tiff({
|
||||
compression: 'lzw'
|
||||
})
|
||||
.toFile(fixtures.outputTiff)
|
||||
.then(info => {
|
||||
assert.strictEqual(4, info.channels);
|
||||
})
|
||||
);
|
||||
|
||||
it('TIFF LZW RGBA toBuffer', () =>
|
||||
sharp({
|
||||
create: {
|
||||
width: 1,
|
||||
height: 1,
|
||||
channels: 4,
|
||||
background: 'red'
|
||||
}
|
||||
})
|
||||
.tiff({
|
||||
compression: 'lzw'
|
||||
})
|
||||
.toBuffer({ resolveWithObject: true })
|
||||
.then(({ info }) => {
|
||||
assert.strictEqual(4, info.channels);
|
||||
})
|
||||
);
|
||||
|
||||
it('TIFF ccittfax4 compression shrinks b-w test file', function (done) {
|
||||
const startSize = fs.statSync(fixtures.inputTiff).size;
|
||||
sharp(fixtures.inputTiff)
|
||||
|
||||
Reference in New Issue
Block a user