lib/operation.js
function sharpen (sigma, flat, jagged) {
  if (!is.defined(sigma)) {
    // No arguments: default to mild sharpen
    this.options.sharpenSigma = -1;
  } else if (is.bool(sigma)) {
    // Boolean argument: apply mild sharpen?
    this.options.sharpenSigma = sigma ? -1 : 0;
  } else if (is.number(sigma) && is.inRange(sigma, 0.01, 10000)) {
    // Numeric argument: specific sigma
    this.options.sharpenSigma = sigma;
    // Control over flat areas
    if (is.defined(flat)) {
      if (is.number(flat) && is.inRange(flat, 0, 10000)) {
        this.options.sharpenFlat = flat;
      } else {
        throw new Error('Invalid sharpen level for flat areas (0.0 - 10000.0) ' + flat);
      }
    }
    // Control over jagged areas
    if (is.defined(jagged)) {
      if (is.number(jagged) && is.inRange(jagged, 0, 10000)) {
        this.options.sharpenJagged = jagged;
      } else {
        throw new Error('Invalid sharpen level for jagged areas (0.0 - 10000.0) ' + jagged);
      }
    }
  } else {
    throw new Error('Invalid sharpen sigma (0.01 - 10000) ' + sigma);
  }
  return this;
}
function sharpen (sigma, flat, jagged) {
  if (!is.defined(sigma)) {
    // No arguments: default to mild sharpen
    this.options.sharpenSigma = -1;
  } else if (is.bool(sigma)) {
    // Boolean argument: apply mild sharpen?
    this.options.sharpenSigma = sigma ? -1 : 0;
  } else if (is.number(sigma) && is.inRange(sigma, 0.01, 10000)) {
    // Numeric argument: specific sigma
    this.options.sharpenSigma = sigma;
    // Control over flat areas
    if (is.defined(flat)) {
      if (is.number(flat) && is.inRange(flat, 0, 10000)) {
        this.options.sharpenFlat = flat;
      } else {
        throw new Error('Invalid sharpen level for flat areas (0.0 - 10000.0) ' + flat);
      }
    }
    // Control over jagged areas
    if (is.defined(jagged)) {
      if (is.number(jagged) && is.inRange(jagged, 0, 10000)) {
        this.options.sharpenJagged = jagged;
      } else {
        throw new Error('Invalid sharpen level for jagged areas (0.0 - 10000.0) ' + jagged);
      }
    }
  } else {
    throw new Error('Invalid sharpen sigma (0.01 - 10000) ' + sigma);
  }
  return this;
}
function sharpen ( sigma , flat , jagged ) { if ( ! is . defined ( sigma ) ) { // No arguments: default to mild sharpen this . options . sharpenSigma = - 1 ; } else if ( is . bool ( sigma ) ) { // Boolean argument: apply mild sharpen? this . options . sharpenSigma = sigma ? - 1 : 0 ; } else if ( is . number ( sigma ) && is . inRange ( sigma , 0.01 , 10000 ) ) { // Numeric argument: specific sigma this . options . sharpenSigma = sigma ; // Control over flat areas if ( is . defined ( flat ) ) { if ( is . number ( flat ) && is . inRange ( flat , 0 , 10000 ) ) { this . options . sharpenFlat = flat ; } else { throw new Error ( 'Invalid sharpen level for flat areas (0.0 - 10000.0) ' + flat ) ; } } // Control over jagged areas if ( is . defined ( jagged ) ) { if ( is . number ( jagged ) && is . inRange ( jagged , 0 , 10000 ) ) { this . options . sharpenJagged = jagged ; } else { throw new Error ( 'Invalid sharpen level for jagged areas (0.0 - 10000.0) ' + jagged ) ; } } } else { throw new Error ( 'Invalid sharpen sigma (0.01 - 10000) ' + sigma ) ; } return this ; }
Sharpen the image.
When used without parameters, performs a fast, mild sharpen of the output image.
When a `sigma` is provided, performs a slower, more accurate sharpen of the L channel in the LAB colour space.
Separate control over the level of sharpening in "flat" and "jagged" areas is available.

@param {Number} [sigma] - the sigma of the Gaussian mask, where `sigma = 1 + radius / 2`.
@param {Number} [flat=1.0] - the level of sharpening to apply to "flat" areas.
@param {Number} [jagged=2.0] - the level of sharpening to apply to "jagged" areas.
@returns {Sharp}
@throws {Error} Invalid parameters
Sharpen the image . When used without parameters performs a fast mild sharpen of the output image . When a sigma is provided performs a slower more accurate sharpen of the L channel in the LAB colour space . Separate control over the level of sharpening in flat and jagged areas is available .