function webp (options) {
  if (is.object(options)) {
    if (is.defined(options.quality)) {
      if (is.integer(options.quality) && is.inRange(options.quality, 1, 100)) {
        this.options.webpQuality = options.quality;
      } else {
        throw is.invalidParameterError('quality', 'integer between 1 and 100', options.quality);
      }
    }
    if (is.defined(options.alphaQuality)) {
      if (is.integer(options.alphaQuality) && is.inRange(options.alphaQuality, 0, 100)) {
        this.options.webpAlphaQuality = options.alphaQuality;
      } else {
        throw is.invalidParameterError('alphaQuality', 'integer between 0 and 100', options.alphaQuality);
      }
    }
    if (is.defined(options.lossless)) {
      this._setBooleanOption('webpLossless', options.lossless);
    }
    if (is.defined(options.nearLossless)) {
      this._setBooleanOption('webpNearLossless', options.nearLossless);
    }
    if (is.defined(options.smartSubsample)) {
      this._setBooleanOption('webpSmartSubsample', options.smartSubsample);
    }
    if (is.defined(options.smartDeblock)) {
      this._setBooleanOption('webpSmartDeblock', options.smartDeblock);
    }
    if (is.defined(options.preset)) {
      if (is.string(options.preset) && is.inArray(options.preset, ['default', 'photo', 'picture', 'drawing', 'icon', 'text'])) {
        this.options.webpPreset = options.preset;
      } else {
        throw is.invalidParameterError('preset', 'one of: default, photo, picture, drawing, icon, text', options.preset);
      }
    }
    if (is.defined(options.effort)) {
      if (is.integer(options.effort) && is.inRange(options.effort, 0, 6)) {
        this.options.webpEffort = options.effort;
      } else {
        throw is.invalidParameterError('effort', 'integer between 0 and 6', options.effort);
      }
    }
    if (is.defined(options.minSize)) {
      this._setBooleanOption('webpMinSize', options.minSize);
    }
    if (is.defined(options.mixed)) {
      this._setBooleanOption('webpMixed', options.mixed);
    }
  }
  trySetAnimationOptions(options, this.options);
  return this._updateFormatOut('webp', options);
}
Use these WebP options for output image.

@example
// Convert any input to lossless WebP output
const data = await sharp(input)
  .webp({ lossless: true })
  .toBuffer();

@example
// Optimise the file size of an animated WebP
const outputWebp = await sharp(inputWebp, { animated: true })
  .webp({ effort: 6 })
  .toBuffer();

@param {Object} [options] - output options
@param {number} [options.quality=80] - quality, integer 1-100
@param {number} [options.alphaQuality=100] - quality of alpha layer, integer 0-100
@param {boolean} [options.lossless=false] - use lossless compression mode
@param {boolean} [options.nearLossless=false] - use near_lossless compression mode
@param {boolean} [options.smartSubsample=false] - use high quality chroma subsampling
@param {boolean} [options.smartDeblock=false] - auto-adjust the deblocking filter, can improve low contrast edges (slow)
@param {string} [options.preset='default'] - named preset for preprocessing/filtering, one of: default, photo, picture, drawing, icon, text
@param {number} [options.effort=4] - CPU effort, between 0 (fastest) and 6 (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)
@param {boolean} [options.minSize=false] - prevent use of animation key frames to minimise file size (slow)
@param {boolean} [options.mixed=false] - allow mixture of lossy and lossless animation frames (slow)
@param {boolean} [options.force=true] - force WebP output, otherwise attempt to use input format
@returns {Sharp}
@throws {Error} Invalid options