diff --git a/docs/api-constructor.md b/docs/api-constructor.md index b4ce10fe..2e2c3b54 100644 --- a/docs/api-constructor.md +++ b/docs/api-constructor.md @@ -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 diff --git a/lib/constructor.js b/lib/constructor.js index afa5ade0..0d58053c 100644 --- a/lib/constructor.js +++ b/lib/constructor.js @@ -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 diff --git a/lib/input.js b/lib/input.js index c4be6847..ecab8ffb 100644 --- a/lib/input.js +++ b/lib/input.js @@ -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)) {