lib/operation.js
function modulate (options) {
  if (!is.plainObject(options)) {
    throw is.invalidParameterError('options', 'plain object', options);
  }
  if ('brightness' in options) {
    if (is.number(options.brightness) && options.brightness >= 0) {
      this.options.brightness = options.brightness;
    } else {
      throw is.invalidParameterError('brightness', 'number above zero', options.brightness);
    }
  }
  if ('saturation' in options) {
    if (is.number(options.saturation) && options.saturation >= 0) {
      this.options.saturation = options.saturation;
    } else {
      throw is.invalidParameterError('saturation', 'number above zero', options.saturation);
    }
  }
  if ('hue' in options) {
    if (is.integer(options.hue)) {
      this.options.hue = options.hue % 360;
    } else {
      throw is.invalidParameterError('hue', 'number', options.hue);
    }
  }
  return this;
}
function modulate (options) {
  if (!is.plainObject(options)) {
    throw is.invalidParameterError('options', 'plain object', options);
  }
  if ('brightness' in options) {
    if (is.number(options.brightness) && options.brightness >= 0) {
      this.options.brightness = options.brightness;
    } else {
      throw is.invalidParameterError('brightness', 'number above zero', options.brightness);
    }
  }
  if ('saturation' in options) {
    if (is.number(options.saturation) && options.saturation >= 0) {
      this.options.saturation = options.saturation;
    } else {
      throw is.invalidParameterError('saturation', 'number above zero', options.saturation);
    }
  }
  if ('hue' in options) {
    if (is.integer(options.hue)) {
      this.options.hue = options.hue % 360;
    } else {
      throw is.invalidParameterError('hue', 'number', options.hue);
    }
  }
  return this;
}
function modulate ( options ) { if ( ! is . plainObject ( options ) ) { throw is . invalidParameterError ( 'options' , 'plain object' , options ) ; } if ( 'brightness' in options ) { if ( is . number ( options . brightness ) && options . brightness >= 0 ) { this . options . brightness = options . brightness ; } else { throw is . invalidParameterError ( 'brightness' , 'number above zero' , options . brightness ) ; } } if ( 'saturation' in options ) { if ( is . number ( options . saturation ) && options . saturation >= 0 ) { this . options . saturation = options . saturation ; } else { throw is . invalidParameterError ( 'saturation' , 'number above zero' , options . saturation ) ; } } if ( 'hue' in options ) { if ( is . integer ( options . hue ) ) { this . options . hue = options . hue % 360 ; } else { throw is . invalidParameterError ( 'hue' , 'number' , options . hue ) ; } } return this ; }
Transforms the image using brightness, saturation and hue rotation.

@example
sharp(input)
.modulate({
brightness: 2 // increase lightness by a factor of 2
});

sharp(input)
.modulate({
hue: 180 // hue-rotate by 180 degrees
});

// decreate brightness and saturation while also hue-rotating by 90 degrees
sharp(input)
.modulate({
brightness: 0.5,
saturation: 0.5,
hue: 90
});

@param {Object} [options]
@param {Number} [options.brightness] Brightness multiplier
@param {Number} [options.saturation] Saturation multiplier
@param {Number} [options.hue] Degrees for hue rotation
@returns {Sharp}
Transforms the image using brightness saturation and hue rotation .