Improve docs relating to single-channel raw pixel output

This commit is contained in:
Lovell Fuller
2020-03-01 14:22:49 +00:00
parent 03dad5f2b2
commit 258c9e86eb
7 changed files with 51 additions and 8 deletions

View File

@@ -517,7 +517,9 @@ function heif (options) {
}
/**
* Force output to be raw, uncompressed uint8 pixel data.
* Force output to be raw, uncompressed, 8-bit unsigned integer (unit8) pixel data.
* Pixel ordering is left-to-right, top-to-bottom, without padding.
* Channel ordering will be RGB or RGBA for non-greyscale colourspaces.
*
* @example
* // Extract raw RGB pixel data from JPEG input
@@ -525,6 +527,15 @@ function heif (options) {
* .raw()
* .toBuffer({ resolveWithObject: true });
*
* @example
* // Extract alpha channel as raw pixel data from PNG input
* const data = await sharp('input.png')
* .ensureAlpha()
* .extractChannel(3)
* .colourspace('b-w')
* .raw()
* .toBuffer();
*
* @returns {Sharp}
*/
function raw () {