Add isPalette and bitsPerSample metadata, deprecate paletteBitDepth

This commit is contained in:
Lovell Fuller
2024-10-29 09:11:19 +00:00
parent 6480a94181
commit 3154af776e
9 changed files with 42 additions and 9 deletions

View File

@@ -146,6 +146,8 @@ describe('PNG', function () {
density: 72,
depth: 'uchar',
isProgressive: false,
isPalette: true,
bitsPerSample: 8,
paletteBitDepth: 8,
hasProfile: false,
hasAlpha: false
@@ -218,8 +220,10 @@ describe('PNG', function () {
.png({ colours: 2, palette: false })
.toBuffer();
const { channels, paletteBitDepth, size, space } = await sharp(data).metadata();
const { channels, isPalette, bitsPerSample, paletteBitDepth, size, space } = await sharp(data).metadata();
assert.strictEqual(channels, 1);
assert.strictEqual(isPalette, false);
assert.strictEqual(bitsPerSample, 1);
assert.strictEqual(paletteBitDepth, undefined);
assert.strictEqual(size, 89);
assert.strictEqual(space, 'b-w');