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

@ -695,8 +695,6 @@ Requires libvips compiled with support for libjxl.
The prebuilt binaries do not include this - see The prebuilt binaries do not include this - see
[installing a custom libvips](https://sharp.pixelplumbing.com/install#custom-libvips). [installing a custom libvips](https://sharp.pixelplumbing.com/install#custom-libvips).
Image metadata (EXIF, XMP) is unsupported.
**Throws**: **Throws**:
@ -711,7 +709,9 @@ Image metadata (EXIF, XMP) is unsupported.
| [options.quality] | <code>number</code> | | calculate `distance` based on JPEG-like quality, between 1 and 100, overrides distance if specified | | [options.quality] | <code>number</code> | | calculate `distance` based on JPEG-like quality, between 1 and 100, overrides distance if specified |
| [options.decodingTier] | <code>number</code> | <code>0</code> | target decode speed tier, between 0 (highest quality) and 4 (lowest quality) | | [options.decodingTier] | <code>number</code> | <code>0</code> | target decode speed tier, between 0 (highest quality) and 4 (lowest quality) |
| [options.lossless] | <code>boolean</code> | <code>false</code> | use lossless compression | | [options.lossless] | <code>boolean</code> | <code>false</code> | use lossless compression |
| [options.effort] | <code>number</code> | <code>7</code> | CPU effort, between 3 (fastest) and 9 (slowest) | | [options.effort] | <code>number</code> | <code>7</code> | CPU effort, between 1 (fastest) and 9 (slowest) |
| [options.loop] | <code>number</code> | <code>0</code> | number of animation iterations, use 0 for infinite animation |
| [options.delay] | <code>number</code> \| <code>Array.&lt;number&gt;</code> | | delay(s) between animation frames (in milliseconds) |

File diff suppressed because one or more lines are too long

View File

@ -1127,8 +1127,6 @@ function heif (options) {
* The prebuilt binaries do not include this - see * The prebuilt binaries do not include this - see
* {@link https://sharp.pixelplumbing.com/install#custom-libvips installing a custom libvips}. * {@link https://sharp.pixelplumbing.com/install#custom-libvips installing a custom libvips}.
* *
* Image metadata (EXIF, XMP) is unsupported.
*
* @since 0.31.3 * @since 0.31.3
* *
* @param {Object} [options] - output options * @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.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 {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 {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} * @returns {Sharp}
* @throws {Error} Invalid options * @throws {Error} Invalid options
*/ */
@ -1173,13 +1173,14 @@ function jxl (options) {
} }
} }
if (is.defined(options.effort)) { 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; this.options.jxlEffort = options.effort;
} else { } 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); return this._updateFormatOut('jxl', options);
} }