Docs: add example of 16-bit RGB output #2528

This commit is contained in:
Lovell Fuller
2021-01-26 15:03:43 +00:00
parent 573ed5f4b5
commit 24d9e53c3f
2 changed files with 15 additions and 0 deletions

View File

@@ -57,6 +57,13 @@ function grayscale (grayscale) {
/**
* Set the output colourspace.
* By default output image will be web-friendly sRGB, with additional channels interpreted as alpha channels.
*
* @example
* // Output 16 bits per pixel RGB
* await sharp(input)
* .toColourspace('rgb16')
* .toFile('16-bpp.png')
*
* @param {string} [colourspace] - output colourspace e.g. `srgb`, `rgb`, `cmyk`, `lab`, `b-w` [...](https://github.com/libvips/libvips/blob/master/libvips/iofuncs/enumtypes.c#L568)
* @returns {Sharp}
* @throws {Error} Invalid parameters