Expose new libvips/libjxl features (animation, EXIF)

Requires libvips compiled with support for libjxl
This commit is contained in:
Lovell Fuller
2024-10-29 15:04:14 +00:00
parent 8afec170ed
commit 3796dd8a87
3 changed files with 10 additions and 9 deletions

View File

@@ -1127,8 +1127,6 @@ function heif (options) {
* The prebuilt binaries do not include this - see
* {@link https://sharp.pixelplumbing.com/install#custom-libvips installing a custom libvips}.
*
* Image metadata (EXIF, XMP) is unsupported.
*
* @since 0.31.3
*
* @param {Object} [options] - output options
@@ -1136,7 +1134,9 @@ function heif (options) {
* @param {number} [options.quality] - calculate `distance` based on JPEG-like quality, between 1 and 100, overrides distance if specified
* @param {number} [options.decodingTier=0] - target decode speed tier, between 0 (highest quality) and 4 (lowest quality)
* @param {boolean} [options.lossless=false] - use lossless compression
* @param {number} [options.effort=7] - CPU effort, between 3 (fastest) and 9 (slowest)
* @param {number} [options.effort=7] - CPU effort, between 1 (fastest) and 9 (slowest)
* @param {number} [options.loop=0] - number of animation iterations, use 0 for infinite animation
* @param {number|number[]} [options.delay] - delay(s) between animation frames (in milliseconds)
* @returns {Sharp}
* @throws {Error} Invalid options
*/
@@ -1173,13 +1173,14 @@ function jxl (options) {
}
}
if (is.defined(options.effort)) {
if (is.integer(options.effort) && is.inRange(options.effort, 3, 9)) {
if (is.integer(options.effort) && is.inRange(options.effort, 1, 9)) {
this.options.jxlEffort = options.effort;
} else {
throw is.invalidParameterError('effort', 'integer between 3 and 9', options.effort);
throw is.invalidParameterError('effort', 'integer between 1 and 9', options.effort);
}
}
}
trySetAnimationOptions(options, this.options);
return this._updateFormatOut('jxl', options);
}