mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 10:30:15 +02:00
Bump devDeps, requires doc refresh
This commit is contained in:
parent
cc9f91f37c
commit
b9261c243c
@ -16,7 +16,7 @@ sharp('rgba.png')
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp** 
|
||||||
|
|
||||||
## ensureAlpha
|
## ensureAlpha
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ const rgba = await sharp(rgb)
|
|||||||
|
|
||||||
* Throws **[Error][3]** Invalid alpha transparency level
|
* Throws **[Error][3]** Invalid alpha transparency level
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp** 
|
||||||
|
|
||||||
**Meta**
|
**Meta**
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ const [red1, red2, ...] = await sharp(input)
|
|||||||
|
|
||||||
* Throws **[Error][3]** Invalid channel
|
* Throws **[Error][3]** Invalid channel
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp** 
|
||||||
|
|
||||||
## joinChannel
|
## joinChannel
|
||||||
|
|
||||||
@ -104,7 +104,7 @@ For raw pixel input, the `options` object should contain a `raw` attribute, whic
|
|||||||
|
|
||||||
* Throws **[Error][3]** Invalid parameters
|
* Throws **[Error][3]** Invalid parameters
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp** 
|
||||||
|
|
||||||
## bandbool
|
## bandbool
|
||||||
|
|
||||||
@ -128,7 +128,7 @@ sharp('3-channel-rgb-input.png')
|
|||||||
|
|
||||||
* Throws **[Error][3]** Invalid parameters
|
* Throws **[Error][3]** Invalid parameters
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp** 
|
||||||
|
|
||||||
[1]: /api-operation#flatten
|
[1]: /api-operation#flatten
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ const output = await sharp(input)
|
|||||||
|
|
||||||
* Throws **[Error][4]** Invalid parameter
|
* Throws **[Error][4]** Invalid parameter
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp** 
|
||||||
|
|
||||||
## greyscale
|
## greyscale
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ An alpha channel may be present, and will be unchanged by the operation.
|
|||||||
const output = await sharp(input).greyscale().toBuffer();
|
const output = await sharp(input).greyscale().toBuffer();
|
||||||
```
|
```
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp** 
|
||||||
|
|
||||||
## grayscale
|
## grayscale
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ Alternative spelling of `greyscale`.
|
|||||||
|
|
||||||
* `grayscale` **[Boolean][5]** (optional, default `true`)
|
* `grayscale` **[Boolean][5]** (optional, default `true`)
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp** 
|
||||||
|
|
||||||
## pipelineColourspace
|
## pipelineColourspace
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ await sharp(input)
|
|||||||
|
|
||||||
* Throws **[Error][4]** Invalid parameters
|
* Throws **[Error][4]** Invalid parameters
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp** 
|
||||||
|
|
||||||
**Meta**
|
**Meta**
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ Alternative spelling of `pipelineColourspace`.
|
|||||||
|
|
||||||
* Throws **[Error][4]** Invalid parameters
|
* Throws **[Error][4]** Invalid parameters
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp** 
|
||||||
|
|
||||||
## toColourspace
|
## toColourspace
|
||||||
|
|
||||||
@ -117,7 +117,7 @@ await sharp(input)
|
|||||||
|
|
||||||
* Throws **[Error][4]** Invalid parameters
|
* Throws **[Error][4]** Invalid parameters
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp** 
|
||||||
|
|
||||||
## toColorspace
|
## toColorspace
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ Alternative spelling of `toColourspace`.
|
|||||||
|
|
||||||
* Throws **[Error][4]** Invalid parameters
|
* Throws **[Error][4]** Invalid parameters
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp** 
|
||||||
|
|
||||||
[1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
[1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
||||||
|
|
||||||
|
@ -25,8 +25,8 @@ and [https://www.cairographics.org/operators/][2]
|
|||||||
|
|
||||||
* `images[].input.create` **[Object][4]?** describes a blank overlay to be created.
|
* `images[].input.create` **[Object][4]?** describes a blank overlay to be created.
|
||||||
|
|
||||||
* `images[].input.create.width` **[Number][7]?**
|
* `images[].input.create.width` **[Number][7]?** 
|
||||||
* `images[].input.create.height` **[Number][7]?**
|
* `images[].input.create.height` **[Number][7]?** 
|
||||||
* `images[].input.create.channels` **[Number][7]?** 3-4
|
* `images[].input.create.channels` **[Number][7]?** 3-4
|
||||||
* `images[].input.create.background` **([String][6] | [Object][4])?** parsed by the [color][8] module to extract values for red, green, blue and alpha.
|
* `images[].input.create.background` **([String][6] | [Object][4])?** parsed by the [color][8] module to extract values for red, green, blue and alpha.
|
||||||
* `images[].input.text` **[Object][4]?** describes a new text image to be created.
|
* `images[].input.text` **[Object][4]?** describes a new text image to be created.
|
||||||
@ -50,9 +50,9 @@ and [https://www.cairographics.org/operators/][2]
|
|||||||
* `images[].density` **[Number][7]** number representing the DPI for vector overlay image. (optional, default `72`)
|
* `images[].density` **[Number][7]** number representing the DPI for vector overlay image. (optional, default `72`)
|
||||||
* `images[].raw` **[Object][4]?** describes overlay when using raw pixel data.
|
* `images[].raw` **[Object][4]?** describes overlay when using raw pixel data.
|
||||||
|
|
||||||
* `images[].raw.width` **[Number][7]?**
|
* `images[].raw.width` **[Number][7]?** 
|
||||||
* `images[].raw.height` **[Number][7]?**
|
* `images[].raw.height` **[Number][7]?** 
|
||||||
* `images[].raw.channels` **[Number][7]?**
|
* `images[].raw.channels` **[Number][7]?** 
|
||||||
* `images[].animated` **[boolean][9]** Set to `true` to read all frames/pages of an animated image. (optional, default `false`)
|
* `images[].animated` **[boolean][9]** Set to `true` to read all frames/pages of an animated image. (optional, default `false`)
|
||||||
* `images[].failOn` **[string][6]** @see [constructor parameters][10] (optional, default `'warning'`)
|
* `images[].failOn` **[string][6]** @see [constructor parameters][10] (optional, default `'warning'`)
|
||||||
* `images[].limitInputPixels` **([number][7] | [boolean][9])** @see [constructor parameters][10] (optional, default `268402689`)
|
* `images[].limitInputPixels` **([number][7] | [boolean][9])** @see [constructor parameters][10] (optional, default `268402689`)
|
||||||
@ -95,7 +95,7 @@ sharp('input.png')
|
|||||||
|
|
||||||
* Throws **[Error][11]** Invalid parameters
|
* Throws **[Error][11]** Invalid parameters
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp** 
|
||||||
|
|
||||||
**Meta**
|
**Meta**
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ await sharp({
|
|||||||
|
|
||||||
* Throws **[Error][17]** Invalid parameters
|
* Throws **[Error][17]** Invalid parameters
|
||||||
|
|
||||||
Returns **[Sharp][18]**
|
Returns **[Sharp][18]** 
|
||||||
|
|
||||||
## clone
|
## clone
|
||||||
|
|
||||||
@ -230,7 +230,7 @@ Promise.all(promises)
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
Returns **[Sharp][18]**
|
Returns **[Sharp][18]** 
|
||||||
|
|
||||||
[1]: http://nodejs.org/api/stream.html#stream_class_stream_duplex
|
[1]: http://nodejs.org/api/stream.html#stream_class_stream_duplex
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ A `Promise` is returned when `callback` is not provided.
|
|||||||
* `icc`: Buffer containing raw [ICC][3] profile data, if present
|
* `icc`: Buffer containing raw [ICC][3] profile data, if present
|
||||||
* `iptc`: Buffer containing raw IPTC data, if present
|
* `iptc`: Buffer containing raw IPTC data, if present
|
||||||
* `xmp`: Buffer containing raw XMP data, if present
|
* `xmp`: Buffer containing raw XMP data, if present
|
||||||
* `tifftagPhotoshop`: Buffer containing raw TIFFTAG_PHOTOSHOP data, if present
|
* `tifftagPhotoshop`: Buffer containing raw TIFFTAG\_PHOTOSHOP data, if present
|
||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ function getNormalSize({ width, height, orientation }) {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Returns **([Promise][5]<[Object][6]> | Sharp)**
|
Returns **([Promise][5]<[Object][6]> | Sharp)** 
|
||||||
|
|
||||||
## stats
|
## stats
|
||||||
|
|
||||||
@ -129,7 +129,7 @@ const part = await image.extract(region).toBuffer();
|
|||||||
const stats = await sharp(part).stats();
|
const stats = await sharp(part).stats();
|
||||||
```
|
```
|
||||||
|
|
||||||
Returns **[Promise][5]<[Object][6]>**
|
Returns **[Promise][5]<[Object][6]>** 
|
||||||
|
|
||||||
[1]: https://www.libvips.org/API/current/VipsImage.html#VipsInterpretation
|
[1]: https://www.libvips.org/API/current/VipsImage.html#VipsInterpretation
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ const resizeThenRotate = await sharp(input)
|
|||||||
|
|
||||||
* Throws **[Error][5]** Invalid parameters
|
* Throws **[Error][5]** Invalid parameters
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp** 
|
||||||
|
|
||||||
## flip
|
## flip
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ The use of `flip` implies the removal of the EXIF `Orientation` tag, if any.
|
|||||||
const output = await sharp(input).flip().toBuffer();
|
const output = await sharp(input).flip().toBuffer();
|
||||||
```
|
```
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp** 
|
||||||
|
|
||||||
## flop
|
## flop
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ The use of `flop` implies the removal of the EXIF `Orientation` tag, if any.
|
|||||||
const output = await sharp(input).flop().toBuffer();
|
const output = await sharp(input).flop().toBuffer();
|
||||||
```
|
```
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp** 
|
||||||
|
|
||||||
## affine
|
## affine
|
||||||
|
|
||||||
@ -142,7 +142,7 @@ inputStream
|
|||||||
|
|
||||||
* Throws **[Error][5]** Invalid parameters
|
* Throws **[Error][5]** Invalid parameters
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp** 
|
||||||
|
|
||||||
**Meta**
|
**Meta**
|
||||||
|
|
||||||
@ -195,7 +195,7 @@ const data = await sharp(input)
|
|||||||
|
|
||||||
* Throws **[Error][5]** Invalid parameters
|
* Throws **[Error][5]** Invalid parameters
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp** 
|
||||||
|
|
||||||
## median
|
## median
|
||||||
|
|
||||||
@ -218,7 +218,7 @@ const output = await sharp(input).median(5).toBuffer();
|
|||||||
|
|
||||||
* Throws **[Error][5]** Invalid parameters
|
* Throws **[Error][5]** Invalid parameters
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp** 
|
||||||
|
|
||||||
## blur
|
## blur
|
||||||
|
|
||||||
@ -248,7 +248,7 @@ const gaussianBlurred = await sharp(input)
|
|||||||
|
|
||||||
* Throws **[Error][5]** Invalid parameters
|
* Throws **[Error][5]** Invalid parameters
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp** 
|
||||||
|
|
||||||
## flatten
|
## flatten
|
||||||
|
|
||||||
@ -258,7 +258,7 @@ See also [removeAlpha][9].
|
|||||||
|
|
||||||
### 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}`)
|
||||||
|
|
||||||
@ -270,7 +270,7 @@ await sharp(rgbaInput)
|
|||||||
.toBuffer();
|
.toBuffer();
|
||||||
```
|
```
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp** 
|
||||||
|
|
||||||
## gamma
|
## gamma
|
||||||
|
|
||||||
@ -291,7 +291,7 @@ Supply a second argument to use a different output gamma value, otherwise the fi
|
|||||||
|
|
||||||
* Throws **[Error][5]** Invalid parameters
|
* Throws **[Error][5]** Invalid parameters
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp** 
|
||||||
|
|
||||||
## negate
|
## negate
|
||||||
|
|
||||||
@ -299,7 +299,7 @@ Produce the "negative" of the image.
|
|||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
* `options` **[Object][2]?**
|
* `options` **[Object][2]?** 
|
||||||
|
|
||||||
* `options.alpha` **[Boolean][6]** Whether or not to negate any alpha channel (optional, default `true`)
|
* `options.alpha` **[Boolean][6]** Whether or not to negate any alpha channel (optional, default `true`)
|
||||||
|
|
||||||
@ -317,7 +317,7 @@ const output = await sharp(input)
|
|||||||
.toBuffer();
|
.toBuffer();
|
||||||
```
|
```
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp** 
|
||||||
|
|
||||||
## normalise
|
## normalise
|
||||||
|
|
||||||
@ -333,7 +333,7 @@ Enhance output image contrast by stretching its luminance to cover the full dyna
|
|||||||
const output = await sharp(input).normalise().toBuffer();
|
const output = await sharp(input).normalise().toBuffer();
|
||||||
```
|
```
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp** 
|
||||||
|
|
||||||
## normalize
|
## normalize
|
||||||
|
|
||||||
@ -349,7 +349,7 @@ Alternative spelling of normalise.
|
|||||||
const output = await sharp(input).normalize().toBuffer();
|
const output = await sharp(input).normalize().toBuffer();
|
||||||
```
|
```
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp** 
|
||||||
|
|
||||||
## clahe
|
## clahe
|
||||||
|
|
||||||
@ -360,7 +360,7 @@ This will, in general, enhance the clarity of the image by bringing out darker d
|
|||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
* `options` **[Object][2]**
|
* `options` **[Object][2]** 
|
||||||
|
|
||||||
* `options.width` **[number][1]** integer width of the region in pixels.
|
* `options.width` **[number][1]** integer width of the region in pixels.
|
||||||
* `options.height` **[number][1]** integer height of the region in pixels.
|
* `options.height` **[number][1]** integer height of the region in pixels.
|
||||||
@ -381,7 +381,7 @@ const output = await sharp(input)
|
|||||||
|
|
||||||
* Throws **[Error][5]** Invalid parameters
|
* Throws **[Error][5]** Invalid parameters
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp** 
|
||||||
|
|
||||||
**Meta**
|
**Meta**
|
||||||
|
|
||||||
@ -393,7 +393,7 @@ 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]** height of the kernel in pixels.
|
* `kernel.height` **[number][1]** height of the kernel in pixels.
|
||||||
@ -419,7 +419,7 @@ sharp(input)
|
|||||||
|
|
||||||
* Throws **[Error][5]** Invalid parameters
|
* Throws **[Error][5]** Invalid parameters
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp** 
|
||||||
|
|
||||||
## threshold
|
## threshold
|
||||||
|
|
||||||
@ -428,7 +428,7 @@ Any pixel value greater 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`)
|
||||||
@ -437,7 +437,7 @@ Any pixel value greater than or equal to the threshold value will be set to 255,
|
|||||||
|
|
||||||
* Throws **[Error][5]** Invalid parameters
|
* Throws **[Error][5]** Invalid parameters
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp** 
|
||||||
|
|
||||||
## boolean
|
## boolean
|
||||||
|
|
||||||
@ -450,19 +450,19 @@ the selected bitwise boolean `operation` between the corresponding pixels of the
|
|||||||
|
|
||||||
* `operand` **([Buffer][11] | [string][3])** Buffer containing image data or string containing the path to an image file.
|
* `operand` **([Buffer][11] | [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
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp** 
|
||||||
|
|
||||||
## linear
|
## linear
|
||||||
|
|
||||||
@ -477,7 +477,7 @@ Apply the linear formula a \* input + b to the image (levels adjustment)
|
|||||||
|
|
||||||
* Throws **[Error][5]** Invalid parameters
|
* Throws **[Error][5]** Invalid parameters
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp** 
|
||||||
|
|
||||||
## recomb
|
## recomb
|
||||||
|
|
||||||
@ -505,7 +505,7 @@ sharp(input)
|
|||||||
|
|
||||||
* Throws **[Error][5]** Invalid parameters
|
* Throws **[Error][5]** Invalid parameters
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp** 
|
||||||
|
|
||||||
**Meta**
|
**Meta**
|
||||||
|
|
||||||
@ -519,7 +519,7 @@ brightness is multiplicative whereas lightness is additive.
|
|||||||
|
|
||||||
### 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
|
||||||
@ -566,7 +566,7 @@ const output = await sharp(input)
|
|||||||
.toBuffer();
|
.toBuffer();
|
||||||
```
|
```
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp** 
|
||||||
|
|
||||||
**Meta**
|
**Meta**
|
||||||
|
|
||||||
|
@ -59,19 +59,18 @@ See [withMetadata][1] for control over this.
|
|||||||
* `err` is an error, if any.
|
* `err` is an error, if any.
|
||||||
* `data` is the output image data.
|
* `data` is the output image data.
|
||||||
* `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).
|
When using a crop strategy also contains `cropOffsetLeft` and `cropOffsetTop`.
|
||||||
When using a crop strategy also contains `cropOffsetLeft` and `cropOffsetTop`.
|
May also contain `textAutofitDpi` (dpi the font was rendered at) if image was created from text.
|
||||||
May also contain `textAutofitDpi` (dpi the font was rendered at) if image was created from text.
|
|
||||||
|
|
||||||
A `Promise` is returned when `callback` is not provided.
|
A `Promise` is returned when `callback` is not provided.
|
||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
* `options` **[Object][6]?**
|
* `options` **[Object][6]?** 
|
||||||
|
|
||||||
* `options.resolveWithObject` **[boolean][10]?** Resolve the Promise with an Object containing `data` and `info` properties instead of resolving only with `data`.
|
* `options.resolveWithObject` **[boolean][10]?** 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
|
||||||
|
|
||||||
@ -127,7 +126,7 @@ EXIF metadata is unsupported for TIFF output.
|
|||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
* `options` **[Object][6]?**
|
* `options` **[Object][6]?** 
|
||||||
|
|
||||||
* `options.orientation` **[number][12]?** value between 1 and 8, used to update the EXIF `Orientation` tag.
|
* `options.orientation` **[number][12]?** value between 1 and 8, used to update the EXIF `Orientation` tag.
|
||||||
* `options.icc` **[string][2]?** filesystem path to output ICC profile, defaults to sRGB.
|
* `options.icc` **[string][2]?** filesystem path to output ICC profile, defaults to sRGB.
|
||||||
@ -165,7 +164,7 @@ const data = await sharp(input)
|
|||||||
|
|
||||||
* Throws **[Error][4]** Invalid parameters
|
* Throws **[Error][4]** Invalid parameters
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp** 
|
||||||
|
|
||||||
## toFormat
|
## toFormat
|
||||||
|
|
||||||
@ -187,7 +186,7 @@ const data = await sharp(input)
|
|||||||
|
|
||||||
* Throws **[Error][4]** unsupported format or options
|
* Throws **[Error][4]** unsupported format or options
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp** 
|
||||||
|
|
||||||
## jpeg
|
## jpeg
|
||||||
|
|
||||||
@ -232,7 +231,7 @@ const data = await sharp(input)
|
|||||||
|
|
||||||
* Throws **[Error][4]** Invalid options
|
* Throws **[Error][4]** Invalid options
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp** 
|
||||||
|
|
||||||
## png
|
## png
|
||||||
|
|
||||||
@ -244,7 +243,7 @@ Set `palette` to `true` for slower, indexed PNG output.
|
|||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
* `options` **[Object][6]?**
|
* `options` **[Object][6]?** 
|
||||||
|
|
||||||
* `options.progressive` **[boolean][10]** use progressive (interlace) scan (optional, default `false`)
|
* `options.progressive` **[boolean][10]** use progressive (interlace) scan (optional, default `false`)
|
||||||
* `options.compressionLevel` **[number][12]** zlib compression level, 0 (fastest, largest) to 9 (slowest, smallest) (optional, default `6`)
|
* `options.compressionLevel` **[number][12]** zlib compression level, 0 (fastest, largest) to 9 (slowest, smallest) (optional, default `6`)
|
||||||
@ -275,7 +274,7 @@ const data = await sharp(input)
|
|||||||
|
|
||||||
* Throws **[Error][4]** Invalid options
|
* Throws **[Error][4]** Invalid options
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp** 
|
||||||
|
|
||||||
## webp
|
## webp
|
||||||
|
|
||||||
@ -288,7 +287,7 @@ Use these WebP options for output image.
|
|||||||
* `options.quality` **[number][12]** quality, integer 1-100 (optional, default `80`)
|
* `options.quality` **[number][12]** quality, integer 1-100 (optional, default `80`)
|
||||||
* `options.alphaQuality` **[number][12]** quality of alpha layer, integer 0-100 (optional, default `100`)
|
* `options.alphaQuality` **[number][12]** quality of alpha layer, integer 0-100 (optional, default `100`)
|
||||||
* `options.lossless` **[boolean][10]** use lossless compression mode (optional, default `false`)
|
* `options.lossless` **[boolean][10]** use lossless compression mode (optional, default `false`)
|
||||||
* `options.nearLossless` **[boolean][10]** use near_lossless compression mode (optional, default `false`)
|
* `options.nearLossless` **[boolean][10]** use near\_lossless compression mode (optional, default `false`)
|
||||||
* `options.smartSubsample` **[boolean][10]** use high quality chroma subsampling (optional, default `false`)
|
* `options.smartSubsample` **[boolean][10]** use high quality chroma subsampling (optional, default `false`)
|
||||||
* `options.effort` **[number][12]** CPU effort, between 0 (fastest) and 6 (slowest) (optional, default `4`)
|
* `options.effort` **[number][12]** CPU effort, between 0 (fastest) and 6 (slowest) (optional, default `4`)
|
||||||
* `options.loop` **[number][12]** number of animation iterations, use 0 for infinite animation (optional, default `0`)
|
* `options.loop` **[number][12]** number of animation iterations, use 0 for infinite animation (optional, default `0`)
|
||||||
@ -315,7 +314,7 @@ const outputWebp = await sharp(inputWebp, { animated: true })
|
|||||||
|
|
||||||
* Throws **[Error][4]** Invalid options
|
* Throws **[Error][4]** Invalid options
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp** 
|
||||||
|
|
||||||
## gif
|
## gif
|
||||||
|
|
||||||
@ -364,7 +363,7 @@ const out = await sharp('in.gif', { animated: true })
|
|||||||
|
|
||||||
* Throws **[Error][4]** Invalid options
|
* Throws **[Error][4]** Invalid options
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp** 
|
||||||
|
|
||||||
**Meta**
|
**Meta**
|
||||||
|
|
||||||
@ -409,7 +408,7 @@ const data = await sharp(input)
|
|||||||
|
|
||||||
* Throws **[Error][4]** Invalid options
|
* Throws **[Error][4]** Invalid options
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp** 
|
||||||
|
|
||||||
**Meta**
|
**Meta**
|
||||||
|
|
||||||
@ -453,7 +452,7 @@ sharp('input.svg')
|
|||||||
|
|
||||||
* Throws **[Error][4]** Invalid options
|
* Throws **[Error][4]** Invalid options
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp** 
|
||||||
|
|
||||||
## avif
|
## avif
|
||||||
|
|
||||||
@ -477,7 +476,7 @@ AVIF image sequences are not supported.
|
|||||||
|
|
||||||
* Throws **[Error][4]** Invalid options
|
* Throws **[Error][4]** Invalid options
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp** 
|
||||||
|
|
||||||
**Meta**
|
**Meta**
|
||||||
|
|
||||||
@ -504,7 +503,7 @@ globally-installed libvips compiled with support for libheif, libde265 and x265.
|
|||||||
|
|
||||||
* Throws **[Error][4]** Invalid options
|
* Throws **[Error][4]** Invalid options
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp** 
|
||||||
|
|
||||||
**Meta**
|
**Meta**
|
||||||
|
|
||||||
@ -554,7 +553,7 @@ The container will be set to `zip` when the output is a Buffer or Stream, otherw
|
|||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
* `options` **[Object][6]?**
|
* `options` **[Object][6]?** 
|
||||||
|
|
||||||
* `options.size` **[number][12]** tile size in pixels, a value between 1 and 8192. (optional, default `256`)
|
* `options.size` **[number][12]** tile size in pixels, a value between 1 and 8192. (optional, default `256`)
|
||||||
* `options.overlap` **[number][12]** tile overlap in pixels, a value between 0 and 8192. (optional, default `0`)
|
* `options.overlap` **[number][12]** tile overlap in pixels, a value between 0 and 8192. (optional, default `0`)
|
||||||
@ -598,7 +597,7 @@ readableStream
|
|||||||
|
|
||||||
* Throws **[Error][4]** Invalid parameters
|
* Throws **[Error][4]** Invalid parameters
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp** 
|
||||||
|
|
||||||
## timeout
|
## timeout
|
||||||
|
|
||||||
@ -610,7 +609,7 @@ Time spent waiting for a libuv thread to become available is not included.
|
|||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
* `options` **[Object][6]**
|
* `options` **[Object][6]** 
|
||||||
|
|
||||||
* `options.seconds` **[number][12]** Number of seconds after which processing will be stopped
|
* `options.seconds` **[number][12]** Number of seconds after which processing will be stopped
|
||||||
|
|
||||||
@ -628,7 +627,7 @@ try {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp** 
|
||||||
|
|
||||||
**Meta**
|
**Meta**
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ Previous calls to `resize` in the same pipeline will be ignored.
|
|||||||
|
|
||||||
* `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.
|
||||||
@ -147,7 +147,7 @@ const scaleByHalf = await sharp(input)
|
|||||||
|
|
||||||
* Throws **[Error][13]** Invalid parameters
|
* Throws **[Error][13]** Invalid parameters
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp** 
|
||||||
|
|
||||||
## extend
|
## extend
|
||||||
|
|
||||||
@ -193,7 +193,7 @@ sharp(input)
|
|||||||
|
|
||||||
* Throws **[Error][13]** Invalid parameters
|
* Throws **[Error][13]** Invalid parameters
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp** 
|
||||||
|
|
||||||
## extract
|
## extract
|
||||||
|
|
||||||
@ -234,7 +234,7 @@ sharp(input)
|
|||||||
|
|
||||||
* Throws **[Error][13]** Invalid parameters
|
* Throws **[Error][13]** Invalid parameters
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp** 
|
||||||
|
|
||||||
## trim
|
## trim
|
||||||
|
|
||||||
@ -255,7 +255,7 @@ will contain `trimOffsetLeft` and `trimOffsetTop` properties.
|
|||||||
|
|
||||||
* Throws **[Error][13]** Invalid parameters
|
* Throws **[Error][13]** Invalid parameters
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp** 
|
||||||
|
|
||||||
[1]: https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit
|
[1]: https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ An Object containing nested boolean values representing the available input and
|
|||||||
console.log(sharp.format);
|
console.log(sharp.format);
|
||||||
```
|
```
|
||||||
|
|
||||||
Returns **[Object][1]**
|
Returns **[Object][1]** 
|
||||||
|
|
||||||
## interpolators
|
## interpolators
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ sharp.cache( { files: 0 } );
|
|||||||
sharp.cache(false);
|
sharp.cache(false);
|
||||||
```
|
```
|
||||||
|
|
||||||
Returns **[Object][1]**
|
Returns **[Object][1]** 
|
||||||
|
|
||||||
## concurrency
|
## concurrency
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ The maximum number of images that sharp can process in parallel
|
|||||||
is controlled by libuv's `UV_THREADPOOL_SIZE` environment variable,
|
is controlled by libuv's `UV_THREADPOOL_SIZE` environment variable,
|
||||||
which defaults to 4.
|
which defaults to 4.
|
||||||
|
|
||||||
[https://nodejs.org/api/cli.html#uv_threadpool_sizesize][12]
|
[https://nodejs.org/api/cli.html#uv\_threadpool\_sizesize][12]
|
||||||
|
|
||||||
For example, by default, a machine with 8 CPU cores will process
|
For example, by default, a machine with 8 CPU cores will process
|
||||||
4 images in parallel and use up to 8 threads per image,
|
4 images in parallel and use up to 8 threads per image,
|
||||||
@ -123,7 +123,7 @@ so there will be up to 32 concurrent threads.
|
|||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
* `concurrency` **[number][11]?**
|
* `concurrency` **[number][11]?** 
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ Provides access to internal task counters.
|
|||||||
const counters = sharp.counters(); // { queue: 2, process: 4 }
|
const counters = sharp.counters(); // { queue: 2, process: 4 }
|
||||||
```
|
```
|
||||||
|
|
||||||
Returns **[Object][1]**
|
Returns **[Object][1]** 
|
||||||
|
|
||||||
## simd
|
## simd
|
||||||
|
|
||||||
@ -189,7 +189,7 @@ const simd = sharp.simd(false);
|
|||||||
// prevent libvips from using liborc at runtime
|
// prevent libvips from using liborc at runtime
|
||||||
```
|
```
|
||||||
|
|
||||||
Returns **[boolean][10]**
|
Returns **[boolean][10]** 
|
||||||
|
|
||||||
[1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
[1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
const fs = require('fs').promises;
|
const fs = require('fs').promises;
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const documentation = require('documentation');
|
|
||||||
|
|
||||||
[
|
[
|
||||||
'constructor',
|
'constructor',
|
||||||
@ -15,6 +14,8 @@ const documentation = require('documentation');
|
|||||||
'output',
|
'output',
|
||||||
'utility'
|
'utility'
|
||||||
].forEach(async (m) => {
|
].forEach(async (m) => {
|
||||||
|
const documentation = await import('documentation');
|
||||||
|
|
||||||
const input = path.join('lib', `${m}.js`);
|
const input = path.join('lib', `${m}.js`);
|
||||||
const output = path.join('docs', `api-${m}.md`);
|
const output = path.join('docs', `api-${m}.md`);
|
||||||
|
|
||||||
|
@ -141,13 +141,13 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"async": "^3.2.4",
|
"async": "^3.2.4",
|
||||||
"cc": "^3.0.1",
|
"cc": "^3.0.1",
|
||||||
"documentation": "^13.2.5",
|
"documentation": "^14.0.0",
|
||||||
"exif-reader": "^1.0.3",
|
"exif-reader": "^1.0.3",
|
||||||
"extract-zip": "^2.0.1",
|
"extract-zip": "^2.0.1",
|
||||||
"icc": "^2.0.0",
|
"icc": "^2.0.0",
|
||||||
"license-checker": "^25.0.1",
|
"license-checker": "^25.0.1",
|
||||||
"mocha": "^10.0.0",
|
"mocha": "^10.0.0",
|
||||||
"mock-fs": "^5.1.2",
|
"mock-fs": "^5.1.4",
|
||||||
"nyc": "^15.1.0",
|
"nyc": "^15.1.0",
|
||||||
"prebuild": "^11.0.4",
|
"prebuild": "^11.0.4",
|
||||||
"rimraf": "^3.0.2",
|
"rimraf": "^3.0.2",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user