Skip to content

Commit

Permalink
Support avif
Browse files Browse the repository at this point in the history
  • Loading branch information
papandreou committed Dec 24, 2020
1 parent 38e115e commit 90e47f6
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/engines/sharp.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ module.exports = {
'optimizeScans',
'optimiseScans',
],
inputTypes: ['jpeg', 'png', 'webp', 'svg', 'tiff', '*'],
outputTypes: ['jpeg', 'png', 'webp', 'tiff', 'dzi'],
inputTypes: ['jpeg', 'png', 'webp', 'svg', 'tiff', 'avif', '*'],
outputTypes: ['jpeg', 'png', 'webp', 'tiff', 'dzi', 'avif'],
validateOperation: function (name, args) {
switch (name) {
case 'crop':
Expand Down
27 changes: 27 additions & 0 deletions test/impro.js
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,33 @@ describe('impro', () => {
});
});
});

it('should support avif as a source format', async () => {
await expect(
'cosmos_frame12924_yuv420_10bpc_bt2020_pq_q50.avif',
'when piped through',
impro.sharp().resize(10, 10).jpeg().flush(),
'to yield output satisfying to have metadata satisfying',
{
format: 'JPEG',
size: { width: 10 },
}
);
});

it('should support avif as a target format', async () => {
await expect(
'turtle.jpg',
'when piped through',
impro.sharp().resize(10, 10).avif().flush(),
'to yield output satisfying',
'when decoded as',
'ascii',
'to match',
// eslint-disable-next-line no-control-regex
/^\x00{3}\x18ftypavif/
);
});
});

describe('with the gifsicle engine', () => {
Expand Down
Binary file not shown.

0 comments on commit 90e47f6

Please sign in to comment.