mirror of
https://github.com/lovell/sharp.git
synced 2025-07-12 20:10:13 +02:00
Docs: improve descripion of create/raw props
This commit is contained in:
parent
b2a0b8c0f0
commit
39ddb6a175
@ -31,13 +31,13 @@ Implements the [stream.Duplex][1] class.
|
||||
- `options.level` **[number][6]** level to extract from a multi-level input (OpenSlide), zero based. (optional, default `0`)
|
||||
- `options.animated` **[boolean][5]** Set to `true` to read all frames/pages of an animated image (equivalent of setting `pages` to `-1`). (optional, default `false`)
|
||||
- `options.raw` **[Object][4]?** describes raw pixel input image data. See `raw()` for pixel ordering.
|
||||
- `options.raw.width` **[number][6]?**
|
||||
- `options.raw.height` **[number][6]?**
|
||||
- `options.raw.channels` **[number][6]?** 1-4
|
||||
- `options.raw.width` **[number][6]?** integral number of pixels wide.
|
||||
- `options.raw.height` **[number][6]?** integral number of pixels high.
|
||||
- `options.raw.channels` **[number][6]?** integral number of channels, between 1 and 4.
|
||||
- `options.create` **[Object][4]?** describes a new image to be created.
|
||||
- `options.create.width` **[number][6]?**
|
||||
- `options.create.height` **[number][6]?**
|
||||
- `options.create.channels` **[number][6]?** 3-4
|
||||
- `options.create.width` **[number][6]?** integral number of pixels wide.
|
||||
- `options.create.height` **[number][6]?** integral number of pixels high.
|
||||
- `options.create.channels` **[number][6]?** integral number of channels, either 3 (RGB) or 4 (RGBA).
|
||||
- `options.create.background` **([string][3] \| [Object][4])?** parsed by the [color][7] module to extract values for red, green, blue and alpha.
|
||||
|
||||
### Examples
|
||||
|
@ -108,13 +108,13 @@ const debuglog = util.debuglog('sharp');
|
||||
* @param {number} [options.level=0] - level to extract from a multi-level input (OpenSlide), zero based.
|
||||
* @param {boolean} [options.animated=false] - Set to `true` to read all frames/pages of an animated image (equivalent of setting `pages` to `-1`).
|
||||
* @param {Object} [options.raw] - describes raw pixel input image data. See `raw()` for pixel ordering.
|
||||
* @param {number} [options.raw.width]
|
||||
* @param {number} [options.raw.height]
|
||||
* @param {number} [options.raw.channels] - 1-4
|
||||
* @param {number} [options.raw.width] - integral number of pixels wide.
|
||||
* @param {number} [options.raw.height] - integral number of pixels high.
|
||||
* @param {number} [options.raw.channels] - integral number of channels, between 1 and 4.
|
||||
* @param {Object} [options.create] - describes a new image to be created.
|
||||
* @param {number} [options.create.width]
|
||||
* @param {number} [options.create.height]
|
||||
* @param {number} [options.create.channels] - 3-4
|
||||
* @param {number} [options.create.width] - integral number of pixels wide.
|
||||
* @param {number} [options.create.height] - integral number of pixels high.
|
||||
* @param {number} [options.create.channels] - integral number of channels, either 3 (RGB) or 4 (RGBA).
|
||||
* @param {string|Object} [options.create.background] - parsed by the [color](https://www.npmjs.org/package/color) module to extract values for red, green, blue and alpha.
|
||||
* @returns {Sharp}
|
||||
* @throws {Error} Invalid parameters
|
||||
|
@ -149,7 +149,7 @@ function _createInputDescriptor (input, inputOptions, containerOptions) {
|
||||
];
|
||||
delete inputDescriptor.buffer;
|
||||
} else {
|
||||
throw new Error('Expected width, height, channels and background to create a new input image');
|
||||
throw new Error('Expected valid width, height, channels and background to create a new input image');
|
||||
}
|
||||
}
|
||||
} else if (is.defined(inputOptions)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user