mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Add isPalette and bitsPerSample metadata, deprecate paletteBitDepth
This commit is contained in:
@@ -34,6 +34,7 @@ describe('AVIF', () => {
|
||||
// Math.round(13.40625) = 13
|
||||
height: 13,
|
||||
isProgressive: false,
|
||||
isPalette: false,
|
||||
space: 'srgb',
|
||||
width: 32
|
||||
});
|
||||
@@ -55,6 +56,8 @@ describe('AVIF', () => {
|
||||
hasProfile: false,
|
||||
height: 26,
|
||||
isProgressive: false,
|
||||
isPalette: false,
|
||||
bitsPerSample: 8,
|
||||
pagePrimary: 0,
|
||||
pages: 1,
|
||||
space: 'srgb',
|
||||
@@ -77,6 +80,8 @@ describe('AVIF', () => {
|
||||
hasProfile: false,
|
||||
height: 13,
|
||||
isProgressive: false,
|
||||
isPalette: false,
|
||||
bitsPerSample: 8,
|
||||
pagePrimary: 0,
|
||||
pages: 1,
|
||||
space: 'srgb',
|
||||
@@ -100,6 +105,8 @@ describe('AVIF', () => {
|
||||
hasProfile: false,
|
||||
height: 300,
|
||||
isProgressive: false,
|
||||
isPalette: false,
|
||||
bitsPerSample: 8,
|
||||
pagePrimary: 0,
|
||||
pages: 1,
|
||||
space: 'srgb',
|
||||
@@ -124,6 +131,8 @@ describe('AVIF', () => {
|
||||
hasProfile: false,
|
||||
height: 26,
|
||||
isProgressive: false,
|
||||
isPalette: false,
|
||||
bitsPerSample: 8,
|
||||
pagePrimary: 0,
|
||||
pages: 1,
|
||||
space: 'srgb',
|
||||
|
||||
@@ -878,6 +878,8 @@ describe('Image metadata', function () {
|
||||
channels: 3,
|
||||
depth: 'uchar',
|
||||
isProgressive: false,
|
||||
isPalette: false,
|
||||
bitsPerSample: 8,
|
||||
pages: 1,
|
||||
pagePrimary: 0,
|
||||
compression: 'av1',
|
||||
|
||||
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user