mirror of
https://github.com/lovell/sharp.git
synced 2026-02-04 05:36:18 +01:00
Encoding lossless AVIF is mutually exclusive with iq tuning
This commit is contained in:
@@ -7,7 +7,7 @@ const { describe, it } = require('node:test');
|
||||
const assert = require('node:assert');
|
||||
|
||||
const sharp = require('../../');
|
||||
const { inputAvif, inputJpg, inputGifAnimated } = require('../fixtures');
|
||||
const { inputAvif, inputJpg, inputGifAnimated, inputPng } = require('../fixtures');
|
||||
|
||||
describe('AVIF', () => {
|
||||
it('called without options does not throw an error', () => {
|
||||
@@ -74,6 +74,35 @@ describe('AVIF', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('can convert PNG to lossless AVIF', async () => {
|
||||
const data = await sharp(inputPng)
|
||||
.resize(32)
|
||||
.avif({ lossless: true, effort: 0 })
|
||||
.toBuffer();
|
||||
const { size, ...metadata } = await sharp(data).metadata();
|
||||
void size;
|
||||
assert.deepStrictEqual(metadata, {
|
||||
autoOrient: {
|
||||
height: 24,
|
||||
width: 32
|
||||
},
|
||||
channels: 3,
|
||||
compression: 'av1',
|
||||
depth: 'uchar',
|
||||
format: 'heif',
|
||||
hasAlpha: false,
|
||||
hasProfile: false,
|
||||
height: 24,
|
||||
isProgressive: false,
|
||||
isPalette: false,
|
||||
bitsPerSample: 8,
|
||||
pagePrimary: 0,
|
||||
pages: 1,
|
||||
space: 'srgb',
|
||||
width: 32
|
||||
});
|
||||
});
|
||||
|
||||
it('can passthrough AVIF', async () => {
|
||||
const data = await sharp(inputAvif)
|
||||
.resize(32)
|
||||
|
||||
Reference in New Issue
Block a user