function withMetadata (options) {
  this.keepMetadata();
  this.withIccProfile('srgb');
  if (is.object(options)) {
    if (is.defined(options.orientation)) {
      if (is.integer(options.orientation) && is.inRange(options.orientation, 1, 8)) {
        this.options.withMetadataOrientation = options.orientation;
      } else {
        throw is.invalidParameterError('orientation', 'integer between 1 and 8', options.orientation);
      }
    }
    if (is.defined(options.density)) {
      if (is.number(options.density) && options.density > 0) {
        this.options.withMetadataDensity = options.density;
      } else {
        throw is.invalidParameterError('density', 'positive number', options.density);
      }
    }
    if (is.defined(options.icc)) {
      this.withIccProfile(options.icc);
    }
    if (is.defined(options.exif)) {
      this.withExifMerge(options.exif);
    }
  }
  return this;
}
Keep most metadata (EXIF, XMP, IPTC) from the input image in the output image.

This will also convert to and add a web-friendly sRGB ICC profile if appropriate.

Allows orientation and density to be set or updated.

@example
const outputSrgbWithMetadata = await sharp(inputRgbWithMetadata)
  .withMetadata()
  .toBuffer();

@example
// Set output metadata to 96 DPI
const data = await sharp(input)
  .withMetadata({ density: 96 })
  .toBuffer();

@param {Object} [options]
@param {number} [options.orientation] Used to update the EXIF `Orientation` tag, integer between 1 and 8.
@param {number} [options.density] Number of pixels per inch (DPI).
@returns {Sharp}
@throws {Error} Invalid parameters