-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add experimental support for JPEG-XL, requires libvips with libjxl
The prebuilt binaries do not include support for this format.
- Loading branch information
Showing
11 changed files
with
253 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
'use strict'; | ||
|
||
const assert = require('assert'); | ||
|
||
const sharp = require('../../'); | ||
|
||
describe('JXL', () => { | ||
it('called without options does not throw an error', () => { | ||
assert.doesNotThrow(() => { | ||
sharp().jxl(); | ||
}); | ||
}); | ||
it('valid distance does not throw an error', () => { | ||
assert.doesNotThrow(() => { | ||
sharp().jxl({ distance: 2.3 }); | ||
}); | ||
}); | ||
it('invalid distance should throw an error', () => { | ||
assert.throws(() => { | ||
sharp().jxl({ distance: 15.1 }); | ||
}); | ||
}); | ||
it('non-numeric distance should throw an error', () => { | ||
assert.throws(() => { | ||
sharp().jxl({ distance: 'fail' }); | ||
}); | ||
}); | ||
it('valid quality > 30 does not throw an error', () => { | ||
const s = sharp(); | ||
assert.doesNotThrow(() => { | ||
s.jxl({ quality: 80 }); | ||
}); | ||
assert.strictEqual(s.options.jxlDistance, 1.9); | ||
}); | ||
it('valid quality < 30 does not throw an error', () => { | ||
const s = sharp(); | ||
assert.doesNotThrow(() => { | ||
s.jxl({ quality: 20 }); | ||
}); | ||
assert.strictEqual(s.options.jxlDistance, 9.066666666666666); | ||
}); | ||
it('valid quality does not throw an error', () => { | ||
assert.doesNotThrow(() => { | ||
sharp().jxl({ quality: 80 }); | ||
}); | ||
}); | ||
it('invalid quality should throw an error', () => { | ||
assert.throws(() => { | ||
sharp().jxl({ quality: 101 }); | ||
}); | ||
}); | ||
it('non-numeric quality should throw an error', () => { | ||
assert.throws(() => { | ||
sharp().jxl({ quality: 'fail' }); | ||
}); | ||
}); | ||
it('valid decodingTier does not throw an error', () => { | ||
assert.doesNotThrow(() => { | ||
sharp().jxl({ decodingTier: 2 }); | ||
}); | ||
}); | ||
it('invalid decodingTier should throw an error', () => { | ||
assert.throws(() => { | ||
sharp().jxl({ decodingTier: 5 }); | ||
}); | ||
}); | ||
it('non-numeric decodingTier should throw an error', () => { | ||
assert.throws(() => { | ||
sharp().jxl({ decodingTier: 'fail' }); | ||
}); | ||
}); | ||
it('valid lossless does not throw an error', () => { | ||
assert.doesNotThrow(() => { | ||
sharp().jxl({ lossless: true }); | ||
}); | ||
}); | ||
it('non-boolean lossless should throw an error', () => { | ||
assert.throws(() => { | ||
sharp().jxl({ lossless: 'fail' }); | ||
}); | ||
}); | ||
it('valid effort does not throw an error', () => { | ||
assert.doesNotThrow(() => { | ||
sharp().jxl({ effort: 6 }); | ||
}); | ||
}); | ||
it('out of range effort should throw an error', () => { | ||
assert.throws(() => { | ||
sharp().jxl({ effort: 10 }); | ||
}); | ||
}); | ||
it('invalid effort should throw an error', () => { | ||
assert.throws(() => { | ||
sharp().jxl({ effort: 'fail' }); | ||
}); | ||
}); | ||
}); |