function heif (options) {
  if (is.object(options)) {
    if (is.string(options.compression) && is.inArray(options.compression, ['av1', 'hevc'])) {
      this.options.heifCompression = options.compression;
    } else {
      throw is.invalidParameterError('compression', 'one of: av1, hevc', options.compression);
    }
    if (is.defined(options.quality)) {
      if (is.integer(options.quality) && is.inRange(options.quality, 1, 100)) {
        this.options.heifQuality = options.quality;
      } else {
        throw is.invalidParameterError('quality', 'integer between 1 and 100', options.quality);
      }
    }
    if (is.defined(options.lossless)) {
      if (is.bool(options.lossless)) {
        this.options.heifLossless = options.lossless;
      } else {
        throw is.invalidParameterError('lossless', 'boolean', options.lossless);
      }
    }
    if (is.defined(options.effort)) {
      if (is.integer(options.effort) && is.inRange(options.effort, 0, 9)) {
        this.options.heifEffort = options.effort;
      } else {
        throw is.invalidParameterError('effort', 'integer between 0 and 9', options.effort);
      }
    }
    if (is.defined(options.chromaSubsampling)) {
      if (is.string(options.chromaSubsampling) && is.inArray(options.chromaSubsampling, ['4:2:0', '4:4:4'])) {
        this.options.heifChromaSubsampling = options.chromaSubsampling;
      } else {
        throw is.invalidParameterError('chromaSubsampling', 'one of: 4:2:0, 4:4:4', options.chromaSubsampling);
      }
    }
    if (is.defined(options.bitdepth)) {
      if (is.integer(options.bitdepth) && is.inArray(options.bitdepth, [8, 10, 12])) {
        if (options.bitdepth !== 8 && this.constructor.versions.heif) {
          throw is.invalidParameterError('bitdepth when using prebuilt binaries', 8, options.bitdepth);
        }
        this.options.heifBitdepth = options.bitdepth;
      } else {
        throw is.invalidParameterError('bitdepth', '8, 10 or 12', options.bitdepth);
      }
    }
  } else {
    throw is.invalidParameterError('options', 'Object', options);
  }
  return this._updateFormatOut('heif', options);
}
Use these HEIF options for output image.

Support for patent-encumbered HEIC images using `hevc` compression requires the use of a
globally-installed libvips compiled with support for libheif, libde265 and x265.

@example
const data = await sharp(input)
  .heif({ compression: 'hevc' })
  .toBuffer();

@since 0.23.0

@param {Object} options - output options
@param {string} options.compression - compression format: av1, hevc
@param {number} [options.quality=50] - quality, integer 1-100
@param {boolean} [options.lossless=false] - use lossless compression
@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
@returns {Sharp}
@throws {Error} Invalid options