UNPKG

sharp

Version:

High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP and TIFF images

80 lines (42 loc) 2.24 kB
<!-- Generated by documentation.js. Update this documentation by updating the source code. --> ## tint Tint the image using the provided chroma while preserving the image luminance. An alpha channel may be present and will be unchanged by the operation. ### Parameters - `rgb` **([String][1] \| [Object][2])** parsed by the [color][3] module to extract chroma values. - Throws **[Error][4]** Invalid parameter Returns **Sharp** ## greyscale Convert to 8-bit greyscale; 256 shades of grey. This is a linear operation. If the input image is in a non-linear colour space such as sRGB, use `gamma()` with `greyscale()` for the best results. By default the output image will be web-friendly sRGB and contain three (identical) color channels. This may be overridden by other sharp operations such as `toColourspace('b-w')`, which will produce an output image containing one color channel. An alpha channel may be present, and will be unchanged by the operation. ### Parameters - `greyscale` **[Boolean][5]** (optional, default `true`) Returns **Sharp** ## grayscale Alternative spelling of `greyscale`. ### Parameters - `grayscale` **[Boolean][5]** (optional, default `true`) Returns **Sharp** ## toColourspace Set the output colourspace. By default output image will be web-friendly sRGB, with additional channels interpreted as alpha channels. ### Parameters - `colourspace` **[String][1]?** output colourspace e.g. `srgb`, `rgb`, `cmyk`, `lab`, `b-w` [...][6] - Throws **[Error][4]** Invalid parameters Returns **Sharp** ## toColorspace Alternative spelling of `toColourspace`. ### Parameters - `colorspace` **[String][1]?** output colorspace. - Throws **[Error][4]** Invalid parameters Returns **Sharp** [1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String [2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object [3]: https://www.npmjs.org/package/color [4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error [5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean [6]: https://github.com/libvips/libvips/blob/master/libvips/iofuncs/enumtypes.c#L568