Encoding lossless AVIF is mutually exclusive with iq tuning

This commit is contained in:
Lovell Fuller
2026-01-07 20:39:53 +00:00
parent 4b1680c312
commit 0468c1be9f
3 changed files with 37 additions and 4 deletions

View File

@@ -1175,7 +1175,7 @@ function tiff (options) {
* @param {number} [options.effort=4] - CPU effort, between 0 (fastest) and 9 (slowest)
* @param {string} [options.chromaSubsampling='4:4:4'] - set to '4:2:0' to use chroma subsampling
* @param {number} [options.bitdepth=8] - set bitdepth to 8, 10 or 12 bit
* @param {string} [options.tune='iq'] - tune output for a quality metric, one of 'iq' (default), 'ssim' or 'psnr'
* @param {string} [options.tune='iq'] - tune output for a quality metric, one of 'iq' (default), 'ssim' (default when lossless) or 'psnr'
* @returns {Sharp}
* @throws {Error} Invalid options
*/
@@ -1255,7 +1255,11 @@ function heif (options) {
}
if (is.defined(options.tune)) {
if (is.string(options.tune) && is.inArray(options.tune, ['iq', 'ssim', 'psnr'])) {
this.options.heifTune = options.tune;
if (this.options.heifLossless && options.tune === 'iq') {
this.options.heifTune = 'ssim';
} else {
this.options.heifTune = options.tune;
}
} else {
throw is.invalidParameterError('tune', 'one of: psnr, ssim, iq', options.tune);
}