mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Ensure background metadata can be parsed #4090
This commit is contained in:
@@ -201,6 +201,48 @@ describe('Image metadata', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('PNG with greyscale bKGD chunk - 8 bit', async () => {
|
||||
const data = await sharp(fixtures.inputPng8BitGreyBackground).metadata();
|
||||
assert.deepStrictEqual(data, {
|
||||
background: {
|
||||
gray: 0
|
||||
},
|
||||
bitsPerSample: 8,
|
||||
channels: 2,
|
||||
density: 72,
|
||||
depth: 'uchar',
|
||||
format: 'png',
|
||||
hasAlpha: true,
|
||||
hasProfile: false,
|
||||
height: 32,
|
||||
isPalette: false,
|
||||
isProgressive: false,
|
||||
space: 'b-w',
|
||||
width: 32
|
||||
});
|
||||
});
|
||||
|
||||
it('PNG with greyscale bKGD chunk - 16 bit', async () => {
|
||||
const data = await sharp(fixtures.inputPng16BitGreyBackground).metadata();
|
||||
assert.deepStrictEqual(data, {
|
||||
background: {
|
||||
gray: 67
|
||||
},
|
||||
bitsPerSample: 16,
|
||||
channels: 2,
|
||||
density: 72,
|
||||
depth: 'ushort',
|
||||
format: 'png',
|
||||
hasAlpha: true,
|
||||
hasProfile: false,
|
||||
height: 32,
|
||||
isPalette: false,
|
||||
isProgressive: false,
|
||||
space: 'grey16',
|
||||
width: 32
|
||||
});
|
||||
});
|
||||
|
||||
it('WebP', function (done) {
|
||||
sharp(fixtures.inputWebP).metadata(function (err, metadata) {
|
||||
if (err) throw err;
|
||||
|
||||
Reference in New Issue
Block a user