mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 10:30:15 +02:00
Docs: lint JSDoc annotations when building docs
This commit is contained in:
parent
0872f495f9
commit
0ee08bfe46
@ -42,7 +42,7 @@ Extract a single channel from a multi-channel image.
|
|||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
- `channel` **([Number][1] \| [String][2])** zero-indexed band number to extract, or `red`, `green` or `blue` as alternative to `0`, `1` or `2` respectively.
|
- `channel` **([number][1] \| [string][2])** zero-indexed band number to extract, or `red`, `green` or `blue` as alternative to `0`, `1` or `2` respectively.
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ For raw pixel input, the `options` object should contain a `raw` attribute, whic
|
|||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
- `images` **([Array][4]<([String][2] \| [Buffer][5])> | [String][2] \| [Buffer][5])** one or more images (file paths, Buffers).
|
- `images` **([Array][4]<([string][2] \| [Buffer][5])> | [string][2] \| [Buffer][5])** one or more images (file paths, Buffers).
|
||||||
- `options` **[Object][6]** image options, see `sharp()` constructor.
|
- `options` **[Object][6]** image options, see `sharp()` constructor.
|
||||||
|
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ Perform a bitwise boolean operation on all input image channels (bands) to produ
|
|||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
- `boolOp` **[String][2]** one of `and`, `or` or `eor` to perform that bitwise operation, like the C logic operators `&`, `|` and `^` respectively.
|
- `boolOp` **[string][2]** one of `and`, `or` or `eor` to perform that bitwise operation, like the C logic operators `&`, `|` and `^` respectively.
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ An alpha channel may be present and will be unchanged by the operation.
|
|||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
- `rgb` **([String][1] \| [Object][2])** parsed by the [color][3] module to extract chroma values.
|
- `rgb` **([string][1] \| [Object][2])** parsed by the [color][3] module to extract chroma values.
|
||||||
|
|
||||||
|
|
||||||
- Throws **[Error][4]** Invalid parameter
|
- Throws **[Error][4]** Invalid parameter
|
||||||
@ -46,7 +46,7 @@ By default output image will be web-friendly sRGB, with additional channels inte
|
|||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
- `colourspace` **[String][1]?** output colourspace e.g. `srgb`, `rgb`, `cmyk`, `lab`, `b-w` [...][6]
|
- `colourspace` **[string][1]?** output colourspace e.g. `srgb`, `rgb`, `cmyk`, `lab`, `b-w` [...][6]
|
||||||
|
|
||||||
|
|
||||||
- Throws **[Error][4]** Invalid parameters
|
- Throws **[Error][4]** Invalid parameters
|
||||||
@ -59,7 +59,7 @@ Alternative spelling of `toColourspace`.
|
|||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
- `colorspace` **[String][1]?** output colorspace.
|
- `colorspace` **[string][1]?** output colorspace.
|
||||||
|
|
||||||
|
|
||||||
- Throws **[Error][4]** Invalid parameters
|
- Throws **[Error][4]** Invalid parameters
|
||||||
|
@ -21,9 +21,9 @@ for example `rotate(x).extract(y)` will produce a different result to `extract(y
|
|||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
- `angle` **[Number][1]** angle of rotation. (optional, default `auto`)
|
- `angle` **[number][1]** angle of rotation. (optional, default `auto`)
|
||||||
- `options` **[Object][2]?** if present, is an Object with optional attributes.
|
- `options` **[Object][2]?** if present, is an Object with optional attributes.
|
||||||
- `options.background` **([String][3] \| [Object][2])** parsed by the [color][4] module to extract values for red, green, blue and alpha. (optional, default `"#000000"`)
|
- `options.background` **([string][3] \| [Object][2])** parsed by the [color][4] module to extract values for red, green, blue and alpha. (optional, default `"#000000"`)
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
@ -74,9 +74,9 @@ Separate control over the level of sharpening in "flat" and "jagged" areas is av
|
|||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
- `sigma` **[Number][1]?** the sigma of the Gaussian mask, where `sigma = 1 + radius / 2`.
|
- `sigma` **[number][1]?** the sigma of the Gaussian mask, where `sigma = 1 + radius / 2`.
|
||||||
- `flat` **[Number][1]** the level of sharpening to apply to "flat" areas. (optional, default `1.0`)
|
- `flat` **[number][1]** the level of sharpening to apply to "flat" areas. (optional, default `1.0`)
|
||||||
- `jagged` **[Number][1]** the level of sharpening to apply to "jagged" areas. (optional, default `2.0`)
|
- `jagged` **[number][1]** the level of sharpening to apply to "jagged" areas. (optional, default `2.0`)
|
||||||
|
|
||||||
|
|
||||||
- Throws **[Error][5]** Invalid parameters
|
- Throws **[Error][5]** Invalid parameters
|
||||||
@ -90,7 +90,7 @@ When used without parameters the default window is 3x3.
|
|||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
- `size` **[Number][1]** square mask size: size x size (optional, default `3`)
|
- `size` **[number][1]** square mask size: size x size (optional, default `3`)
|
||||||
|
|
||||||
|
|
||||||
- Throws **[Error][5]** Invalid parameters
|
- Throws **[Error][5]** Invalid parameters
|
||||||
@ -105,7 +105,7 @@ When a `sigma` is provided, performs a slower, more accurate Gaussian blur.
|
|||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
- `sigma` **[Number][1]?** a value between 0.3 and 1000 representing the sigma of the Gaussian mask, where `sigma = 1 + radius / 2`.
|
- `sigma` **[number][1]?** a value between 0.3 and 1000 representing the sigma of the Gaussian mask, where `sigma = 1 + radius / 2`.
|
||||||
|
|
||||||
|
|
||||||
- Throws **[Error][5]** Invalid parameters
|
- Throws **[Error][5]** Invalid parameters
|
||||||
@ -119,7 +119,7 @@ Merge alpha transparency channel, if any, with a background.
|
|||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
- `options` **[Object][2]?**
|
- `options` **[Object][2]?**
|
||||||
- `options.background` **([String][3] \| [Object][2])** background colour, parsed by the [color][4] module, defaults to black. (optional, default `{r:0,g:0,b:0}`)
|
- `options.background` **([string][3] \| [Object][2])** background colour, parsed by the [color][4] module, defaults to black. (optional, default `{r:0,g:0,b:0}`)
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp**
|
||||||
|
|
||||||
@ -135,8 +135,8 @@ Supply a second argument to use a different output gamma value, otherwise the fi
|
|||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
- `gamma` **[Number][1]** value between 1.0 and 3.0. (optional, default `2.2`)
|
- `gamma` **[number][1]** value between 1.0 and 3.0. (optional, default `2.2`)
|
||||||
- `gammaOut` **[Number][1]?** value between 1.0 and 3.0. (optional, defaults to same as `gamma`)
|
- `gammaOut` **[number][1]?** value between 1.0 and 3.0. (optional, defaults to same as `gamma`)
|
||||||
|
|
||||||
|
|
||||||
- Throws **[Error][5]** Invalid parameters
|
- Throws **[Error][5]** Invalid parameters
|
||||||
@ -180,11 +180,11 @@ Convolve the image with the specified kernel.
|
|||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
- `kernel` **[Object][2]**
|
- `kernel` **[Object][2]**
|
||||||
- `kernel.width` **[Number][1]** width of the kernel in pixels.
|
- `kernel.width` **[number][1]** width of the kernel in pixels.
|
||||||
- `kernel.height` **[Number][1]** width of the kernel in pixels.
|
- `kernel.height` **[number][1]** width of the kernel in pixels.
|
||||||
- `kernel.kernel` **[Array][7]<[Number][1]>** Array of length `width*height` containing the kernel values.
|
- `kernel.kernel` **[Array][7]<[number][1]>** Array of length `width*height` containing the kernel values.
|
||||||
- `kernel.scale` **[Number][1]** the scale of the kernel in pixels. (optional, default `sum`)
|
- `kernel.scale` **[number][1]** the scale of the kernel in pixels. (optional, default `sum`)
|
||||||
- `kernel.offset` **[Number][1]** the offset of the kernel in pixels. (optional, default `0`)
|
- `kernel.offset` **[number][1]** the offset of the kernel in pixels. (optional, default `0`)
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
@ -212,7 +212,7 @@ Any pixel value greather than or equal to the threshold value will be set to 255
|
|||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
- `threshold` **[Number][1]** a value in the range 0-255 representing the level at which the threshold will be applied. (optional, default `128`)
|
- `threshold` **[number][1]** a value in the range 0-255 representing the level at which the threshold will be applied. (optional, default `128`)
|
||||||
- `options` **[Object][2]?**
|
- `options` **[Object][2]?**
|
||||||
- `options.greyscale` **[Boolean][6]** convert to single channel greyscale. (optional, default `true`)
|
- `options.greyscale` **[Boolean][6]** convert to single channel greyscale. (optional, default `true`)
|
||||||
- `options.grayscale` **[Boolean][6]** alternative spelling for greyscale. (optional, default `true`)
|
- `options.grayscale` **[Boolean][6]** alternative spelling for greyscale. (optional, default `true`)
|
||||||
@ -231,13 +231,13 @@ the selected bitwise boolean `operation` between the corresponding pixels of the
|
|||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
- `operand` **([Buffer][8] \| [String][3])** Buffer containing image data or String containing the path to an image file.
|
- `operand` **([Buffer][8] \| [string][3])** Buffer containing image data or string containing the path to an image file.
|
||||||
- `operator` **[String][3]** one of `and`, `or` or `eor` to perform that bitwise operation, like the C logic operators `&`, `|` and `^` respectively.
|
- `operator` **[string][3]** one of `and`, `or` or `eor` to perform that bitwise operation, like the C logic operators `&`, `|` and `^` respectively.
|
||||||
- `options` **[Object][2]?**
|
- `options` **[Object][2]?**
|
||||||
- `options.raw` **[Object][2]?** describes operand when using raw pixel data.
|
- `options.raw` **[Object][2]?** describes operand when using raw pixel data.
|
||||||
- `options.raw.width` **[Number][1]?**
|
- `options.raw.width` **[number][1]?**
|
||||||
- `options.raw.height` **[Number][1]?**
|
- `options.raw.height` **[number][1]?**
|
||||||
- `options.raw.channels` **[Number][1]?**
|
- `options.raw.channels` **[number][1]?**
|
||||||
|
|
||||||
|
|
||||||
- Throws **[Error][5]** Invalid parameters
|
- Throws **[Error][5]** Invalid parameters
|
||||||
@ -250,8 +250,8 @@ Apply the linear formula a \* input + b to the image (levels adjustment)
|
|||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
- `a` **[Number][1]** multiplier (optional, default `1.0`)
|
- `a` **[number][1]** multiplier (optional, default `1.0`)
|
||||||
- `b` **[Number][1]** offset (optional, default `0.0`)
|
- `b` **[number][1]** offset (optional, default `0.0`)
|
||||||
|
|
||||||
|
|
||||||
- Throws **[Error][5]** Invalid parameters
|
- Throws **[Error][5]** Invalid parameters
|
||||||
@ -264,8 +264,7 @@ Recomb the image with the specified matrix.
|
|||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
- `inputMatrix`
|
- `inputMatrix` **[Array][7]<[Array][7]<[number][1]>>** 3x3 Recombination matrix
|
||||||
- `3x3` **[Array][7]<[Array][7]<[Number][1]>>** Recombination matrix
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
@ -298,9 +297,9 @@ Transforms the image using brightness, saturation and hue rotation.
|
|||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
- `options` **[Object][2]?**
|
- `options` **[Object][2]?**
|
||||||
- `options.brightness` **[Number][1]?** Brightness multiplier
|
- `options.brightness` **[number][1]?** Brightness multiplier
|
||||||
- `options.saturation` **[Number][1]?** Saturation multiplier
|
- `options.saturation` **[number][1]?** Saturation multiplier
|
||||||
- `options.hue` **[Number][1]?** Degrees for hue rotation
|
- `options.hue` **[number][1]?** Degrees for hue rotation
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ A `Promise` is returned when `callback` is not provided.
|
|||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
- `fileOut` **[String][2]** the path to write the image data to.
|
- `fileOut` **[string][2]** the path to write the image data to.
|
||||||
- `callback` **[Function][3]?** called on completion with two arguments `(err, info)`.
|
- `callback` **[Function][3]?** called on completion with two arguments `(err, info)`.
|
||||||
`info` contains the output image `format`, `size` (bytes), `width`, `height`,
|
`info` contains the output image `format`, `size` (bytes), `width`, `height`,
|
||||||
`channels` and `premultiplied` (indicating if premultiplication was used).
|
`channels` and `premultiplied` (indicating if premultiplication was used).
|
||||||
@ -62,7 +62,7 @@ A `Promise` is returned when `callback` is not provided.
|
|||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
- `options` **[Object][6]?**
|
- `options` **[Object][6]?**
|
||||||
- `options.resolveWithObject` **[Boolean][7]?** Resolve the Promise with an Object containing `data` and `info` properties instead of resolving only with `data`.
|
- `options.resolveWithObject` **[boolean][7]?** Resolve the Promise with an Object containing `data` and `info` properties instead of resolving only with `data`.
|
||||||
- `callback` **[Function][3]?**
|
- `callback` **[Function][3]?**
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
@ -99,7 +99,7 @@ sRGB colour space and strip all metadata, including the removal of any ICC profi
|
|||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
- `options` **[Object][6]?**
|
- `options` **[Object][6]?**
|
||||||
- `options.orientation` **[Number][9]?** value between 1 and 8, used to update the EXIF `Orientation` tag.
|
- `options.orientation` **[number][9]?** value between 1 and 8, used to update the EXIF `Orientation` tag.
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ Force output to a given format.
|
|||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
- `format` **([String][2] \| [Object][6])** as a String or an Object with an 'id' attribute
|
- `format` **([string][2] \| [Object][6])** as a string or an Object with an 'id' attribute
|
||||||
- `options` **[Object][6]** output options
|
- `options` **[Object][6]** output options
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
@ -143,18 +143,18 @@ Use these JPEG options for output image.
|
|||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
- `options` **[Object][6]?** output options
|
- `options` **[Object][6]?** output options
|
||||||
- `options.quality` **[Number][9]** quality, integer 1-100 (optional, default `80`)
|
- `options.quality` **[number][9]** quality, integer 1-100 (optional, default `80`)
|
||||||
- `options.progressive` **[Boolean][7]** use progressive (interlace) scan (optional, default `false`)
|
- `options.progressive` **[boolean][7]** use progressive (interlace) scan (optional, default `false`)
|
||||||
- `options.chromaSubsampling` **[String][2]** for quality < 90, set to '4:4:4' to prevent chroma subsampling otherwise defaults to '4:2:0' (use chroma subsampling); for quality >= 90 chroma is never subsampled (optional, default `'4:2:0'`)
|
- `options.chromaSubsampling` **[string][2]** for quality < 90, set to '4:4:4' to prevent chroma subsampling otherwise defaults to '4:2:0' (use chroma subsampling); for quality >= 90 chroma is never subsampled (optional, default `'4:2:0'`)
|
||||||
- `options.trellisQuantisation` **[Boolean][7]** apply trellis quantisation, requires libvips compiled with support for mozjpeg (optional, default `false`)
|
- `options.trellisQuantisation` **[boolean][7]** apply trellis quantisation, requires libvips compiled with support for mozjpeg (optional, default `false`)
|
||||||
- `options.overshootDeringing` **[Boolean][7]** apply overshoot deringing, requires libvips compiled with support for mozjpeg (optional, default `false`)
|
- `options.overshootDeringing` **[boolean][7]** apply overshoot deringing, requires libvips compiled with support for mozjpeg (optional, default `false`)
|
||||||
- `options.optimiseScans` **[Boolean][7]** optimise progressive scans, forces progressive, requires libvips compiled with support for mozjpeg (optional, default `false`)
|
- `options.optimiseScans` **[boolean][7]** optimise progressive scans, forces progressive, requires libvips compiled with support for mozjpeg (optional, default `false`)
|
||||||
- `options.optimizeScans` **[Boolean][7]** alternative spelling of optimiseScans (optional, default `false`)
|
- `options.optimizeScans` **[boolean][7]** alternative spelling of optimiseScans (optional, default `false`)
|
||||||
- `options.optimiseCoding` **[Boolean][7]** optimise Huffman coding tables (optional, default `true`)
|
- `options.optimiseCoding` **[boolean][7]** optimise Huffman coding tables (optional, default `true`)
|
||||||
- `options.optimizeCoding` **[Boolean][7]** alternative spelling of optimiseCoding (optional, default `true`)
|
- `options.optimizeCoding` **[boolean][7]** alternative spelling of optimiseCoding (optional, default `true`)
|
||||||
- `options.quantisationTable` **[Number][9]** quantization table to use, integer 0-8, requires libvips compiled with support for mozjpeg (optional, default `0`)
|
- `options.quantisationTable` **[number][9]** quantization table to use, integer 0-8, requires libvips compiled with support for mozjpeg (optional, default `0`)
|
||||||
- `options.quantizationTable` **[Number][9]** alternative spelling of quantisationTable (optional, default `0`)
|
- `options.quantizationTable` **[number][9]** alternative spelling of quantisationTable (optional, default `0`)
|
||||||
- `options.force` **[Boolean][7]** force JPEG output, otherwise attempt to use input format (optional, default `true`)
|
- `options.force` **[boolean][7]** force JPEG output, otherwise attempt to use input format (optional, default `true`)
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
@ -182,15 +182,15 @@ Indexed PNG input at 1, 2 or 4 bits per pixel is converted to 8 bits per pixel.
|
|||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
- `options` **[Object][6]?**
|
- `options` **[Object][6]?**
|
||||||
- `options.progressive` **[Boolean][7]** use progressive (interlace) scan (optional, default `false`)
|
- `options.progressive` **[boolean][7]** use progressive (interlace) scan (optional, default `false`)
|
||||||
- `options.compressionLevel` **[Number][9]** zlib compression level, 0-9 (optional, default `9`)
|
- `options.compressionLevel` **[number][9]** zlib compression level, 0-9 (optional, default `9`)
|
||||||
- `options.adaptiveFiltering` **[Boolean][7]** use adaptive row filtering (optional, default `false`)
|
- `options.adaptiveFiltering` **[boolean][7]** use adaptive row filtering (optional, default `false`)
|
||||||
- `options.palette` **[Boolean][7]** quantise to a palette-based image with alpha transparency support, requires libvips compiled with support for libimagequant (optional, default `false`)
|
- `options.palette` **[boolean][7]** quantise to a palette-based image with alpha transparency support, requires libvips compiled with support for libimagequant (optional, default `false`)
|
||||||
- `options.quality` **[Number][9]** use the lowest number of colours needed to achieve given quality, requires libvips compiled with support for libimagequant (optional, default `100`)
|
- `options.quality` **[number][9]** use the lowest number of colours needed to achieve given quality, requires libvips compiled with support for libimagequant (optional, default `100`)
|
||||||
- `options.colours` **[Number][9]** maximum number of palette entries, requires libvips compiled with support for libimagequant (optional, default `256`)
|
- `options.colours` **[number][9]** maximum number of palette entries, requires libvips compiled with support for libimagequant (optional, default `256`)
|
||||||
- `options.colors` **[Number][9]** alternative spelling of `options.colours`, requires libvips compiled with support for libimagequant (optional, default `256`)
|
- `options.colors` **[number][9]** alternative spelling of `options.colours`, requires libvips compiled with support for libimagequant (optional, default `256`)
|
||||||
- `options.dither` **[Number][9]** level of Floyd-Steinberg error diffusion, requires libvips compiled with support for libimagequant (optional, default `1.0`)
|
- `options.dither` **[number][9]** level of Floyd-Steinberg error diffusion, requires libvips compiled with support for libimagequant (optional, default `1.0`)
|
||||||
- `options.force` **[Boolean][7]** force PNG output, otherwise attempt to use input format (optional, default `true`)
|
- `options.force` **[boolean][7]** force PNG output, otherwise attempt to use input format (optional, default `true`)
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
@ -212,13 +212,13 @@ Use these WebP options for output image.
|
|||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
- `options` **[Object][6]?** output options
|
- `options` **[Object][6]?** output options
|
||||||
- `options.quality` **[Number][9]** quality, integer 1-100 (optional, default `80`)
|
- `options.quality` **[number][9]** quality, integer 1-100 (optional, default `80`)
|
||||||
- `options.alphaQuality` **[Number][9]** quality of alpha layer, integer 0-100 (optional, default `100`)
|
- `options.alphaQuality` **[number][9]** quality of alpha layer, integer 0-100 (optional, default `100`)
|
||||||
- `options.lossless` **[Boolean][7]** use lossless compression mode (optional, default `false`)
|
- `options.lossless` **[boolean][7]** use lossless compression mode (optional, default `false`)
|
||||||
- `options.nearLossless` **[Boolean][7]** use near_lossless compression mode (optional, default `false`)
|
- `options.nearLossless` **[boolean][7]** use near_lossless compression mode (optional, default `false`)
|
||||||
- `options.smartSubsample` **[Boolean][7]** use high quality chroma subsampling (optional, default `false`)
|
- `options.smartSubsample` **[boolean][7]** use high quality chroma subsampling (optional, default `false`)
|
||||||
- `options.reductionEffort` **[Number][9]** level of CPU effort to reduce file size, integer 0-6 (optional, default `4`)
|
- `options.reductionEffort` **[number][9]** level of CPU effort to reduce file size, integer 0-6 (optional, default `4`)
|
||||||
- `options.force` **[Boolean][7]** force WebP output, otherwise attempt to use input format (optional, default `true`)
|
- `options.force` **[boolean][7]** force WebP output, otherwise attempt to use input format (optional, default `true`)
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
@ -240,17 +240,17 @@ Use these TIFF options for output image.
|
|||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
- `options` **[Object][6]?** output options
|
- `options` **[Object][6]?** output options
|
||||||
- `options.quality` **[Number][9]** quality, integer 1-100 (optional, default `80`)
|
- `options.quality` **[number][9]** quality, integer 1-100 (optional, default `80`)
|
||||||
- `options.force` **[Boolean][7]** force TIFF output, otherwise attempt to use input format (optional, default `true`)
|
- `options.force` **[boolean][7]** force TIFF output, otherwise attempt to use input format (optional, default `true`)
|
||||||
- `options.compression` **[Boolean][7]** compression options: lzw, deflate, jpeg, ccittfax4 (optional, default `'jpeg'`)
|
- `options.compression` **[boolean][7]** compression options: lzw, deflate, jpeg, ccittfax4 (optional, default `'jpeg'`)
|
||||||
- `options.predictor` **[Boolean][7]** compression predictor options: none, horizontal, float (optional, default `'horizontal'`)
|
- `options.predictor` **[boolean][7]** compression predictor options: none, horizontal, float (optional, default `'horizontal'`)
|
||||||
- `options.pyramid` **[Boolean][7]** write an image pyramid (optional, default `false`)
|
- `options.pyramid` **[boolean][7]** write an image pyramid (optional, default `false`)
|
||||||
- `options.tile` **[Boolean][7]** write a tiled tiff (optional, default `false`)
|
- `options.tile` **[boolean][7]** write a tiled tiff (optional, default `false`)
|
||||||
- `options.tileWidth` **[Boolean][7]** horizontal tile size (optional, default `256`)
|
- `options.tileWidth` **[boolean][7]** horizontal tile size (optional, default `256`)
|
||||||
- `options.tileHeight` **[Boolean][7]** vertical tile size (optional, default `256`)
|
- `options.tileHeight` **[boolean][7]** vertical tile size (optional, default `256`)
|
||||||
- `options.xres` **[Number][9]** horizontal resolution in pixels/mm (optional, default `1.0`)
|
- `options.xres` **[number][9]** horizontal resolution in pixels/mm (optional, default `1.0`)
|
||||||
- `options.yres` **[Number][9]** vertical resolution in pixels/mm (optional, default `1.0`)
|
- `options.yres` **[number][9]** vertical resolution in pixels/mm (optional, default `1.0`)
|
||||||
- `options.squash` **[Boolean][7]** squash 8-bit images down to 1 bit (optional, default `false`)
|
- `options.squash` **[boolean][7]** squash 8-bit images down to 1 bit (optional, default `false`)
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
@ -283,9 +283,9 @@ Most versions of libheif support only the patent-encumbered HEVC compression for
|
|||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
- `options` **[Object][6]?** output options
|
- `options` **[Object][6]?** output options
|
||||||
- `options.quality` **[Number][9]** quality, integer 1-100 (optional, default `80`)
|
- `options.quality` **[number][9]** quality, integer 1-100 (optional, default `80`)
|
||||||
- `options.compression` **[Boolean][7]** compression format: hevc, avc, jpeg, av1 (optional, default `'hevc'`)
|
- `options.compression` **[boolean][7]** compression format: hevc, avc, jpeg, av1 (optional, default `'hevc'`)
|
||||||
- `options.lossless` **[Boolean][7]** use lossless compression (optional, default `false`)
|
- `options.lossless` **[boolean][7]** use lossless compression (optional, default `false`)
|
||||||
|
|
||||||
|
|
||||||
- Throws **[Error][4]** Invalid options
|
- Throws **[Error][4]** Invalid options
|
||||||
@ -334,14 +334,14 @@ Warning: multiple sharp instances concurrently producing tile output can expose
|
|||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
- `options` **[Object][6]?**
|
- `options` **[Object][6]?**
|
||||||
- `options.size` **[Number][9]** tile size in pixels, a value between 1 and 8192. (optional, default `256`)
|
- `options.size` **[number][9]** tile size in pixels, a value between 1 and 8192. (optional, default `256`)
|
||||||
- `options.overlap` **[Number][9]** tile overlap in pixels, a value between 0 and 8192. (optional, default `0`)
|
- `options.overlap` **[number][9]** tile overlap in pixels, a value between 0 and 8192. (optional, default `0`)
|
||||||
- `options.angle` **[Number][9]** tile angle of rotation, must be a multiple of 90. (optional, default `0`)
|
- `options.angle` **[number][9]** tile angle of rotation, must be a multiple of 90. (optional, default `0`)
|
||||||
- `options.background` **([String][2] \| [Object][6])** background colour, parsed by the [color][10] module, defaults to white without transparency. (optional, default `{r:255,g:255,b:255,alpha:1}`)
|
- `options.background` **([string][2] \| [Object][6])** background colour, parsed by the [color][10] module, defaults to white without transparency. (optional, default `{r:255,g:255,b:255,alpha:1}`)
|
||||||
- `options.depth` **[String][2]?** how deep to make the pyramid, possible values are `onepixel`, `onetile` or `one`, default based on layout.
|
- `options.depth` **[string][2]?** how deep to make the pyramid, possible values are `onepixel`, `onetile` or `one`, default based on layout.
|
||||||
- `options.skipBlanks` **[Number][9]** threshold to skip tile generation, a value 0 - 255 for 8-bit images or 0 - 65535 for 16-bit images (optional, default `-1`)
|
- `options.skipBlanks` **[number][9]** threshold to skip tile generation, a value 0 - 255 for 8-bit images or 0 - 65535 for 16-bit images (optional, default `-1`)
|
||||||
- `options.container` **[String][2]** tile container, with value `fs` (filesystem) or `zip` (compressed file). (optional, default `'fs'`)
|
- `options.container` **[string][2]** tile container, with value `fs` (filesystem) or `zip` (compressed file). (optional, default `'fs'`)
|
||||||
- `options.layout` **[String][2]** filesystem layout, possible values are `dz`, `iiif`, `zoomify` or `google`. (optional, default `'dz'`)
|
- `options.layout` **[string][2]** filesystem layout, possible values are `dz`, `iiif`, `zoomify` or `google`. (optional, default `'dz'`)
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
|
@ -38,8 +38,8 @@ Possible interpolation kernels are:
|
|||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
- `width` **[Number][8]?** pixels wide the resultant image should be. Use `null` or `undefined` to auto-scale the width to match the height.
|
- `width` **[number][8]?** pixels wide the resultant image should be. Use `null` or `undefined` to auto-scale the width to match the height.
|
||||||
- `height` **[Number][8]?** pixels high the resultant image should be. Use `null` or `undefined` to auto-scale the height to match the width.
|
- `height` **[number][8]?** pixels high the resultant image should be. Use `null` or `undefined` to auto-scale the height to match the width.
|
||||||
- `options` **[Object][9]?**
|
- `options` **[Object][9]?**
|
||||||
- `options.width` **[String][10]?** alternative means of specifying `width`. If both are present this take priority.
|
- `options.width` **[String][10]?** alternative means of specifying `width`. If both are present this take priority.
|
||||||
- `options.height` **[String][10]?** alternative means of specifying `height`. If both are present this take priority.
|
- `options.height` **[String][10]?** alternative means of specifying `height`. If both are present this take priority.
|
||||||
@ -136,11 +136,11 @@ This operation will always occur after resizing and extraction, if any.
|
|||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
- `extend` **([Number][8] \| [Object][9])** single pixel count to add to all edges or an Object with per-edge counts
|
- `extend` **([number][8] \| [Object][9])** single pixel count to add to all edges or an Object with per-edge counts
|
||||||
- `extend.top` **[Number][8]?**
|
- `extend.top` **[number][8]?**
|
||||||
- `extend.left` **[Number][8]?**
|
- `extend.left` **[number][8]?**
|
||||||
- `extend.bottom` **[Number][8]?**
|
- `extend.bottom` **[number][8]?**
|
||||||
- `extend.right` **[Number][8]?**
|
- `extend.right` **[number][8]?**
|
||||||
- `extend.background` **([String][10] \| [Object][9])** background colour, parsed by the [color][11] module, defaults to black without transparency. (optional, default `{r:0,g:0,b:0,alpha:1}`)
|
- `extend.background` **([String][10] \| [Object][9])** background colour, parsed by the [color][11] module, defaults to black without transparency. (optional, default `{r:0,g:0,b:0,alpha:1}`)
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
@ -175,10 +175,10 @@ Extract/crop a region of the image.
|
|||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
- `options` **[Object][9]** describes the region to extract using integral pixel values
|
- `options` **[Object][9]** describes the region to extract using integral pixel values
|
||||||
- `options.left` **[Number][8]** zero-indexed offset from left edge
|
- `options.left` **[number][8]** zero-indexed offset from left edge
|
||||||
- `options.top` **[Number][8]** zero-indexed offset from top edge
|
- `options.top` **[number][8]** zero-indexed offset from top edge
|
||||||
- `options.width` **[Number][8]** width of region to extract
|
- `options.width` **[number][8]** width of region to extract
|
||||||
- `options.height` **[Number][8]** height of region to extract
|
- `options.height` **[number][8]** height of region to extract
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
@ -213,7 +213,7 @@ The `info` response Object will contain `trimOffsetLeft` and `trimOffsetTop` pro
|
|||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
- `threshold` **[Number][8]** the allowed difference from the top-left pixel, a number greater than zero. (optional, default `10`)
|
- `threshold` **[number][8]** the allowed difference from the top-left pixel, a number greater than zero. (optional, default `10`)
|
||||||
|
|
||||||
|
|
||||||
- Throws **[Error][13]** Invalid parameters
|
- Throws **[Error][13]** Invalid parameters
|
||||||
|
@ -31,10 +31,10 @@ useful for determining how much working memory is required for a particular task
|
|||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
- `options` **([Object][1] \| [Boolean][2])** Object with the following attributes, or Boolean where true uses default cache settings and false removes all caching (optional, default `true`)
|
- `options` **([Object][1] \| [boolean][2])** Object with the following attributes, or boolean where true uses default cache settings and false removes all caching (optional, default `true`)
|
||||||
- `options.memory` **[Number][3]** is the maximum memory in MB to use for this cache (optional, default `50`)
|
- `options.memory` **[number][3]** is the maximum memory in MB to use for this cache (optional, default `50`)
|
||||||
- `options.files` **[Number][3]** is the maximum number of files to hold open (optional, default `20`)
|
- `options.files` **[number][3]** is the maximum number of files to hold open (optional, default `20`)
|
||||||
- `options.items` **[Number][3]** is the maximum number of operations to cache (optional, default `100`)
|
- `options.items` **[number][3]** is the maximum number of operations to cache (optional, default `100`)
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ This method always returns the current concurrency.
|
|||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
- `concurrency` **[Number][3]?**
|
- `concurrency` **[number][3]?**
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ sharp.concurrency(2); // 2
|
|||||||
sharp.concurrency(0); // 4
|
sharp.concurrency(0); // 4
|
||||||
```
|
```
|
||||||
|
|
||||||
Returns **[Number][3]** concurrency
|
Returns **[number][3]** concurrency
|
||||||
|
|
||||||
## queue
|
## queue
|
||||||
|
|
||||||
@ -116,7 +116,7 @@ by taking advantage of the SIMD vector unit of the CPU, e.g. Intel SSE and ARM N
|
|||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
- `simd` **[Boolean][2]** (optional, default `true`)
|
- `simd` **[boolean][2]** (optional, default `true`)
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
@ -130,7 +130,7 @@ const simd = sharp.simd(false);
|
|||||||
// prevent libvips from using liborc at runtime
|
// prevent libvips from using liborc at runtime
|
||||||
```
|
```
|
||||||
|
|
||||||
Returns **[Boolean][2]**
|
Returns **[boolean][2]**
|
||||||
|
|
||||||
[1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
[1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ function ensureAlpha () {
|
|||||||
* // green.jpg is a greyscale image containing the green channel of the input
|
* // green.jpg is a greyscale image containing the green channel of the input
|
||||||
* });
|
* });
|
||||||
*
|
*
|
||||||
* @param {Number|String} channel - zero-indexed band number to extract, or `red`, `green` or `blue` as alternative to `0`, `1` or `2` respectively.
|
* @param {number|string} channel - zero-indexed band number to extract, or `red`, `green` or `blue` as alternative to `0`, `1` or `2` respectively.
|
||||||
* @returns {Sharp}
|
* @returns {Sharp}
|
||||||
* @throws {Error} Invalid channel
|
* @throws {Error} Invalid channel
|
||||||
*/
|
*/
|
||||||
@ -91,7 +91,7 @@ function extractChannel (channel) {
|
|||||||
* Buffers may be any of the image formats supported by sharp: JPEG, PNG, WebP, GIF, SVG, TIFF or raw pixel image data.
|
* Buffers may be any of the image formats supported by sharp: JPEG, PNG, WebP, GIF, SVG, TIFF or raw pixel image data.
|
||||||
* For raw pixel input, the `options` object should contain a `raw` attribute, which follows the format of the attribute of the same name in the `sharp()` constructor.
|
* For raw pixel input, the `options` object should contain a `raw` attribute, which follows the format of the attribute of the same name in the `sharp()` constructor.
|
||||||
*
|
*
|
||||||
* @param {Array<String|Buffer>|String|Buffer} images - one or more images (file paths, Buffers).
|
* @param {Array<string|Buffer>|string|Buffer} images - one or more images (file paths, Buffers).
|
||||||
* @param {Object} options - image options, see `sharp()` constructor.
|
* @param {Object} options - image options, see `sharp()` constructor.
|
||||||
* @returns {Sharp}
|
* @returns {Sharp}
|
||||||
* @throws {Error} Invalid parameters
|
* @throws {Error} Invalid parameters
|
||||||
@ -119,7 +119,7 @@ function joinChannel (images, options) {
|
|||||||
* // then `O(1,1) = 0b11110111 & 0b10101010 & 0b00001111 = 0b00000010 = 2`.
|
* // then `O(1,1) = 0b11110111 & 0b10101010 & 0b00001111 = 0b00000010 = 2`.
|
||||||
* });
|
* });
|
||||||
*
|
*
|
||||||
* @param {String} boolOp - one of `and`, `or` or `eor` to perform that bitwise operation, like the C logic operators `&`, `|` and `^` respectively.
|
* @param {string} boolOp - one of `and`, `or` or `eor` to perform that bitwise operation, like the C logic operators `&`, `|` and `^` respectively.
|
||||||
* @returns {Sharp}
|
* @returns {Sharp}
|
||||||
* @throws {Error} Invalid parameters
|
* @throws {Error} Invalid parameters
|
||||||
*/
|
*/
|
||||||
|
@ -19,7 +19,7 @@ const colourspace = {
|
|||||||
* Tint the image using the provided chroma while preserving the image luminance.
|
* 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.
|
* An alpha channel may be present and will be unchanged by the operation.
|
||||||
*
|
*
|
||||||
* @param {String|Object} rgb - parsed by the [color](https://www.npmjs.org/package/color) module to extract chroma values.
|
* @param {string|Object} rgb - parsed by the [color](https://www.npmjs.org/package/color) module to extract chroma values.
|
||||||
* @returns {Sharp}
|
* @returns {Sharp}
|
||||||
* @throws {Error} Invalid parameter
|
* @throws {Error} Invalid parameter
|
||||||
*/
|
*/
|
||||||
@ -57,7 +57,7 @@ function grayscale (grayscale) {
|
|||||||
/**
|
/**
|
||||||
* Set the output colourspace.
|
* Set the output colourspace.
|
||||||
* By default output image will be web-friendly sRGB, with additional channels interpreted as alpha channels.
|
* By default output image will be web-friendly sRGB, with additional channels interpreted as alpha channels.
|
||||||
* @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)
|
* @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}
|
* @returns {Sharp}
|
||||||
* @throws {Error} Invalid parameters
|
* @throws {Error} Invalid parameters
|
||||||
*/
|
*/
|
||||||
@ -71,7 +71,7 @@ function toColourspace (colourspace) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Alternative spelling of `toColourspace`.
|
* Alternative spelling of `toColourspace`.
|
||||||
* @param {String} [colorspace] - output colorspace.
|
* @param {string} [colorspace] - output colorspace.
|
||||||
* @returns {Sharp}
|
* @returns {Sharp}
|
||||||
* @throws {Error} Invalid parameters
|
* @throws {Error} Invalid parameters
|
||||||
*/
|
*/
|
||||||
@ -82,8 +82,8 @@ function toColorspace (colorspace) {
|
|||||||
/**
|
/**
|
||||||
* Update a colour attribute of the this.options Object.
|
* Update a colour attribute of the this.options Object.
|
||||||
* @private
|
* @private
|
||||||
* @param {String} key
|
* @param {string} key
|
||||||
* @param {String|Object} value
|
* @param {string|Object} value
|
||||||
* @throws {Error} Invalid value
|
* @throws {Error} Invalid value
|
||||||
*/
|
*/
|
||||||
function _setBackgroundColourOption (key, value) {
|
function _setBackgroundColourOption (key, value) {
|
||||||
|
@ -147,7 +147,7 @@ function _createInputDescriptor (input, inputOptions, containerOptions) {
|
|||||||
* Handle incoming Buffer chunk on Writable Stream.
|
* Handle incoming Buffer chunk on Writable Stream.
|
||||||
* @private
|
* @private
|
||||||
* @param {Buffer} chunk
|
* @param {Buffer} chunk
|
||||||
* @param {String} encoding - unused
|
* @param {string} encoding - unused
|
||||||
* @param {Function} callback
|
* @param {Function} callback
|
||||||
*/
|
*/
|
||||||
function _write (chunk, encoding, callback) {
|
function _write (chunk, encoding, callback) {
|
||||||
@ -183,7 +183,7 @@ function _flattenBufferIn () {
|
|||||||
/**
|
/**
|
||||||
* Are we expecting Stream-based input?
|
* Are we expecting Stream-based input?
|
||||||
* @private
|
* @private
|
||||||
* @returns {Boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
function _isStreamInput () {
|
function _isStreamInput () {
|
||||||
return Array.isArray(this.options.input.buffer);
|
return Array.isArray(this.options.input.buffer);
|
||||||
|
@ -91,8 +91,8 @@ const inArray = function (val, list) {
|
|||||||
/**
|
/**
|
||||||
* Create an Error with a message relating to an invalid parameter.
|
* Create an Error with a message relating to an invalid parameter.
|
||||||
*
|
*
|
||||||
* @param {String} name - parameter name.
|
* @param {string} name - parameter name.
|
||||||
* @param {String} expected - description of the type/value/range expected.
|
* @param {string} expected - description of the type/value/range expected.
|
||||||
* @param {*} actual - the value received.
|
* @param {*} actual - the value received.
|
||||||
* @returns {Error} Containing the formatted message.
|
* @returns {Error} Containing the formatted message.
|
||||||
* @private
|
* @private
|
||||||
|
@ -32,9 +32,9 @@ const is = require('./is');
|
|||||||
* });
|
* });
|
||||||
* readableStream.pipe(pipeline);
|
* readableStream.pipe(pipeline);
|
||||||
*
|
*
|
||||||
* @param {Number} [angle=auto] angle of rotation.
|
* @param {number} [angle=auto] angle of rotation.
|
||||||
* @param {Object} [options] - if present, is an Object with optional attributes.
|
* @param {Object} [options] - if present, is an Object with optional attributes.
|
||||||
* @param {String|Object} [options.background="#000000"] parsed by the [color](https://www.npmjs.org/package/color) module to extract values for red, green, blue and alpha.
|
* @param {string|Object} [options.background="#000000"] parsed by the [color](https://www.npmjs.org/package/color) module to extract values for red, green, blue and alpha.
|
||||||
* @returns {Sharp}
|
* @returns {Sharp}
|
||||||
* @throws {Error} Invalid parameters
|
* @throws {Error} Invalid parameters
|
||||||
*/
|
*/
|
||||||
@ -88,9 +88,9 @@ function flop (flop) {
|
|||||||
* When a `sigma` is provided, performs a slower, more accurate sharpen of the L channel in the LAB colour space.
|
* When a `sigma` is provided, performs a slower, more accurate sharpen of the L channel in the LAB colour space.
|
||||||
* Separate control over the level of sharpening in "flat" and "jagged" areas is available.
|
* Separate control over the level of sharpening in "flat" and "jagged" areas is available.
|
||||||
*
|
*
|
||||||
* @param {Number} [sigma] - the sigma of the Gaussian mask, where `sigma = 1 + radius / 2`.
|
* @param {number} [sigma] - the sigma of the Gaussian mask, where `sigma = 1 + radius / 2`.
|
||||||
* @param {Number} [flat=1.0] - the level of sharpening to apply to "flat" areas.
|
* @param {number} [flat=1.0] - the level of sharpening to apply to "flat" areas.
|
||||||
* @param {Number} [jagged=2.0] - the level of sharpening to apply to "jagged" areas.
|
* @param {number} [jagged=2.0] - the level of sharpening to apply to "jagged" areas.
|
||||||
* @returns {Sharp}
|
* @returns {Sharp}
|
||||||
* @throws {Error} Invalid parameters
|
* @throws {Error} Invalid parameters
|
||||||
*/
|
*/
|
||||||
@ -129,7 +129,7 @@ function sharpen (sigma, flat, jagged) {
|
|||||||
/**
|
/**
|
||||||
* Apply median filter.
|
* Apply median filter.
|
||||||
* When used without parameters the default window is 3x3.
|
* When used without parameters the default window is 3x3.
|
||||||
* @param {Number} [size=3] square mask size: size x size
|
* @param {number} [size=3] square mask size: size x size
|
||||||
* @returns {Sharp}
|
* @returns {Sharp}
|
||||||
* @throws {Error} Invalid parameters
|
* @throws {Error} Invalid parameters
|
||||||
*/
|
*/
|
||||||
@ -150,7 +150,7 @@ function median (size) {
|
|||||||
* Blur the image.
|
* Blur the image.
|
||||||
* When used without parameters, performs a fast, mild blur of the output image.
|
* When used without parameters, performs a fast, mild blur of the output image.
|
||||||
* When a `sigma` is provided, performs a slower, more accurate Gaussian blur.
|
* When a `sigma` is provided, performs a slower, more accurate Gaussian blur.
|
||||||
* @param {Number} [sigma] a value between 0.3 and 1000 representing the sigma of the Gaussian mask, where `sigma = 1 + radius / 2`.
|
* @param {number} [sigma] a value between 0.3 and 1000 representing the sigma of the Gaussian mask, where `sigma = 1 + radius / 2`.
|
||||||
* @returns {Sharp}
|
* @returns {Sharp}
|
||||||
* @throws {Error} Invalid parameters
|
* @throws {Error} Invalid parameters
|
||||||
*/
|
*/
|
||||||
@ -173,7 +173,7 @@ function blur (sigma) {
|
|||||||
/**
|
/**
|
||||||
* Merge alpha transparency channel, if any, with a background.
|
* Merge alpha transparency channel, if any, with a background.
|
||||||
* @param {Object} [options]
|
* @param {Object} [options]
|
||||||
* @param {String|Object} [options.background={r: 0, g: 0, b: 0}] - background colour, parsed by the [color](https://www.npmjs.org/package/color) module, defaults to black.
|
* @param {string|Object} [options.background={r: 0, g: 0, b: 0}] - background colour, parsed by the [color](https://www.npmjs.org/package/color) module, defaults to black.
|
||||||
* @returns {Sharp}
|
* @returns {Sharp}
|
||||||
*/
|
*/
|
||||||
function flatten (options) {
|
function flatten (options) {
|
||||||
@ -193,8 +193,8 @@ function flatten (options) {
|
|||||||
*
|
*
|
||||||
* Supply a second argument to use a different output gamma value, otherwise the first value is used in both cases.
|
* Supply a second argument to use a different output gamma value, otherwise the first value is used in both cases.
|
||||||
*
|
*
|
||||||
* @param {Number} [gamma=2.2] value between 1.0 and 3.0.
|
* @param {number} [gamma=2.2] value between 1.0 and 3.0.
|
||||||
* @param {Number} [gammaOut] value between 1.0 and 3.0. (optional, defaults to same as `gamma`)
|
* @param {number} [gammaOut] value between 1.0 and 3.0. (optional, defaults to same as `gamma`)
|
||||||
* @returns {Sharp}
|
* @returns {Sharp}
|
||||||
* @throws {Error} Invalid parameters
|
* @throws {Error} Invalid parameters
|
||||||
*/
|
*/
|
||||||
@ -264,11 +264,11 @@ function normalize (normalize) {
|
|||||||
* });
|
* });
|
||||||
*
|
*
|
||||||
* @param {Object} kernel
|
* @param {Object} kernel
|
||||||
* @param {Number} kernel.width - width of the kernel in pixels.
|
* @param {number} kernel.width - width of the kernel in pixels.
|
||||||
* @param {Number} kernel.height - width of the kernel in pixels.
|
* @param {number} kernel.height - width of the kernel in pixels.
|
||||||
* @param {Array<Number>} kernel.kernel - Array of length `width*height` containing the kernel values.
|
* @param {Array<number>} kernel.kernel - Array of length `width*height` containing the kernel values.
|
||||||
* @param {Number} [kernel.scale=sum] - the scale of the kernel in pixels.
|
* @param {number} [kernel.scale=sum] - the scale of the kernel in pixels.
|
||||||
* @param {Number} [kernel.offset=0] - the offset of the kernel in pixels.
|
* @param {number} [kernel.offset=0] - the offset of the kernel in pixels.
|
||||||
* @returns {Sharp}
|
* @returns {Sharp}
|
||||||
* @throws {Error} Invalid parameters
|
* @throws {Error} Invalid parameters
|
||||||
*/
|
*/
|
||||||
@ -300,7 +300,7 @@ function convolve (kernel) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Any pixel value greather than or equal to the threshold value will be set to 255, otherwise it will be set to 0.
|
* Any pixel value greather than or equal to the threshold value will be set to 255, otherwise it will be set to 0.
|
||||||
* @param {Number} [threshold=128] - a value in the range 0-255 representing the level at which the threshold will be applied.
|
* @param {number} [threshold=128] - a value in the range 0-255 representing the level at which the threshold will be applied.
|
||||||
* @param {Object} [options]
|
* @param {Object} [options]
|
||||||
* @param {Boolean} [options.greyscale=true] - convert to single channel greyscale.
|
* @param {Boolean} [options.greyscale=true] - convert to single channel greyscale.
|
||||||
* @param {Boolean} [options.grayscale=true] - alternative spelling for greyscale.
|
* @param {Boolean} [options.grayscale=true] - alternative spelling for greyscale.
|
||||||
@ -331,13 +331,13 @@ function threshold (threshold, options) {
|
|||||||
* This operation creates an output image where each pixel is the result of
|
* This operation creates an output image where each pixel is the result of
|
||||||
* the selected bitwise boolean `operation` between the corresponding pixels of the input images.
|
* the selected bitwise boolean `operation` between the corresponding pixels of the input images.
|
||||||
*
|
*
|
||||||
* @param {Buffer|String} operand - Buffer containing image data or String containing the path to an image file.
|
* @param {Buffer|string} operand - Buffer containing image data or string containing the path to an image file.
|
||||||
* @param {String} operator - one of `and`, `or` or `eor` to perform that bitwise operation, like the C logic operators `&`, `|` and `^` respectively.
|
* @param {string} operator - one of `and`, `or` or `eor` to perform that bitwise operation, like the C logic operators `&`, `|` and `^` respectively.
|
||||||
* @param {Object} [options]
|
* @param {Object} [options]
|
||||||
* @param {Object} [options.raw] - describes operand when using raw pixel data.
|
* @param {Object} [options.raw] - describes operand when using raw pixel data.
|
||||||
* @param {Number} [options.raw.width]
|
* @param {number} [options.raw.width]
|
||||||
* @param {Number} [options.raw.height]
|
* @param {number} [options.raw.height]
|
||||||
* @param {Number} [options.raw.channels]
|
* @param {number} [options.raw.channels]
|
||||||
* @returns {Sharp}
|
* @returns {Sharp}
|
||||||
* @throws {Error} Invalid parameters
|
* @throws {Error} Invalid parameters
|
||||||
*/
|
*/
|
||||||
@ -353,8 +353,8 @@ function boolean (operand, operator, options) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply the linear formula a * input + b to the image (levels adjustment)
|
* Apply the linear formula a * input + b to the image (levels adjustment)
|
||||||
* @param {Number} [a=1.0] multiplier
|
* @param {number} [a=1.0] multiplier
|
||||||
* @param {Number} [b=0.0] offset
|
* @param {number} [b=0.0] offset
|
||||||
* @returns {Sharp}
|
* @returns {Sharp}
|
||||||
* @throws {Error} Invalid parameters
|
* @throws {Error} Invalid parameters
|
||||||
*/
|
*/
|
||||||
@ -394,7 +394,7 @@ function linear (a, b) {
|
|||||||
* // With this example input, a sepia filter has been applied
|
* // With this example input, a sepia filter has been applied
|
||||||
* });
|
* });
|
||||||
*
|
*
|
||||||
* @param {Array<Array<Number>>} 3x3 Recombination matrix
|
* @param {Array<Array<number>>} inputMatrix - 3x3 Recombination matrix
|
||||||
* @returns {Sharp}
|
* @returns {Sharp}
|
||||||
* @throws {Error} Invalid parameters
|
* @throws {Error} Invalid parameters
|
||||||
*/
|
*/
|
||||||
@ -440,9 +440,9 @@ function recomb (inputMatrix) {
|
|||||||
* });
|
* });
|
||||||
*
|
*
|
||||||
* @param {Object} [options]
|
* @param {Object} [options]
|
||||||
* @param {Number} [options.brightness] Brightness multiplier
|
* @param {number} [options.brightness] Brightness multiplier
|
||||||
* @param {Number} [options.saturation] Saturation multiplier
|
* @param {number} [options.saturation] Saturation multiplier
|
||||||
* @param {Number} [options.hue] Degrees for hue rotation
|
* @param {number} [options.hue] Degrees for hue rotation
|
||||||
* @returns {Sharp}
|
* @returns {Sharp}
|
||||||
*/
|
*/
|
||||||
function modulate (options) {
|
function modulate (options) {
|
||||||
|
118
lib/output.js
118
lib/output.js
@ -36,7 +36,7 @@ const formats = new Map([
|
|||||||
* .then(info => { ... })
|
* .then(info => { ... })
|
||||||
* .catch(err => { ... });
|
* .catch(err => { ... });
|
||||||
*
|
*
|
||||||
* @param {String} fileOut - the path to write the image data to.
|
* @param {string} fileOut - the path to write the image data to.
|
||||||
* @param {Function} [callback] - called on completion with two arguments `(err, info)`.
|
* @param {Function} [callback] - called on completion with two arguments `(err, info)`.
|
||||||
* `info` contains the output image `format`, `size` (bytes), `width`, `height`,
|
* `info` contains the output image `format`, `size` (bytes), `width`, `height`,
|
||||||
* `channels` and `premultiplied` (indicating if premultiplication was used).
|
* `channels` and `premultiplied` (indicating if premultiplication was used).
|
||||||
@ -103,7 +103,7 @@ function toFile (fileOut, callback) {
|
|||||||
* .catch(err => { ... });
|
* .catch(err => { ... });
|
||||||
*
|
*
|
||||||
* @param {Object} [options]
|
* @param {Object} [options]
|
||||||
* @param {Boolean} [options.resolveWithObject] Resolve the Promise with an Object containing `data` and `info` properties instead of resolving only with `data`.
|
* @param {boolean} [options.resolveWithObject] Resolve the Promise with an Object containing `data` and `info` properties instead of resolving only with `data`.
|
||||||
* @param {Function} [callback]
|
* @param {Function} [callback]
|
||||||
* @returns {Promise<Buffer>} - when no callback is provided
|
* @returns {Promise<Buffer>} - when no callback is provided
|
||||||
*/
|
*/
|
||||||
@ -130,7 +130,7 @@ function toBuffer (options, callback) {
|
|||||||
* .then(info => { ... });
|
* .then(info => { ... });
|
||||||
*
|
*
|
||||||
* @param {Object} [options]
|
* @param {Object} [options]
|
||||||
* @param {Number} [options.orientation] value between 1 and 8, used to update the EXIF `Orientation` tag.
|
* @param {number} [options.orientation] value between 1 and 8, used to update the EXIF `Orientation` tag.
|
||||||
* @returns {Sharp}
|
* @returns {Sharp}
|
||||||
* @throws {Error} Invalid parameters
|
* @throws {Error} Invalid parameters
|
||||||
*/
|
*/
|
||||||
@ -157,7 +157,7 @@ function withMetadata (options) {
|
|||||||
* .toFormat('png')
|
* .toFormat('png')
|
||||||
* .toBuffer();
|
* .toBuffer();
|
||||||
*
|
*
|
||||||
* @param {(String|Object)} format - as a String or an Object with an 'id' attribute
|
* @param {(string|Object)} format - as a string or an Object with an 'id' attribute
|
||||||
* @param {Object} options - output options
|
* @param {Object} options - output options
|
||||||
* @returns {Sharp}
|
* @returns {Sharp}
|
||||||
* @throws {Error} unsupported format or options
|
* @throws {Error} unsupported format or options
|
||||||
@ -183,18 +183,18 @@ function toFormat (format, options) {
|
|||||||
* .toBuffer();
|
* .toBuffer();
|
||||||
*
|
*
|
||||||
* @param {Object} [options] - output options
|
* @param {Object} [options] - output options
|
||||||
* @param {Number} [options.quality=80] - quality, integer 1-100
|
* @param {number} [options.quality=80] - quality, integer 1-100
|
||||||
* @param {Boolean} [options.progressive=false] - use progressive (interlace) scan
|
* @param {boolean} [options.progressive=false] - use progressive (interlace) scan
|
||||||
* @param {String} [options.chromaSubsampling='4:2:0'] - for quality < 90, set to '4:4:4' to prevent chroma subsampling otherwise defaults to '4:2:0' (use chroma subsampling); for quality >= 90 chroma is never subsampled
|
* @param {string} [options.chromaSubsampling='4:2:0'] - for quality < 90, set to '4:4:4' to prevent chroma subsampling otherwise defaults to '4:2:0' (use chroma subsampling); for quality >= 90 chroma is never subsampled
|
||||||
* @param {Boolean} [options.trellisQuantisation=false] - apply trellis quantisation, requires libvips compiled with support for mozjpeg
|
* @param {boolean} [options.trellisQuantisation=false] - apply trellis quantisation, requires libvips compiled with support for mozjpeg
|
||||||
* @param {Boolean} [options.overshootDeringing=false] - apply overshoot deringing, requires libvips compiled with support for mozjpeg
|
* @param {boolean} [options.overshootDeringing=false] - apply overshoot deringing, requires libvips compiled with support for mozjpeg
|
||||||
* @param {Boolean} [options.optimiseScans=false] - optimise progressive scans, forces progressive, requires libvips compiled with support for mozjpeg
|
* @param {boolean} [options.optimiseScans=false] - optimise progressive scans, forces progressive, requires libvips compiled with support for mozjpeg
|
||||||
* @param {Boolean} [options.optimizeScans=false] - alternative spelling of optimiseScans
|
* @param {boolean} [options.optimizeScans=false] - alternative spelling of optimiseScans
|
||||||
* @param {Boolean} [options.optimiseCoding=true] - optimise Huffman coding tables
|
* @param {boolean} [options.optimiseCoding=true] - optimise Huffman coding tables
|
||||||
* @param {Boolean} [options.optimizeCoding=true] - alternative spelling of optimiseCoding
|
* @param {boolean} [options.optimizeCoding=true] - alternative spelling of optimiseCoding
|
||||||
* @param {Number} [options.quantisationTable=0] - quantization table to use, integer 0-8, requires libvips compiled with support for mozjpeg
|
* @param {number} [options.quantisationTable=0] - quantization table to use, integer 0-8, requires libvips compiled with support for mozjpeg
|
||||||
* @param {Number} [options.quantizationTable=0] - alternative spelling of quantisationTable
|
* @param {number} [options.quantizationTable=0] - alternative spelling of quantisationTable
|
||||||
* @param {Boolean} [options.force=true] - force JPEG output, otherwise attempt to use input format
|
* @param {boolean} [options.force=true] - force JPEG output, otherwise attempt to use input format
|
||||||
* @returns {Sharp}
|
* @returns {Sharp}
|
||||||
* @throws {Error} Invalid options
|
* @throws {Error} Invalid options
|
||||||
*/
|
*/
|
||||||
@ -260,15 +260,15 @@ function jpeg (options) {
|
|||||||
* .toBuffer();
|
* .toBuffer();
|
||||||
*
|
*
|
||||||
* @param {Object} [options]
|
* @param {Object} [options]
|
||||||
* @param {Boolean} [options.progressive=false] - use progressive (interlace) scan
|
* @param {boolean} [options.progressive=false] - use progressive (interlace) scan
|
||||||
* @param {Number} [options.compressionLevel=9] - zlib compression level, 0-9
|
* @param {number} [options.compressionLevel=9] - zlib compression level, 0-9
|
||||||
* @param {Boolean} [options.adaptiveFiltering=false] - use adaptive row filtering
|
* @param {boolean} [options.adaptiveFiltering=false] - use adaptive row filtering
|
||||||
* @param {Boolean} [options.palette=false] - quantise to a palette-based image with alpha transparency support, requires libvips compiled with support for libimagequant
|
* @param {boolean} [options.palette=false] - quantise to a palette-based image with alpha transparency support, requires libvips compiled with support for libimagequant
|
||||||
* @param {Number} [options.quality=100] - use the lowest number of colours needed to achieve given quality, requires libvips compiled with support for libimagequant
|
* @param {number} [options.quality=100] - use the lowest number of colours needed to achieve given quality, requires libvips compiled with support for libimagequant
|
||||||
* @param {Number} [options.colours=256] - maximum number of palette entries, requires libvips compiled with support for libimagequant
|
* @param {number} [options.colours=256] - maximum number of palette entries, requires libvips compiled with support for libimagequant
|
||||||
* @param {Number} [options.colors=256] - alternative spelling of `options.colours`, requires libvips compiled with support for libimagequant
|
* @param {number} [options.colors=256] - alternative spelling of `options.colours`, requires libvips compiled with support for libimagequant
|
||||||
* @param {Number} [options.dither=1.0] - level of Floyd-Steinberg error diffusion, requires libvips compiled with support for libimagequant
|
* @param {number} [options.dither=1.0] - level of Floyd-Steinberg error diffusion, requires libvips compiled with support for libimagequant
|
||||||
* @param {Boolean} [options.force=true] - force PNG output, otherwise attempt to use input format
|
* @param {boolean} [options.force=true] - force PNG output, otherwise attempt to use input format
|
||||||
* @returns {Sharp}
|
* @returns {Sharp}
|
||||||
* @throws {Error} Invalid options
|
* @throws {Error} Invalid options
|
||||||
*/
|
*/
|
||||||
@ -328,13 +328,13 @@ function png (options) {
|
|||||||
* .toBuffer();
|
* .toBuffer();
|
||||||
*
|
*
|
||||||
* @param {Object} [options] - output options
|
* @param {Object} [options] - output options
|
||||||
* @param {Number} [options.quality=80] - quality, integer 1-100
|
* @param {number} [options.quality=80] - quality, integer 1-100
|
||||||
* @param {Number} [options.alphaQuality=100] - quality of alpha layer, integer 0-100
|
* @param {number} [options.alphaQuality=100] - quality of alpha layer, integer 0-100
|
||||||
* @param {Boolean} [options.lossless=false] - use lossless compression mode
|
* @param {boolean} [options.lossless=false] - use lossless compression mode
|
||||||
* @param {Boolean} [options.nearLossless=false] - use near_lossless compression mode
|
* @param {boolean} [options.nearLossless=false] - use near_lossless compression mode
|
||||||
* @param {Boolean} [options.smartSubsample=false] - use high quality chroma subsampling
|
* @param {boolean} [options.smartSubsample=false] - use high quality chroma subsampling
|
||||||
* @param {Number} [options.reductionEffort=4] - level of CPU effort to reduce file size, integer 0-6
|
* @param {number} [options.reductionEffort=4] - level of CPU effort to reduce file size, integer 0-6
|
||||||
* @param {Boolean} [options.force=true] - force WebP output, otherwise attempt to use input format
|
* @param {boolean} [options.force=true] - force WebP output, otherwise attempt to use input format
|
||||||
* @returns {Sharp}
|
* @returns {Sharp}
|
||||||
* @throws {Error} Invalid options
|
* @throws {Error} Invalid options
|
||||||
*/
|
*/
|
||||||
@ -386,17 +386,17 @@ function webp (options) {
|
|||||||
* .then(info => { ... });
|
* .then(info => { ... });
|
||||||
*
|
*
|
||||||
* @param {Object} [options] - output options
|
* @param {Object} [options] - output options
|
||||||
* @param {Number} [options.quality=80] - quality, integer 1-100
|
* @param {number} [options.quality=80] - quality, integer 1-100
|
||||||
* @param {Boolean} [options.force=true] - force TIFF output, otherwise attempt to use input format
|
* @param {boolean} [options.force=true] - force TIFF output, otherwise attempt to use input format
|
||||||
* @param {Boolean} [options.compression='jpeg'] - compression options: lzw, deflate, jpeg, ccittfax4
|
* @param {boolean} [options.compression='jpeg'] - compression options: lzw, deflate, jpeg, ccittfax4
|
||||||
* @param {Boolean} [options.predictor='horizontal'] - compression predictor options: none, horizontal, float
|
* @param {boolean} [options.predictor='horizontal'] - compression predictor options: none, horizontal, float
|
||||||
* @param {Boolean} [options.pyramid=false] - write an image pyramid
|
* @param {boolean} [options.pyramid=false] - write an image pyramid
|
||||||
* @param {Boolean} [options.tile=false] - write a tiled tiff
|
* @param {boolean} [options.tile=false] - write a tiled tiff
|
||||||
* @param {Boolean} [options.tileWidth=256] - horizontal tile size
|
* @param {boolean} [options.tileWidth=256] - horizontal tile size
|
||||||
* @param {Boolean} [options.tileHeight=256] - vertical tile size
|
* @param {boolean} [options.tileHeight=256] - vertical tile size
|
||||||
* @param {Number} [options.xres=1.0] - horizontal resolution in pixels/mm
|
* @param {number} [options.xres=1.0] - horizontal resolution in pixels/mm
|
||||||
* @param {Number} [options.yres=1.0] - vertical resolution in pixels/mm
|
* @param {number} [options.yres=1.0] - vertical resolution in pixels/mm
|
||||||
* @param {Boolean} [options.squash=false] - squash 8-bit images down to 1 bit
|
* @param {boolean} [options.squash=false] - squash 8-bit images down to 1 bit
|
||||||
* @returns {Sharp}
|
* @returns {Sharp}
|
||||||
* @throws {Error} Invalid options
|
* @throws {Error} Invalid options
|
||||||
*/
|
*/
|
||||||
@ -482,9 +482,9 @@ function tiff (options) {
|
|||||||
* @since 0.23.0
|
* @since 0.23.0
|
||||||
*
|
*
|
||||||
* @param {Object} [options] - output options
|
* @param {Object} [options] - output options
|
||||||
* @param {Number} [options.quality=80] - quality, integer 1-100
|
* @param {number} [options.quality=80] - quality, integer 1-100
|
||||||
* @param {Boolean} [options.compression='hevc'] - compression format: hevc, avc, jpeg, av1
|
* @param {boolean} [options.compression='hevc'] - compression format: hevc, avc, jpeg, av1
|
||||||
* @param {Boolean} [options.lossless=false] - use lossless compression
|
* @param {boolean} [options.lossless=false] - use lossless compression
|
||||||
* @returns {Sharp}
|
* @returns {Sharp}
|
||||||
* @throws {Error} Invalid options
|
* @throws {Error} Invalid options
|
||||||
*/
|
*/
|
||||||
@ -563,14 +563,14 @@ function raw () {
|
|||||||
* });
|
* });
|
||||||
*
|
*
|
||||||
* @param {Object} [options]
|
* @param {Object} [options]
|
||||||
* @param {Number} [options.size=256] tile size in pixels, a value between 1 and 8192.
|
* @param {number} [options.size=256] tile size in pixels, a value between 1 and 8192.
|
||||||
* @param {Number} [options.overlap=0] tile overlap in pixels, a value between 0 and 8192.
|
* @param {number} [options.overlap=0] tile overlap in pixels, a value between 0 and 8192.
|
||||||
* @param {Number} [options.angle=0] tile angle of rotation, must be a multiple of 90.
|
* @param {number} [options.angle=0] tile angle of rotation, must be a multiple of 90.
|
||||||
* @param {String|Object} [options.background={r: 255, g: 255, b: 255, alpha: 1}] - background colour, parsed by the [color](https://www.npmjs.org/package/color) module, defaults to white without transparency.
|
* @param {string|Object} [options.background={r: 255, g: 255, b: 255, alpha: 1}] - background colour, parsed by the [color](https://www.npmjs.org/package/color) module, defaults to white without transparency.
|
||||||
* @param {String} [options.depth] how deep to make the pyramid, possible values are `onepixel`, `onetile` or `one`, default based on layout.
|
* @param {string} [options.depth] how deep to make the pyramid, possible values are `onepixel`, `onetile` or `one`, default based on layout.
|
||||||
* @param {Number} [options.skipBlanks=-1] threshold to skip tile generation, a value 0 - 255 for 8-bit images or 0 - 65535 for 16-bit images
|
* @param {number} [options.skipBlanks=-1] threshold to skip tile generation, a value 0 - 255 for 8-bit images or 0 - 65535 for 16-bit images
|
||||||
* @param {String} [options.container='fs'] tile container, with value `fs` (filesystem) or `zip` (compressed file).
|
* @param {string} [options.container='fs'] tile container, with value `fs` (filesystem) or `zip` (compressed file).
|
||||||
* @param {String} [options.layout='dz'] filesystem layout, possible values are `dz`, `iiif`, `zoomify` or `google`.
|
* @param {string} [options.layout='dz'] filesystem layout, possible values are `dz`, `iiif`, `zoomify` or `google`.
|
||||||
* @returns {Sharp}
|
* @returns {Sharp}
|
||||||
* @throws {Error} Invalid parameters
|
* @throws {Error} Invalid parameters
|
||||||
*/
|
*/
|
||||||
@ -653,9 +653,9 @@ function tile (options) {
|
|||||||
* Update the output format unless options.force is false,
|
* Update the output format unless options.force is false,
|
||||||
* in which case revert to input format.
|
* in which case revert to input format.
|
||||||
* @private
|
* @private
|
||||||
* @param {String} formatOut
|
* @param {string} formatOut
|
||||||
* @param {Object} [options]
|
* @param {Object} [options]
|
||||||
* @param {Boolean} [options.force=true] - force output format, otherwise attempt to use input format
|
* @param {boolean} [options.force=true] - force output format, otherwise attempt to use input format
|
||||||
* @returns {Sharp}
|
* @returns {Sharp}
|
||||||
*/
|
*/
|
||||||
function _updateFormatOut (formatOut, options) {
|
function _updateFormatOut (formatOut, options) {
|
||||||
@ -666,10 +666,10 @@ function _updateFormatOut (formatOut, options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update a Boolean attribute of the this.options Object.
|
* Update a boolean attribute of the this.options Object.
|
||||||
* @private
|
* @private
|
||||||
* @param {String} key
|
* @param {string} key
|
||||||
* @param {Boolean} val
|
* @param {boolean} val
|
||||||
* @throws {Error} Invalid key
|
* @throws {Error} Invalid key
|
||||||
*/
|
*/
|
||||||
function _setBooleanOption (key, val) {
|
function _setBooleanOption (key, val) {
|
||||||
|
@ -190,8 +190,8 @@ function isRotationExpected (options) {
|
|||||||
* .toBuffer()
|
* .toBuffer()
|
||||||
* );
|
* );
|
||||||
*
|
*
|
||||||
* @param {Number} [width] - pixels wide the resultant image should be. Use `null` or `undefined` to auto-scale the width to match the height.
|
* @param {number} [width] - pixels wide the resultant image should be. Use `null` or `undefined` to auto-scale the width to match the height.
|
||||||
* @param {Number} [height] - pixels high the resultant image should be. Use `null` or `undefined` to auto-scale the height to match the width.
|
* @param {number} [height] - pixels high the resultant image should be. Use `null` or `undefined` to auto-scale the height to match the width.
|
||||||
* @param {Object} [options]
|
* @param {Object} [options]
|
||||||
* @param {String} [options.width] - alternative means of specifying `width`. If both are present this take priority.
|
* @param {String} [options.width] - alternative means of specifying `width`. If both are present this take priority.
|
||||||
* @param {String} [options.height] - alternative means of specifying `height`. If both are present this take priority.
|
* @param {String} [options.height] - alternative means of specifying `height`. If both are present this take priority.
|
||||||
@ -302,11 +302,11 @@ function resize (width, height, options) {
|
|||||||
* })
|
* })
|
||||||
* ...
|
* ...
|
||||||
*
|
*
|
||||||
* @param {(Number|Object)} extend - single pixel count to add to all edges or an Object with per-edge counts
|
* @param {(number|Object)} extend - single pixel count to add to all edges or an Object with per-edge counts
|
||||||
* @param {Number} [extend.top]
|
* @param {number} [extend.top]
|
||||||
* @param {Number} [extend.left]
|
* @param {number} [extend.left]
|
||||||
* @param {Number} [extend.bottom]
|
* @param {number} [extend.bottom]
|
||||||
* @param {Number} [extend.right]
|
* @param {number} [extend.right]
|
||||||
* @param {String|Object} [extend.background={r: 0, g: 0, b: 0, alpha: 1}] - background colour, parsed by the [color](https://www.npmjs.org/package/color) module, defaults to black without transparency.
|
* @param {String|Object} [extend.background={r: 0, g: 0, b: 0, alpha: 1}] - background colour, parsed by the [color](https://www.npmjs.org/package/color) module, defaults to black without transparency.
|
||||||
* @returns {Sharp}
|
* @returns {Sharp}
|
||||||
* @throws {Error} Invalid parameters
|
* @throws {Error} Invalid parameters
|
||||||
@ -358,10 +358,10 @@ function extend (extend) {
|
|||||||
* });
|
* });
|
||||||
*
|
*
|
||||||
* @param {Object} options - describes the region to extract using integral pixel values
|
* @param {Object} options - describes the region to extract using integral pixel values
|
||||||
* @param {Number} options.left - zero-indexed offset from left edge
|
* @param {number} options.left - zero-indexed offset from left edge
|
||||||
* @param {Number} options.top - zero-indexed offset from top edge
|
* @param {number} options.top - zero-indexed offset from top edge
|
||||||
* @param {Number} options.width - width of region to extract
|
* @param {number} options.width - width of region to extract
|
||||||
* @param {Number} options.height - height of region to extract
|
* @param {number} options.height - height of region to extract
|
||||||
* @returns {Sharp}
|
* @returns {Sharp}
|
||||||
* @throws {Error} Invalid parameters
|
* @throws {Error} Invalid parameters
|
||||||
*/
|
*/
|
||||||
@ -388,7 +388,7 @@ function extract (options) {
|
|||||||
*
|
*
|
||||||
* The `info` response Object will contain `trimOffsetLeft` and `trimOffsetTop` properties.
|
* The `info` response Object will contain `trimOffsetLeft` and `trimOffsetTop` properties.
|
||||||
*
|
*
|
||||||
* @param {Number} [threshold=10] the allowed difference from the top-left pixel, a number greater than zero.
|
* @param {number} [threshold=10] the allowed difference from the top-left pixel, a number greater than zero.
|
||||||
* @returns {Sharp}
|
* @returns {Sharp}
|
||||||
* @throws {Error} Invalid parameters
|
* @throws {Error} Invalid parameters
|
||||||
*/
|
*/
|
||||||
|
@ -39,10 +39,10 @@ try {
|
|||||||
* sharp.cache( { files: 0 } );
|
* sharp.cache( { files: 0 } );
|
||||||
* sharp.cache(false);
|
* sharp.cache(false);
|
||||||
*
|
*
|
||||||
* @param {Object|Boolean} [options=true] - Object with the following attributes, or Boolean where true uses default cache settings and false removes all caching
|
* @param {Object|boolean} [options=true] - Object with the following attributes, or boolean where true uses default cache settings and false removes all caching
|
||||||
* @param {Number} [options.memory=50] - is the maximum memory in MB to use for this cache
|
* @param {number} [options.memory=50] - is the maximum memory in MB to use for this cache
|
||||||
* @param {Number} [options.files=20] - is the maximum number of files to hold open
|
* @param {number} [options.files=20] - is the maximum number of files to hold open
|
||||||
* @param {Number} [options.items=100] - is the maximum number of operations to cache
|
* @param {number} [options.items=100] - is the maximum number of operations to cache
|
||||||
* @returns {Object}
|
* @returns {Object}
|
||||||
*/
|
*/
|
||||||
function cache (options) {
|
function cache (options) {
|
||||||
@ -77,8 +77,8 @@ cache(true);
|
|||||||
* sharp.concurrency(2); // 2
|
* sharp.concurrency(2); // 2
|
||||||
* sharp.concurrency(0); // 4
|
* sharp.concurrency(0); // 4
|
||||||
*
|
*
|
||||||
* @param {Number} [concurrency]
|
* @param {number} [concurrency]
|
||||||
* @returns {Number} concurrency
|
* @returns {number} concurrency
|
||||||
*/
|
*/
|
||||||
function concurrency (concurrency) {
|
function concurrency (concurrency) {
|
||||||
return sharp.concurrency(is.integer(concurrency) ? concurrency : null);
|
return sharp.concurrency(is.integer(concurrency) ? concurrency : null);
|
||||||
@ -124,8 +124,8 @@ function counters () {
|
|||||||
* const simd = sharp.simd(false);
|
* const simd = sharp.simd(false);
|
||||||
* // prevent libvips from using liborc at runtime
|
* // prevent libvips from using liborc at runtime
|
||||||
*
|
*
|
||||||
* @param {Boolean} [simd=true]
|
* @param {boolean} [simd=true]
|
||||||
* @returns {Boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
function simd (simd) {
|
function simd (simd) {
|
||||||
return sharp.simd(is.bool(simd) ? simd : null);
|
return sharp.simd(is.bool(simd) ? simd : null);
|
||||||
|
@ -76,7 +76,7 @@
|
|||||||
"test-licensing": "license-checker --production --summary --onlyAllow=\"Apache-2.0;BSD;ISC;MIT\"",
|
"test-licensing": "license-checker --production --summary --onlyAllow=\"Apache-2.0;BSD;ISC;MIT\"",
|
||||||
"test-coverage": "./test/coverage/report.sh",
|
"test-coverage": "./test/coverage/report.sh",
|
||||||
"test-leak": "./test/leak/leak.sh",
|
"test-leak": "./test/leak/leak.sh",
|
||||||
"docs-build": "for m in constructor input resize composite operation colour channel output utility; do documentation build --shallow --format=md --markdown-toc=false lib/$m.js >docs/api-$m.md; done && node docs/search-index/build",
|
"docs-build": "documentation lint lib && for m in constructor input resize composite operation colour channel output utility; do documentation build --shallow --format=md --markdown-toc=false lib/$m.js >docs/api-$m.md; done && node docs/search-index/build",
|
||||||
"docs-serve": "cd docs && npx serve",
|
"docs-serve": "cd docs && npx serve",
|
||||||
"docs-publish": "cd docs && npx firebase-tools deploy --project pixelplumbing --only hosting:pixelplumbing-sharp"
|
"docs-publish": "cd docs && npx firebase-tools deploy --project pixelplumbing --only hosting:pixelplumbing-sharp"
|
||||||
},
|
},
|
||||||
@ -122,7 +122,7 @@
|
|||||||
"async": "^3.2.0",
|
"async": "^3.2.0",
|
||||||
"cc": "^2.0.1",
|
"cc": "^2.0.1",
|
||||||
"decompress-zip": "^0.3.2",
|
"decompress-zip": "^0.3.2",
|
||||||
"documentation": "^12.3.0",
|
"documentation": "^13.0.0",
|
||||||
"exif-reader": "^1.0.3",
|
"exif-reader": "^1.0.3",
|
||||||
"icc": "^1.0.0",
|
"icc": "^1.0.0",
|
||||||
"license-checker": "^25.0.1",
|
"license-checker": "^25.0.1",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user