WIP - add extractor, generate snippet_data
This commit is contained in:
115
node_modules/sharp/docs/api-channel.md
generated
vendored
Normal file
115
node_modules/sharp/docs/api-channel.md
generated
vendored
Normal file
@ -0,0 +1,115 @@
|
||||
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
||||
|
||||
## removeAlpha
|
||||
|
||||
Remove alpha channel, if any. This is a no-op if the image does not have an alpha channel.
|
||||
|
||||
### Examples
|
||||
|
||||
```javascript
|
||||
sharp('rgba.png')
|
||||
.removeAlpha()
|
||||
.toFile('rgb.png', function(err, info) {
|
||||
// rgb.png is a 3 channel image without an alpha channel
|
||||
});
|
||||
```
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## ensureAlpha
|
||||
|
||||
Ensure alpha channel, if missing. The added alpha channel will be fully opaque. This is a no-op if the image already has an alpha channel.
|
||||
|
||||
### Examples
|
||||
|
||||
```javascript
|
||||
sharp('rgb.jpg')
|
||||
.ensureAlpha()
|
||||
.toFile('rgba.png', function(err, info) {
|
||||
// rgba.png is a 4 channel image with a fully opaque alpha channel
|
||||
});
|
||||
```
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## extractChannel
|
||||
|
||||
Extract a single channel from a multi-channel image.
|
||||
|
||||
### 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.
|
||||
|
||||
### Examples
|
||||
|
||||
```javascript
|
||||
sharp(input)
|
||||
.extractChannel('green')
|
||||
.toFile('input_green.jpg', function(err, info) {
|
||||
// info.channels === 1
|
||||
// input_green.jpg contains the green channel of the input image
|
||||
});
|
||||
```
|
||||
|
||||
- Throws **[Error][3]** Invalid channel
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## joinChannel
|
||||
|
||||
Join one or more channels to the image.
|
||||
The meaning of the added channels depends on the output colourspace, set with `toColourspace()`.
|
||||
By default the output image will be web-friendly sRGB, with additional channels interpreted as alpha channels.
|
||||
Channel ordering follows vips convention:
|
||||
|
||||
- sRGB: 0: Red, 1: Green, 2: Blue, 3: Alpha.
|
||||
- CMYK: 0: Magenta, 1: Cyan, 2: Yellow, 3: Black, 4: Alpha.
|
||||
|
||||
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.
|
||||
|
||||
### Parameters
|
||||
|
||||
- `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.
|
||||
|
||||
|
||||
- Throws **[Error][3]** Invalid parameters
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## bandbool
|
||||
|
||||
Perform a bitwise boolean operation on all input image channels (bands) to produce a single channel output image.
|
||||
|
||||
### Parameters
|
||||
|
||||
- `boolOp` **[String][2]** one of `and`, `or` or `eor` to perform that bitwise operation, like the C logic operators `&`, `|` and `^` respectively.
|
||||
|
||||
### Examples
|
||||
|
||||
```javascript
|
||||
sharp('3-channel-rgb-input.png')
|
||||
.bandbool(sharp.bool.and)
|
||||
.toFile('1-channel-output.png', function (err, info) {
|
||||
// The output will be a single channel image where each pixel `P = R & G & B`.
|
||||
// If `I(1,1) = [247, 170, 14] = [0b11110111, 0b10101010, 0b00001111]`
|
||||
// then `O(1,1) = 0b11110111 & 0b10101010 & 0b00001111 = 0b00000010 = 2`.
|
||||
});
|
||||
```
|
||||
|
||||
- Throws **[Error][3]** Invalid parameters
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
[1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
||||
|
||||
[2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
||||
|
||||
[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error
|
||||
|
||||
[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
||||
|
||||
[5]: https://nodejs.org/api/buffer.html
|
||||
|
||||
[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
||||
79
node_modules/sharp/docs/api-colour.md
generated
vendored
Normal file
79
node_modules/sharp/docs/api-colour.md
generated
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
||||
|
||||
## tint
|
||||
|
||||
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.
|
||||
|
||||
### Parameters
|
||||
|
||||
- `rgb` **([String][1] \| [Object][2])** parsed by the [color][3] module to extract chroma values.
|
||||
|
||||
|
||||
- Throws **[Error][4]** Invalid parameter
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## greyscale
|
||||
|
||||
Convert to 8-bit greyscale; 256 shades of grey.
|
||||
This is a linear operation. If the input image is in a non-linear colour space such as sRGB, use `gamma()` with `greyscale()` for the best results.
|
||||
By default the output image will be web-friendly sRGB and contain three (identical) color channels.
|
||||
This may be overridden by other sharp operations such as `toColourspace('b-w')`,
|
||||
which will produce an output image containing one color channel.
|
||||
An alpha channel may be present, and will be unchanged by the operation.
|
||||
|
||||
### Parameters
|
||||
|
||||
- `greyscale` **[Boolean][5]** (optional, default `true`)
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## grayscale
|
||||
|
||||
Alternative spelling of `greyscale`.
|
||||
|
||||
### Parameters
|
||||
|
||||
- `grayscale` **[Boolean][5]** (optional, default `true`)
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## toColourspace
|
||||
|
||||
Set the output colourspace.
|
||||
By default output image will be web-friendly sRGB, with additional channels interpreted as alpha channels.
|
||||
|
||||
### Parameters
|
||||
|
||||
- `colourspace` **[String][1]?** output colourspace e.g. `srgb`, `rgb`, `cmyk`, `lab`, `b-w` [...][6]
|
||||
|
||||
|
||||
- Throws **[Error][4]** Invalid parameters
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## toColorspace
|
||||
|
||||
Alternative spelling of `toColourspace`.
|
||||
|
||||
### Parameters
|
||||
|
||||
- `colorspace` **[String][1]?** output colorspace.
|
||||
|
||||
|
||||
- Throws **[Error][4]** Invalid parameters
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
[1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
||||
|
||||
[2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
||||
|
||||
[3]: https://www.npmjs.org/package/color
|
||||
|
||||
[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error
|
||||
|
||||
[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
|
||||
|
||||
[6]: https://github.com/libvips/libvips/blob/master/libvips/iofuncs/enumtypes.c#L568
|
||||
81
node_modules/sharp/docs/api-composite.md
generated
vendored
Normal file
81
node_modules/sharp/docs/api-composite.md
generated
vendored
Normal file
@ -0,0 +1,81 @@
|
||||
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
||||
|
||||
## composite
|
||||
|
||||
Composite image(s) over the processed (resized, extracted etc.) image.
|
||||
|
||||
The images to composite must be the same size or smaller than the processed image.
|
||||
If both `top` and `left` options are provided, they take precedence over `gravity`.
|
||||
|
||||
The `blend` option can be one of `clear`, `source`, `over`, `in`, `out`, `atop`,
|
||||
`dest`, `dest-over`, `dest-in`, `dest-out`, `dest-atop`,
|
||||
`xor`, `add`, `saturate`, `multiply`, `screen`, `overlay`, `darken`, `lighten`,
|
||||
`colour-dodge`, `color-dodge`, `colour-burn`,`color-burn`,
|
||||
`hard-light`, `soft-light`, `difference`, `exclusion`.
|
||||
|
||||
More information about blend modes can be found at
|
||||
[https://libvips.github.io/libvips/API/current/libvips-conversion.html#VipsBlendMode][1]
|
||||
and [https://www.cairographics.org/operators/][2]
|
||||
|
||||
### Parameters
|
||||
|
||||
- `images` **[Array][3]<[Object][4]>** Ordered list of images to composite
|
||||
- `images[].input` **([Buffer][5] \| [String][6])?** Buffer containing image data, String containing the path to an image file, or Create object (see bellow)
|
||||
- `images[].input.create` **[Object][4]?** describes a blank overlay to be created.
|
||||
- `images[].input.create.width` **[Number][7]?**
|
||||
- `images[].input.create.height` **[Number][7]?**
|
||||
- `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[].blend` **[String][6]** how to blend this image with the image below. (optional, default `'over'`)
|
||||
- `images[].gravity` **[String][6]** gravity at which to place the overlay. (optional, default `'centre'`)
|
||||
- `images[].top` **[Number][7]?** the pixel offset from the top edge.
|
||||
- `images[].left` **[Number][7]?** the pixel offset from the left edge.
|
||||
- `images[].tile` **[Boolean][9]** set to true to repeat the overlay image across the entire image with the given `gravity`. (optional, default `false`)
|
||||
- `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.width` **[Number][7]?**
|
||||
- `images[].raw.height` **[Number][7]?**
|
||||
- `images[].raw.channels` **[Number][7]?**
|
||||
|
||||
### Examples
|
||||
|
||||
```javascript
|
||||
sharp('input.png')
|
||||
.rotate(180)
|
||||
.resize(300)
|
||||
.flatten( { background: '#ff6600' } )
|
||||
.composite([{ input: 'overlay.png', gravity: 'southeast' }])
|
||||
.sharpen()
|
||||
.withMetadata()
|
||||
.webp( { quality: 90 } )
|
||||
.toBuffer()
|
||||
.then(function(outputBuffer) {
|
||||
// outputBuffer contains upside down, 300px wide, alpha channel flattened
|
||||
// onto orange background, composited with overlay.png with SE gravity,
|
||||
// sharpened, with metadata, 90% quality WebP image data. Phew!
|
||||
});
|
||||
```
|
||||
|
||||
- Throws **[Error][10]** Invalid parameters
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
[1]: https://libvips.github.io/libvips/API/current/libvips-conversion.html#VipsBlendMode
|
||||
|
||||
[2]: https://www.cairographics.org/operators/
|
||||
|
||||
[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
||||
|
||||
[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
||||
|
||||
[5]: https://nodejs.org/api/buffer.html
|
||||
|
||||
[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
||||
|
||||
[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
||||
|
||||
[8]: https://www.npmjs.org/package/color
|
||||
|
||||
[9]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
|
||||
|
||||
[10]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error
|
||||
121
node_modules/sharp/docs/api-constructor.md
generated
vendored
Normal file
121
node_modules/sharp/docs/api-constructor.md
generated
vendored
Normal file
@ -0,0 +1,121 @@
|
||||
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
||||
|
||||
## Sharp
|
||||
|
||||
### Parameters
|
||||
|
||||
- `input` **([Buffer][1] \| [String][2])?** if present, can be
|
||||
a Buffer containing JPEG, PNG, WebP, GIF, SVG, TIFF or raw pixel image data, or
|
||||
a String containing the path to an JPEG, PNG, WebP, GIF, SVG or TIFF image file.
|
||||
JPEG, PNG, WebP, GIF, SVG, TIFF or raw pixel image data can be streamed into the object when not present.
|
||||
- `options` **[Object][3]?** if present, is an Object with optional attributes.
|
||||
- `options.failOnError` **[Boolean][4]** by default halt processing and raise an error when loading invalid images.
|
||||
Set this flag to `false` if you'd rather apply a "best effort" to decode images, even if the data is corrupt or invalid. (optional, default `true`)
|
||||
- `options.density` **[Number][5]** number representing the DPI for vector images. (optional, default `72`)
|
||||
- `options.pages` **[Number][5]** number of pages to extract for multi-page input (GIF, TIFF, PDF), use -1 for all pages. (optional, default `1`)
|
||||
- `options.page` **[Number][5]** page number to start extracting from for multi-page input (GIF, TIFF, PDF), zero based. (optional, default `0`)
|
||||
- `options.raw` **[Object][3]?** describes raw pixel input image data. See `raw()` for pixel ordering.
|
||||
- `options.raw.width` **[Number][5]?**
|
||||
- `options.raw.height` **[Number][5]?**
|
||||
- `options.raw.channels` **[Number][5]?** 1-4
|
||||
- `options.create` **[Object][3]?** describes a new image to be created.
|
||||
- `options.create.width` **[Number][5]?**
|
||||
- `options.create.height` **[Number][5]?**
|
||||
- `options.create.channels` **[Number][5]?** 3-4
|
||||
- `options.create.background` **([String][2] \| [Object][3])?** parsed by the [color][6] module to extract values for red, green, blue and alpha.
|
||||
|
||||
### Examples
|
||||
|
||||
```javascript
|
||||
sharp('input.jpg')
|
||||
.resize(300, 200)
|
||||
.toFile('output.jpg', function(err) {
|
||||
// output.jpg is a 300 pixels wide and 200 pixels high image
|
||||
// containing a scaled and cropped version of input.jpg
|
||||
});
|
||||
```
|
||||
|
||||
```javascript
|
||||
// Read image data from readableStream,
|
||||
// resize to 300 pixels wide,
|
||||
// emit an 'info' event with calculated dimensions
|
||||
// and finally write image data to writableStream
|
||||
var transformer = sharp()
|
||||
.resize(300)
|
||||
.on('info', function(info) {
|
||||
console.log('Image height is ' + info.height);
|
||||
});
|
||||
readableStream.pipe(transformer).pipe(writableStream);
|
||||
```
|
||||
|
||||
```javascript
|
||||
// Create a blank 300x200 PNG image of semi-transluent red pixels
|
||||
sharp({
|
||||
create: {
|
||||
width: 300,
|
||||
height: 200,
|
||||
channels: 4,
|
||||
background: { r: 255, g: 0, b: 0, alpha: 0.5 }
|
||||
}
|
||||
})
|
||||
.png()
|
||||
.toBuffer()
|
||||
.then( ... );
|
||||
```
|
||||
|
||||
- Throws **[Error][7]** Invalid parameters
|
||||
|
||||
Returns **[Sharp][8]**
|
||||
|
||||
### format
|
||||
|
||||
An Object containing nested boolean values representing the available input and output formats/methods.
|
||||
|
||||
#### Examples
|
||||
|
||||
```javascript
|
||||
console.log(sharp.format);
|
||||
```
|
||||
|
||||
Returns **[Object][3]**
|
||||
|
||||
### versions
|
||||
|
||||
An Object containing the version numbers of libvips and its dependencies.
|
||||
|
||||
#### Examples
|
||||
|
||||
```javascript
|
||||
console.log(sharp.versions);
|
||||
```
|
||||
|
||||
## queue
|
||||
|
||||
An EventEmitter that emits a `change` event when a task is either:
|
||||
|
||||
- queued, waiting for _libuv_ to provide a worker thread
|
||||
- complete
|
||||
|
||||
### Examples
|
||||
|
||||
```javascript
|
||||
sharp.queue.on('change', function(queueLength) {
|
||||
console.log('Queue contains ' + queueLength + ' task(s)');
|
||||
});
|
||||
```
|
||||
|
||||
[1]: https://nodejs.org/api/buffer.html
|
||||
|
||||
[2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
||||
|
||||
[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
||||
|
||||
[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
|
||||
|
||||
[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
||||
|
||||
[6]: https://www.npmjs.org/package/color
|
||||
|
||||
[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error
|
||||
|
||||
[8]: #sharp
|
||||
150
node_modules/sharp/docs/api-input.md
generated
vendored
Normal file
150
node_modules/sharp/docs/api-input.md
generated
vendored
Normal file
@ -0,0 +1,150 @@
|
||||
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
||||
|
||||
## clone
|
||||
|
||||
Take a "snapshot" of the Sharp instance, returning a new instance.
|
||||
Cloned instances inherit the input of their parent instance.
|
||||
This allows multiple output Streams and therefore multiple processing pipelines to share a single input Stream.
|
||||
|
||||
### Examples
|
||||
|
||||
```javascript
|
||||
const pipeline = sharp().rotate();
|
||||
pipeline.clone().resize(800, 600).pipe(firstWritableStream);
|
||||
pipeline.clone().extract({ left: 20, top: 20, width: 100, height: 100 }).pipe(secondWritableStream);
|
||||
readableStream.pipe(pipeline);
|
||||
// firstWritableStream receives auto-rotated, resized readableStream
|
||||
// secondWritableStream receives auto-rotated, extracted region of readableStream
|
||||
```
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## metadata
|
||||
|
||||
Fast access to (uncached) image metadata without decoding any compressed image data.
|
||||
A `Promise` is returned when `callback` is not provided.
|
||||
|
||||
- `format`: Name of decoder used to decompress image data e.g. `jpeg`, `png`, `webp`, `gif`, `svg`
|
||||
- `size`: Total size of image in bytes, for Stream and Buffer input only
|
||||
- `width`: Number of pixels wide (EXIF orientation is not taken into consideration)
|
||||
- `height`: Number of pixels high (EXIF orientation is not taken into consideration)
|
||||
- `space`: Name of colour space interpretation e.g. `srgb`, `rgb`, `cmyk`, `lab`, `b-w` [...][1]
|
||||
- `channels`: Number of bands e.g. `3` for sRGB, `4` for CMYK
|
||||
- `depth`: Name of pixel depth format e.g. `uchar`, `char`, `ushort`, `float` [...][2]
|
||||
- `density`: Number of pixels per inch (DPI), if present
|
||||
- `chromaSubsampling`: String containing JPEG chroma subsampling, `4:2:0` or `4:4:4` for RGB, `4:2:0:4` or `4:4:4:4` for CMYK
|
||||
- `isProgressive`: Boolean indicating whether the image is interlaced using a progressive scan
|
||||
- `pages`: Number of pages/frames contained within the image, with support for TIFF, PDF, animated GIF and animated WebP
|
||||
- `pageHeight`: Number of pixels high each page in this PDF image will be.
|
||||
- `hasProfile`: Boolean indicating the presence of an embedded ICC profile
|
||||
- `hasAlpha`: Boolean indicating the presence of an alpha transparency channel
|
||||
- `orientation`: Number value of the EXIF Orientation header, if present
|
||||
- `exif`: Buffer containing raw EXIF data, if present
|
||||
- `icc`: Buffer containing raw [ICC][3] profile data, if present
|
||||
- `iptc`: Buffer containing raw IPTC data, if present
|
||||
- `xmp`: Buffer containing raw XMP data, if present
|
||||
|
||||
### Parameters
|
||||
|
||||
- `callback` **[Function][4]?** called with the arguments `(err, metadata)`
|
||||
|
||||
### Examples
|
||||
|
||||
```javascript
|
||||
const image = sharp(inputJpg);
|
||||
image
|
||||
.metadata()
|
||||
.then(function(metadata) {
|
||||
return image
|
||||
.resize(Math.round(metadata.width / 2))
|
||||
.webp()
|
||||
.toBuffer();
|
||||
})
|
||||
.then(function(data) {
|
||||
// data contains a WebP image half the width and height of the original JPEG
|
||||
});
|
||||
```
|
||||
|
||||
Returns **([Promise][5]<[Object][6]> | Sharp)**
|
||||
|
||||
## stats
|
||||
|
||||
Access to pixel-derived image statistics for every channel in the image.
|
||||
A `Promise` is returned when `callback` is not provided.
|
||||
|
||||
- `channels`: Array of channel statistics for each channel in the image. Each channel statistic contains
|
||||
- `min` (minimum value in the channel)
|
||||
- `max` (maximum value in the channel)
|
||||
- `sum` (sum of all values in a channel)
|
||||
- `squaresSum` (sum of squared values in a channel)
|
||||
- `mean` (mean of the values in a channel)
|
||||
- `stdev` (standard deviation for the values in a channel)
|
||||
- `minX` (x-coordinate of one of the pixel where the minimum lies)
|
||||
- `minY` (y-coordinate of one of the pixel where the minimum lies)
|
||||
- `maxX` (x-coordinate of one of the pixel where the maximum lies)
|
||||
- `maxY` (y-coordinate of one of the pixel where the maximum lies)
|
||||
- `isOpaque`: Value to identify if the image is opaque or transparent, based on the presence and use of alpha channel
|
||||
- `entropy`: Histogram-based estimation of greyscale entropy, discarding alpha channel if any (experimental)
|
||||
|
||||
### Parameters
|
||||
|
||||
- `callback` **[Function][4]?** called with the arguments `(err, stats)`
|
||||
|
||||
### Examples
|
||||
|
||||
```javascript
|
||||
const image = sharp(inputJpg);
|
||||
image
|
||||
.stats()
|
||||
.then(function(stats) {
|
||||
// stats contains the channel-wise statistics array and the isOpaque value
|
||||
});
|
||||
```
|
||||
|
||||
Returns **[Promise][5]<[Object][6]>**
|
||||
|
||||
## limitInputPixels
|
||||
|
||||
Do not process input images where the number of pixels (width x height) exceeds this limit.
|
||||
Assumes image dimensions contained in the input metadata can be trusted.
|
||||
The default limit is 268402689 (0x3FFF x 0x3FFF) pixels.
|
||||
|
||||
### Parameters
|
||||
|
||||
- `limit` **([Number][7] \| [Boolean][8])** an integral Number of pixels, zero or false to remove limit, true to use default limit.
|
||||
|
||||
|
||||
- Throws **[Error][9]** Invalid limit
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## sequentialRead
|
||||
|
||||
An advanced setting that switches the libvips access method to `VIPS_ACCESS_SEQUENTIAL`.
|
||||
This will reduce memory usage and can improve performance on some systems.
|
||||
|
||||
The default behaviour _before_ function call is `false`, meaning the libvips access method is not sequential.
|
||||
|
||||
### Parameters
|
||||
|
||||
- `sequentialRead` **[Boolean][8]** (optional, default `true`)
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
[1]: https://github.com/libvips/libvips/blob/master/libvips/iofuncs/enumtypes.c#L636
|
||||
|
||||
[2]: https://github.com/libvips/libvips/blob/master/libvips/iofuncs/enumtypes.c#L672
|
||||
|
||||
[3]: https://www.npmjs.com/package/icc
|
||||
|
||||
[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
|
||||
|
||||
[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
||||
|
||||
[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
||||
|
||||
[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
||||
|
||||
[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
|
||||
|
||||
[9]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error
|
||||
339
node_modules/sharp/docs/api-operation.md
generated
vendored
Normal file
339
node_modules/sharp/docs/api-operation.md
generated
vendored
Normal file
@ -0,0 +1,339 @@
|
||||
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
||||
|
||||
## rotate
|
||||
|
||||
Rotate the output image by either an explicit angle
|
||||
or auto-orient based on the EXIF `Orientation` tag.
|
||||
|
||||
If an angle is provided, it is converted to a valid positive degree rotation.
|
||||
For example, `-450` will produce a 270deg rotation.
|
||||
|
||||
When rotating by an angle other than a multiple of 90,
|
||||
the background colour can be provided with the `background` option.
|
||||
|
||||
If no angle is provided, it is determined from the EXIF data.
|
||||
Mirroring is supported and may infer the use of a flip operation.
|
||||
|
||||
The use of `rotate` implies the removal of the EXIF `Orientation` tag, if any.
|
||||
|
||||
Method order is important when both rotating and extracting regions,
|
||||
for example `rotate(x).extract(y)` will produce a different result to `extract(y).rotate(x)`.
|
||||
|
||||
### Parameters
|
||||
|
||||
- `angle` **[Number][1]** angle of rotation. (optional, default `auto`)
|
||||
- `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"`)
|
||||
|
||||
### Examples
|
||||
|
||||
```javascript
|
||||
const pipeline = sharp()
|
||||
.rotate()
|
||||
.resize(null, 200)
|
||||
.toBuffer(function (err, outputBuffer, info) {
|
||||
// outputBuffer contains 200px high JPEG image data,
|
||||
// auto-rotated using EXIF Orientation tag
|
||||
// info.width and info.height contain the dimensions of the resized image
|
||||
});
|
||||
readableStream.pipe(pipeline);
|
||||
```
|
||||
|
||||
- Throws **[Error][5]** Invalid parameters
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## flip
|
||||
|
||||
Flip the image about the vertical Y axis. This always occurs after rotation, if any.
|
||||
The use of `flip` implies the removal of the EXIF `Orientation` tag, if any.
|
||||
|
||||
### Parameters
|
||||
|
||||
- `flip` **[Boolean][6]** (optional, default `true`)
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## flop
|
||||
|
||||
Flop the image about the horizontal X axis. This always occurs after rotation, if any.
|
||||
The use of `flop` implies the removal of the EXIF `Orientation` tag, if any.
|
||||
|
||||
### Parameters
|
||||
|
||||
- `flop` **[Boolean][6]** (optional, default `true`)
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## sharpen
|
||||
|
||||
Sharpen the image.
|
||||
When used without parameters, performs a fast, mild sharpen of the output image.
|
||||
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.
|
||||
|
||||
### Parameters
|
||||
|
||||
- `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`)
|
||||
- `jagged` **[Number][1]** the level of sharpening to apply to "jagged" areas. (optional, default `2.0`)
|
||||
|
||||
|
||||
- Throws **[Error][5]** Invalid parameters
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## median
|
||||
|
||||
Apply median filter.
|
||||
When used without parameters the default window is 3x3.
|
||||
|
||||
### Parameters
|
||||
|
||||
- `size` **[Number][1]** square mask size: size x size (optional, default `3`)
|
||||
|
||||
|
||||
- Throws **[Error][5]** Invalid parameters
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## blur
|
||||
|
||||
Blur the 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.
|
||||
|
||||
### Parameters
|
||||
|
||||
- `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
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## flatten
|
||||
|
||||
Merge alpha transparency channel, if any, with a background.
|
||||
|
||||
### Parameters
|
||||
|
||||
- `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}`)
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## gamma
|
||||
|
||||
Apply a gamma correction by reducing the encoding (darken) pre-resize at a factor of `1/gamma`
|
||||
then increasing the encoding (brighten) post-resize at a factor of `gamma`.
|
||||
This can improve the perceived brightness of a resized image in non-linear colour spaces.
|
||||
JPEG and WebP input images will not take advantage of the shrink-on-load performance optimisation
|
||||
when applying a gamma correction.
|
||||
|
||||
Supply a second argument to use a different output gamma value, otherwise the first value is used in both cases.
|
||||
|
||||
### Parameters
|
||||
|
||||
- `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`)
|
||||
|
||||
|
||||
- Throws **[Error][5]** Invalid parameters
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## negate
|
||||
|
||||
Produce the "negative" of the image.
|
||||
|
||||
### Parameters
|
||||
|
||||
- `negate` **[Boolean][6]** (optional, default `true`)
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## normalise
|
||||
|
||||
Enhance output image contrast by stretching its luminance to cover the full dynamic range.
|
||||
|
||||
### Parameters
|
||||
|
||||
- `normalise` **[Boolean][6]** (optional, default `true`)
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## normalize
|
||||
|
||||
Alternative spelling of normalise.
|
||||
|
||||
### Parameters
|
||||
|
||||
- `normalize` **[Boolean][6]** (optional, default `true`)
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## convolve
|
||||
|
||||
Convolve the image with the specified kernel.
|
||||
|
||||
### Parameters
|
||||
|
||||
- `kernel` **[Object][2]**
|
||||
- `kernel.width` **[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.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`)
|
||||
|
||||
### Examples
|
||||
|
||||
```javascript
|
||||
sharp(input)
|
||||
.convolve({
|
||||
width: 3,
|
||||
height: 3,
|
||||
kernel: [-1, 0, 1, -2, 0, 2, -1, 0, 1]
|
||||
})
|
||||
.raw()
|
||||
.toBuffer(function(err, data, info) {
|
||||
// data contains the raw pixel data representing the convolution
|
||||
// of the input image with the horizontal Sobel operator
|
||||
});
|
||||
```
|
||||
|
||||
- Throws **[Error][5]** Invalid parameters
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## threshold
|
||||
|
||||
Any pixel value greather than or equal to the threshold value will be set to 255, otherwise it will be set to 0.
|
||||
|
||||
### Parameters
|
||||
|
||||
- `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.greyscale` **[Boolean][6]** convert to single channel greyscale. (optional, default `true`)
|
||||
- `options.grayscale` **[Boolean][6]** alternative spelling for greyscale. (optional, default `true`)
|
||||
|
||||
|
||||
- Throws **[Error][5]** Invalid parameters
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## boolean
|
||||
|
||||
Perform a bitwise boolean operation with operand image.
|
||||
|
||||
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.
|
||||
|
||||
### Parameters
|
||||
|
||||
- `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.
|
||||
- `options` **[Object][2]?**
|
||||
- `options.raw` **[Object][2]?** describes operand when using raw pixel data.
|
||||
- `options.raw.width` **[Number][1]?**
|
||||
- `options.raw.height` **[Number][1]?**
|
||||
- `options.raw.channels` **[Number][1]?**
|
||||
|
||||
|
||||
- Throws **[Error][5]** Invalid parameters
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## linear
|
||||
|
||||
Apply the linear formula a \* input + b to the image (levels adjustment)
|
||||
|
||||
### Parameters
|
||||
|
||||
- `a` **[Number][1]** multiplier (optional, default `1.0`)
|
||||
- `b` **[Number][1]** offset (optional, default `0.0`)
|
||||
|
||||
|
||||
- Throws **[Error][5]** Invalid parameters
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## recomb
|
||||
|
||||
Recomb the image with the specified matrix.
|
||||
|
||||
### Parameters
|
||||
|
||||
- `inputMatrix`
|
||||
- `3x3` **[Array][7]<[Array][7]<[Number][1]>>** Recombination matrix
|
||||
|
||||
### Examples
|
||||
|
||||
```javascript
|
||||
sharp(input)
|
||||
.recomb([
|
||||
[0.3588, 0.7044, 0.1368],
|
||||
[0.2990, 0.5870, 0.1140],
|
||||
[0.2392, 0.4696, 0.0912],
|
||||
])
|
||||
.raw()
|
||||
.toBuffer(function(err, data, info) {
|
||||
// data contains the raw pixel data after applying the recomb
|
||||
// With this example input, a sepia filter has been applied
|
||||
});
|
||||
```
|
||||
|
||||
- Throws **[Error][5]** Invalid parameters
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## modulate
|
||||
|
||||
Transforms the image using brightness, saturation and hue rotation.
|
||||
|
||||
### Parameters
|
||||
|
||||
- `options` **[Object][2]?**
|
||||
- `options.brightness` **[Number][1]?** Brightness multiplier
|
||||
- `options.saturation` **[Number][1]?** Saturation multiplier
|
||||
- `options.hue` **[Number][1]?** Degrees for hue rotation
|
||||
|
||||
### Examples
|
||||
|
||||
```javascript
|
||||
sharp(input)
|
||||
.modulate({
|
||||
brightness: 2 // increase lightness by a factor of 2
|
||||
});
|
||||
|
||||
sharp(input)
|
||||
.modulate({
|
||||
hue: 180 // hue-rotate by 180 degrees
|
||||
});
|
||||
|
||||
// decreate brightness and saturation while also hue-rotating by 90 degrees
|
||||
sharp(input)
|
||||
.modulate({
|
||||
brightness: 0.5,
|
||||
saturation: 0.5,
|
||||
hue: 90
|
||||
});
|
||||
```
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
[1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
||||
|
||||
[2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
||||
|
||||
[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
||||
|
||||
[4]: https://www.npmjs.org/package/color
|
||||
|
||||
[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error
|
||||
|
||||
[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
|
||||
|
||||
[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
||||
|
||||
[8]: https://nodejs.org/api/buffer.html
|
||||
326
node_modules/sharp/docs/api-output.md
generated
vendored
Normal file
326
node_modules/sharp/docs/api-output.md
generated
vendored
Normal file
@ -0,0 +1,326 @@
|
||||
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
||||
|
||||
## toFile
|
||||
|
||||
Write output image data to a file.
|
||||
|
||||
If an explicit output format is not selected, it will be inferred from the extension,
|
||||
with JPEG, PNG, WebP, TIFF, DZI, and libvips' V format supported.
|
||||
Note that raw pixel data is only supported for buffer output.
|
||||
|
||||
A `Promise` is returned when `callback` is not provided.
|
||||
|
||||
### Parameters
|
||||
|
||||
- `fileOut` **[String][1]** the path to write the image data to.
|
||||
- `callback` **[Function][2]?** called on completion with two arguments `(err, info)`.
|
||||
`info` contains the output image `format`, `size` (bytes), `width`, `height`,
|
||||
`channels` and `premultiplied` (indicating if premultiplication was used).
|
||||
When using a crop strategy also contains `cropOffsetLeft` and `cropOffsetTop`.
|
||||
|
||||
### Examples
|
||||
|
||||
```javascript
|
||||
sharp(input)
|
||||
.toFile('output.png', (err, info) => { ... });
|
||||
```
|
||||
|
||||
```javascript
|
||||
sharp(input)
|
||||
.toFile('output.png')
|
||||
.then(info => { ... })
|
||||
.catch(err => { ... });
|
||||
```
|
||||
|
||||
- Throws **[Error][3]** Invalid parameters
|
||||
|
||||
Returns **[Promise][4]<[Object][5]>** when no callback is provided
|
||||
|
||||
## toBuffer
|
||||
|
||||
Write output to a Buffer.
|
||||
JPEG, PNG, WebP, TIFF and RAW output are supported.
|
||||
By default, the format will match the input image, except GIF and SVG input which become PNG output.
|
||||
|
||||
`callback`, if present, gets three arguments `(err, data, info)` where:
|
||||
|
||||
- `err` is an error, if any.
|
||||
- `data` is the output image data.
|
||||
- `info` contains the output image `format`, `size` (bytes), `width`, `height`,
|
||||
`channels` and `premultiplied` (indicating if premultiplication was used).
|
||||
When using a crop strategy also contains `cropOffsetLeft` and `cropOffsetTop`.
|
||||
|
||||
A `Promise` is returned when `callback` is not provided.
|
||||
|
||||
### Parameters
|
||||
|
||||
- `options` **[Object][5]?**
|
||||
- `options.resolveWithObject` **[Boolean][6]?** Resolve the Promise with an Object containing `data` and `info` properties instead of resolving only with `data`.
|
||||
- `callback` **[Function][2]?**
|
||||
|
||||
### Examples
|
||||
|
||||
```javascript
|
||||
sharp(input)
|
||||
.toBuffer((err, data, info) => { ... });
|
||||
```
|
||||
|
||||
```javascript
|
||||
sharp(input)
|
||||
.toBuffer()
|
||||
.then(data => { ... })
|
||||
.catch(err => { ... });
|
||||
```
|
||||
|
||||
```javascript
|
||||
sharp(input)
|
||||
.toBuffer({ resolveWithObject: true })
|
||||
.then(({ data, info }) => { ... })
|
||||
.catch(err => { ... });
|
||||
```
|
||||
|
||||
Returns **[Promise][4]<[Buffer][7]>** when no callback is provided
|
||||
|
||||
## withMetadata
|
||||
|
||||
Include all metadata (EXIF, XMP, IPTC) from the input image in the output image.
|
||||
The default behaviour, when `withMetadata` is not used, is to strip all metadata and convert to the device-independent sRGB colour space.
|
||||
This will also convert to and add a web-friendly sRGB ICC profile.
|
||||
|
||||
### Parameters
|
||||
|
||||
- `withMetadata` **[Object][5]?**
|
||||
- `withMetadata.orientation` **[Number][8]?** value between 1 and 8, used to update the EXIF `Orientation` tag.
|
||||
|
||||
### Examples
|
||||
|
||||
```javascript
|
||||
sharp('input.jpg')
|
||||
.withMetadata()
|
||||
.toFile('output-with-metadata.jpg')
|
||||
.then(info => { ... });
|
||||
```
|
||||
|
||||
- Throws **[Error][3]** Invalid parameters
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## jpeg
|
||||
|
||||
Use these JPEG options for output image.
|
||||
|
||||
### Parameters
|
||||
|
||||
- `options` **[Object][5]?** output options
|
||||
- `options.quality` **[Number][8]** quality, integer 1-100 (optional, default `80`)
|
||||
- `options.progressive` **[Boolean][6]** use progressive (interlace) scan (optional, default `false`)
|
||||
- `options.chromaSubsampling` **[String][1]** set to '4:4:4' to prevent chroma subsampling when quality <= 90 (optional, default `'4:2:0'`)
|
||||
- `options.trellisQuantisation` **[Boolean][6]** apply trellis quantisation, requires libvips compiled with support for mozjpeg (optional, default `false`)
|
||||
- `options.overshootDeringing` **[Boolean][6]** apply overshoot deringing, requires libvips compiled with support for mozjpeg (optional, default `false`)
|
||||
- `options.optimiseScans` **[Boolean][6]** optimise progressive scans, forces progressive, requires libvips compiled with support for mozjpeg (optional, default `false`)
|
||||
- `options.optimizeScans` **[Boolean][6]** alternative spelling of optimiseScans (optional, default `false`)
|
||||
- `options.optimiseCoding` **[Boolean][6]** optimise Huffman coding tables (optional, default `true`)
|
||||
- `options.optimizeCoding` **[Boolean][6]** alternative spelling of optimiseCoding (optional, default `true`)
|
||||
- `options.quantisationTable` **[Number][8]** quantization table to use, integer 0-8, requires libvips compiled with support for mozjpeg (optional, default `0`)
|
||||
- `options.quantizationTable` **[Number][8]** alternative spelling of quantisationTable (optional, default `0`)
|
||||
- `options.force` **[Boolean][6]** force JPEG output, otherwise attempt to use input format (optional, default `true`)
|
||||
|
||||
### Examples
|
||||
|
||||
```javascript
|
||||
// Convert any input to very high quality JPEG output
|
||||
const data = await sharp(input)
|
||||
.jpeg({
|
||||
quality: 100,
|
||||
chromaSubsampling: '4:4:4'
|
||||
})
|
||||
.toBuffer();
|
||||
```
|
||||
|
||||
- Throws **[Error][3]** Invalid options
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## png
|
||||
|
||||
Use these PNG options for output image.
|
||||
|
||||
PNG output is always full colour at 8 or 16 bits per pixel.
|
||||
Indexed PNG input at 1, 2 or 4 bits per pixel is converted to 8 bits per pixel.
|
||||
|
||||
### Parameters
|
||||
|
||||
- `options` **[Object][5]?**
|
||||
- `options.progressive` **[Boolean][6]** use progressive (interlace) scan (optional, default `false`)
|
||||
- `options.compressionLevel` **[Number][8]** zlib compression level, 0-9 (optional, default `9`)
|
||||
- `options.adaptiveFiltering` **[Boolean][6]** use adaptive row filtering (optional, default `false`)
|
||||
- `options.palette` **[Boolean][6]** quantise to a palette-based image with alpha transparency support, requires libvips compiled with support for libimagequant (optional, default `false`)
|
||||
- `options.quality` **[Number][8]** use the lowest number of colours needed to achieve given quality, requires libvips compiled with support for libimagequant (optional, default `100`)
|
||||
- `options.colours` **[Number][8]** maximum number of palette entries, requires libvips compiled with support for libimagequant (optional, default `256`)
|
||||
- `options.colors` **[Number][8]** alternative spelling of `options.colours`, requires libvips compiled with support for libimagequant (optional, default `256`)
|
||||
- `options.dither` **[Number][8]** level of Floyd-Steinberg error diffusion, requires libvips compiled with support for libimagequant (optional, default `1.0`)
|
||||
- `options.force` **[Boolean][6]** force PNG output, otherwise attempt to use input format (optional, default `true`)
|
||||
|
||||
### Examples
|
||||
|
||||
```javascript
|
||||
// Convert any input to PNG output
|
||||
const data = await sharp(input)
|
||||
.png()
|
||||
.toBuffer();
|
||||
```
|
||||
|
||||
- Throws **[Error][3]** Invalid options
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## webp
|
||||
|
||||
Use these WebP options for output image.
|
||||
|
||||
### Parameters
|
||||
|
||||
- `options` **[Object][5]?** output options
|
||||
- `options.quality` **[Number][8]** quality, integer 1-100 (optional, default `80`)
|
||||
- `options.alphaQuality` **[Number][8]** quality of alpha layer, integer 0-100 (optional, default `100`)
|
||||
- `options.lossless` **[Boolean][6]** use lossless compression mode (optional, default `false`)
|
||||
- `options.nearLossless` **[Boolean][6]** use near_lossless compression mode (optional, default `false`)
|
||||
- `options.force` **[Boolean][6]** force WebP output, otherwise attempt to use input format (optional, default `true`)
|
||||
|
||||
### Examples
|
||||
|
||||
```javascript
|
||||
// Convert any input to lossless WebP output
|
||||
const data = await sharp(input)
|
||||
.webp({ lossless: true })
|
||||
.toBuffer();
|
||||
```
|
||||
|
||||
- Throws **[Error][3]** Invalid options
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## tiff
|
||||
|
||||
Use these TIFF options for output image.
|
||||
|
||||
### Parameters
|
||||
|
||||
- `options` **[Object][5]?** output options
|
||||
- `options.quality` **[Number][8]** quality, integer 1-100 (optional, default `80`)
|
||||
- `options.force` **[Boolean][6]** force TIFF output, otherwise attempt to use input format (optional, default `true`)
|
||||
- `options.compression` **[Boolean][6]** compression options: lzw, deflate, jpeg, ccittfax4 (optional, default `'jpeg'`)
|
||||
- `options.predictor` **[Boolean][6]** compression predictor options: none, horizontal, float (optional, default `'horizontal'`)
|
||||
- `options.pyramid` **[Boolean][6]** write an image pyramid (optional, default `false`)
|
||||
- `options.tile` **[Boolean][6]** write a tiled tiff (optional, default `false`)
|
||||
- `options.tileWidth` **[Boolean][6]** horizontal tile size (optional, default `256`)
|
||||
- `options.tileHeight` **[Boolean][6]** vertical tile size (optional, default `256`)
|
||||
- `options.xres` **[Number][8]** horizontal resolution in pixels/mm (optional, default `1.0`)
|
||||
- `options.yres` **[Number][8]** vertical resolution in pixels/mm (optional, default `1.0`)
|
||||
- `options.squash` **[Boolean][6]** squash 8-bit images down to 1 bit (optional, default `false`)
|
||||
|
||||
### Examples
|
||||
|
||||
```javascript
|
||||
// Convert SVG input to LZW-compressed, 1 bit per pixel TIFF output
|
||||
sharp('input.svg')
|
||||
.tiff({
|
||||
compression: 'lzw',
|
||||
squash: true
|
||||
})
|
||||
.toFile('1-bpp-output.tiff')
|
||||
.then(info => { ... });
|
||||
```
|
||||
|
||||
- Throws **[Error][3]** Invalid options
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## raw
|
||||
|
||||
Force output to be raw, uncompressed uint8 pixel data.
|
||||
|
||||
### Examples
|
||||
|
||||
```javascript
|
||||
// Extract raw RGB pixel data from JPEG input
|
||||
const { data, info } = await sharp('input.jpg')
|
||||
.raw()
|
||||
.toBuffer({ resolveWithObject: true });
|
||||
```
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## toFormat
|
||||
|
||||
Force output to a given format.
|
||||
|
||||
### Parameters
|
||||
|
||||
- `format` **([String][1] \| [Object][5])** as a String or an Object with an 'id' attribute
|
||||
- `options` **[Object][5]** output options
|
||||
|
||||
### Examples
|
||||
|
||||
```javascript
|
||||
// Convert any input to PNG output
|
||||
const data = await sharp(input)
|
||||
.toFormat('png')
|
||||
.toBuffer();
|
||||
```
|
||||
|
||||
- Throws **[Error][3]** unsupported format or options
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## tile
|
||||
|
||||
Use tile-based deep zoom (image pyramid) output.
|
||||
Set the format and options for tile images via the `toFormat`, `jpeg`, `png` or `webp` functions.
|
||||
Use a `.zip` or `.szi` file extension with `toFile` to write to a compressed archive file format.
|
||||
|
||||
Warning: multiple sharp instances concurrently producing tile output can expose a possible race condition in some versions of libgsf.
|
||||
|
||||
### Parameters
|
||||
|
||||
- `tile` **[Object][5]?**
|
||||
- `tile.size` **[Number][8]** tile size in pixels, a value between 1 and 8192. (optional, default `256`)
|
||||
- `tile.overlap` **[Number][8]** tile overlap in pixels, a value between 0 and 8192. (optional, default `0`)
|
||||
- `tile.angle` **[Number][8]** tile angle of rotation, must be a multiple of 90. (optional, default `0`)
|
||||
- `tile.depth` **[String][1]?** how deep to make the pyramid, possible values are `onepixel`, `onetile` or `one`, default based on layout.
|
||||
- `tile.container` **[String][1]** tile container, with value `fs` (filesystem) or `zip` (compressed file). (optional, default `'fs'`)
|
||||
- `tile.layout` **[String][1]** filesystem layout, possible values are `dz`, `zoomify` or `google`. (optional, default `'dz'`)
|
||||
|
||||
### Examples
|
||||
|
||||
```javascript
|
||||
sharp('input.tiff')
|
||||
.png()
|
||||
.tile({
|
||||
size: 512
|
||||
})
|
||||
.toFile('output.dz', function(err, info) {
|
||||
// output.dzi is the Deep Zoom XML definition
|
||||
// output_files contains 512x512 tiles grouped by zoom level
|
||||
});
|
||||
```
|
||||
|
||||
- Throws **[Error][3]** Invalid parameters
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
[1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
||||
|
||||
[2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
|
||||
|
||||
[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error
|
||||
|
||||
[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
||||
|
||||
[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
||||
|
||||
[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
|
||||
|
||||
[7]: https://nodejs.org/api/buffer.html
|
||||
|
||||
[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
||||
234
node_modules/sharp/docs/api-resize.md
generated
vendored
Normal file
234
node_modules/sharp/docs/api-resize.md
generated
vendored
Normal file
@ -0,0 +1,234 @@
|
||||
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
||||
|
||||
## resize
|
||||
|
||||
Resize image to `width`, `height` or `width x height`.
|
||||
|
||||
When both a `width` and `height` are provided, the possible methods by which the image should **fit** these are:
|
||||
|
||||
- `cover`: Crop to cover both provided dimensions (the default).
|
||||
- `contain`: Embed within both provided dimensions.
|
||||
- `fill`: Ignore the aspect ratio of the input and stretch to both provided dimensions.
|
||||
- `inside`: Preserving aspect ratio, resize the image to be as large as possible while ensuring its dimensions are less than or equal to both those specified.
|
||||
- `outside`: Preserving aspect ratio, resize the image to be as small as possible while ensuring its dimensions are greater than or equal to both those specified.
|
||||
Some of these values are based on the [object-fit][1] CSS property.
|
||||
|
||||
When using a `fit` of `cover` or `contain`, the default **position** is `centre`. Other options are:
|
||||
|
||||
- `sharp.position`: `top`, `right top`, `right`, `right bottom`, `bottom`, `left bottom`, `left`, `left top`.
|
||||
- `sharp.gravity`: `north`, `northeast`, `east`, `southeast`, `south`, `southwest`, `west`, `northwest`, `center` or `centre`.
|
||||
- `sharp.strategy`: `cover` only, dynamically crop using either the `entropy` or `attention` strategy.
|
||||
Some of these values are based on the [object-position][2] CSS property.
|
||||
|
||||
The experimental strategy-based approach resizes so one dimension is at its target length
|
||||
then repeatedly ranks edge regions, discarding the edge with the lowest score based on the selected strategy.
|
||||
|
||||
- `entropy`: focus on the region with the highest [Shannon entropy][3].
|
||||
- `attention`: focus on the region with the highest luminance frequency, colour saturation and presence of skin tones.
|
||||
|
||||
Possible interpolation kernels are:
|
||||
|
||||
- `nearest`: Use [nearest neighbour interpolation][4].
|
||||
- `cubic`: Use a [Catmull-Rom spline][5].
|
||||
- `mitchell`: Use a [Mitchell-Netravali spline][6].
|
||||
- `lanczos2`: Use a [Lanczos kernel][7] with `a=2`.
|
||||
- `lanczos3`: Use a Lanczos kernel with `a=3` (the default).
|
||||
|
||||
### Parameters
|
||||
|
||||
- `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.
|
||||
- `options` **[Object][9]?**
|
||||
- `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.fit` **[String][10]** how the image should be resized to fit both provided dimensions, one of `cover`, `contain`, `fill`, `inside` or `outside`. (optional, default `'cover'`)
|
||||
- `options.position` **[String][10]** position, gravity or strategy to use when `fit` is `cover` or `contain`. (optional, default `'centre'`)
|
||||
- `options.background` **([String][10] \| [Object][9])** background colour when using a `fit` of `contain`, parsed by the [color][11] module, defaults to black without transparency. (optional, default `{r:0,g:0,b:0,alpha:1}`)
|
||||
- `options.kernel` **[String][10]** the kernel to use for image reduction. (optional, default `'lanczos3'`)
|
||||
- `options.withoutEnlargement` **[Boolean][12]** do not enlarge if the width _or_ height are already less than the specified dimensions, equivalent to GraphicsMagick's `>` geometry option. (optional, default `false`)
|
||||
- `options.fastShrinkOnLoad` **[Boolean][12]** take greater advantage of the JPEG and WebP shrink-on-load feature, which can lead to a slight moiré pattern on some images. (optional, default `true`)
|
||||
|
||||
### Examples
|
||||
|
||||
```javascript
|
||||
sharp(input)
|
||||
.resize({ width: 100 })
|
||||
.toBuffer()
|
||||
.then(data => {
|
||||
// 100 pixels wide, auto-scaled height
|
||||
});
|
||||
```
|
||||
|
||||
```javascript
|
||||
sharp(input)
|
||||
.resize({ height: 100 })
|
||||
.toBuffer()
|
||||
.then(data => {
|
||||
// 100 pixels high, auto-scaled width
|
||||
});
|
||||
```
|
||||
|
||||
```javascript
|
||||
sharp(input)
|
||||
.resize(200, 300, {
|
||||
kernel: sharp.kernel.nearest,
|
||||
fit: 'contain',
|
||||
position: 'right top',
|
||||
background: { r: 255, g: 255, b: 255, alpha: 0.5 }
|
||||
})
|
||||
.toFile('output.png')
|
||||
.then(() => {
|
||||
// output.png is a 200 pixels wide and 300 pixels high image
|
||||
// containing a nearest-neighbour scaled version
|
||||
// contained within the north-east corner of a semi-transparent white canvas
|
||||
});
|
||||
```
|
||||
|
||||
```javascript
|
||||
const transformer = sharp()
|
||||
.resize({
|
||||
width: 200,
|
||||
height: 200,
|
||||
fit: sharp.fit.cover,
|
||||
position: sharp.strategy.entropy
|
||||
});
|
||||
// Read image data from readableStream
|
||||
// Write 200px square auto-cropped image data to writableStream
|
||||
readableStream
|
||||
.pipe(transformer)
|
||||
.pipe(writableStream);
|
||||
```
|
||||
|
||||
```javascript
|
||||
sharp(input)
|
||||
.resize(200, 200, {
|
||||
fit: sharp.fit.inside,
|
||||
withoutEnlargement: true
|
||||
})
|
||||
.toFormat('jpeg')
|
||||
.toBuffer()
|
||||
.then(function(outputBuffer) {
|
||||
// outputBuffer contains JPEG image data
|
||||
// no wider and no higher than 200 pixels
|
||||
// and no larger than the input image
|
||||
});
|
||||
```
|
||||
|
||||
- Throws **[Error][13]** Invalid parameters
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## extend
|
||||
|
||||
Extends/pads the edges of the image with the provided background colour.
|
||||
This operation will always occur after resizing and extraction, if any.
|
||||
|
||||
### Parameters
|
||||
|
||||
- `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.left` **[Number][8]?**
|
||||
- `extend.bottom` **[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}`)
|
||||
|
||||
### Examples
|
||||
|
||||
```javascript
|
||||
// Resize to 140 pixels wide, then add 10 transparent pixels
|
||||
// to the top, left and right edges and 20 to the bottom edge
|
||||
sharp(input)
|
||||
.resize(140)
|
||||
.extend({
|
||||
top: 10,
|
||||
bottom: 20,
|
||||
left: 10,
|
||||
right: 10,
|
||||
background: { r: 0, g: 0, b: 0, alpha: 0 }
|
||||
})
|
||||
...
|
||||
```
|
||||
|
||||
- Throws **[Error][13]** Invalid parameters
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## extract
|
||||
|
||||
Extract a region of the image.
|
||||
|
||||
- Use `extract` before `resize` for pre-resize extraction.
|
||||
- Use `extract` after `resize` for post-resize extraction.
|
||||
- Use `extract` before and after for both.
|
||||
|
||||
### Parameters
|
||||
|
||||
- `options` **[Object][9]** describes the region to extract using integral pixel values
|
||||
- `options.left` **[Number][8]** zero-indexed offset from left edge
|
||||
- `options.top` **[Number][8]** zero-indexed offset from top edge
|
||||
- `options.width` **[Number][8]** width of region to extract
|
||||
- `options.height` **[Number][8]** height of region to extract
|
||||
|
||||
### Examples
|
||||
|
||||
```javascript
|
||||
sharp(input)
|
||||
.extract({ left: left, top: top, width: width, height: height })
|
||||
.toFile(output, function(err) {
|
||||
// Extract a region of the input image, saving in the same format.
|
||||
});
|
||||
```
|
||||
|
||||
```javascript
|
||||
sharp(input)
|
||||
.extract({ left: leftOffsetPre, top: topOffsetPre, width: widthPre, height: heightPre })
|
||||
.resize(width, height)
|
||||
.extract({ left: leftOffsetPost, top: topOffsetPost, width: widthPost, height: heightPost })
|
||||
.toFile(output, function(err) {
|
||||
// Extract a region, resize, then extract from the resized image
|
||||
});
|
||||
```
|
||||
|
||||
- Throws **[Error][13]** Invalid parameters
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
## trim
|
||||
|
||||
Trim "boring" pixels from all edges that contain values similar to the top-left pixel.
|
||||
The `info` response Object will contain `trimOffsetLeft` and `trimOffsetTop` properties.
|
||||
|
||||
### Parameters
|
||||
|
||||
- `threshold` **[Number][8]** the allowed difference from the top-left pixel, a number greater than zero. (optional, default `10`)
|
||||
|
||||
|
||||
- Throws **[Error][13]** Invalid parameters
|
||||
|
||||
Returns **Sharp**
|
||||
|
||||
[1]: https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit
|
||||
|
||||
[2]: https://developer.mozilla.org/en-US/docs/Web/CSS/object-position
|
||||
|
||||
[3]: https://en.wikipedia.org/wiki/Entropy_%28information_theory%29
|
||||
|
||||
[4]: http://en.wikipedia.org/wiki/Nearest-neighbor_interpolation
|
||||
|
||||
[5]: https://en.wikipedia.org/wiki/Centripetal_Catmull%E2%80%93Rom_spline
|
||||
|
||||
[6]: https://www.cs.utexas.edu/~fussell/courses/cs384g-fall2013/lectures/mitchell/Mitchell.pdf
|
||||
|
||||
[7]: https://en.wikipedia.org/wiki/Lanczos_resampling#Lanczos_kernel
|
||||
|
||||
[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
||||
|
||||
[9]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
||||
|
||||
[10]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
||||
|
||||
[11]: https://www.npmjs.org/package/color
|
||||
|
||||
[12]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
|
||||
|
||||
[13]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error
|
||||
102
node_modules/sharp/docs/api-utility.md
generated
vendored
Normal file
102
node_modules/sharp/docs/api-utility.md
generated
vendored
Normal file
@ -0,0 +1,102 @@
|
||||
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
||||
|
||||
## cache
|
||||
|
||||
Gets or, when options are provided, sets the limits of _libvips'_ operation cache.
|
||||
Existing entries in the cache will be trimmed after any change in limits.
|
||||
This method always returns cache statistics,
|
||||
useful for determining how much working memory is required for a particular task.
|
||||
|
||||
### 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.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.items` **[Number][3]** is the maximum number of operations to cache (optional, default `100`)
|
||||
|
||||
### Examples
|
||||
|
||||
```javascript
|
||||
const stats = sharp.cache();
|
||||
```
|
||||
|
||||
```javascript
|
||||
sharp.cache( { items: 200 } );
|
||||
sharp.cache( { files: 0 } );
|
||||
sharp.cache(false);
|
||||
```
|
||||
|
||||
Returns **[Object][1]**
|
||||
|
||||
## concurrency
|
||||
|
||||
Gets or, when a concurrency is provided, sets
|
||||
the number of threads _libvips'_ should create to process each image.
|
||||
The default value is the number of CPU cores.
|
||||
A value of `0` will reset to this default.
|
||||
|
||||
The maximum number of images that can be processed in parallel
|
||||
is limited by libuv's `UV_THREADPOOL_SIZE` environment variable.
|
||||
|
||||
This method always returns the current concurrency.
|
||||
|
||||
### Parameters
|
||||
|
||||
- `concurrency` **[Number][3]?**
|
||||
|
||||
### Examples
|
||||
|
||||
```javascript
|
||||
const threads = sharp.concurrency(); // 4
|
||||
sharp.concurrency(2); // 2
|
||||
sharp.concurrency(0); // 4
|
||||
```
|
||||
|
||||
Returns **[Number][3]** concurrency
|
||||
|
||||
## counters
|
||||
|
||||
Provides access to internal task counters.
|
||||
|
||||
- queue is the number of tasks this module has queued waiting for _libuv_ to provide a worker thread from its pool.
|
||||
- process is the number of resize tasks currently being processed.
|
||||
|
||||
### Examples
|
||||
|
||||
```javascript
|
||||
const counters = sharp.counters(); // { queue: 2, process: 4 }
|
||||
```
|
||||
|
||||
Returns **[Object][1]**
|
||||
|
||||
## simd
|
||||
|
||||
Get and set use of SIMD vector unit instructions.
|
||||
Requires libvips to have been compiled with liborc support.
|
||||
|
||||
Improves the performance of `resize`, `blur` and `sharpen` operations
|
||||
by taking advantage of the SIMD vector unit of the CPU, e.g. Intel SSE and ARM NEON.
|
||||
|
||||
### Parameters
|
||||
|
||||
- `simd` **[Boolean][2]** (optional, default `true`)
|
||||
|
||||
### Examples
|
||||
|
||||
```javascript
|
||||
const simd = sharp.simd();
|
||||
// simd is `true` if the runtime use of liborc is currently enabled
|
||||
```
|
||||
|
||||
```javascript
|
||||
const simd = sharp.simd(false);
|
||||
// prevent libvips from using liborc at runtime
|
||||
```
|
||||
|
||||
Returns **[Boolean][2]**
|
||||
|
||||
[1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
||||
|
||||
[2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
|
||||
|
||||
[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
||||
939
node_modules/sharp/docs/changelog.md
generated
vendored
Normal file
939
node_modules/sharp/docs/changelog.md
generated
vendored
Normal file
@ -0,0 +1,939 @@
|
||||
# Changelog
|
||||
|
||||
### v0.22 - "*uptake*"
|
||||
|
||||
Requires libvips v8.7.4.
|
||||
|
||||
#### v0.22.1 - 25<sup>th</sup> April 2019
|
||||
|
||||
* Add `modulate` operation for brightness, saturation and hue.
|
||||
[#1601](https://github.com/lovell/sharp/pull/1601)
|
||||
[@Goues](https://github.com/Goues)
|
||||
|
||||
* Improve help messaging should `require("sharp")` fail.
|
||||
[#1638](https://github.com/lovell/sharp/pull/1638)
|
||||
[@sidharthachatterjee](https://github.com/sidharthachatterjee)
|
||||
|
||||
* Add support for Node 12.
|
||||
[#1668](https://github.com/lovell/sharp/issues/1668)
|
||||
|
||||
#### v0.22.0 - 18<sup>th</sup> March 2019
|
||||
|
||||
* Remove functions previously deprecated in v0.21.0:
|
||||
`background`, `crop`, `embed`, `ignoreAspectRatio`, `max`, `min` and `withoutEnlargement`.
|
||||
|
||||
* Add `composite` operation supporting multiple images and blend modes; deprecate `overlayWith`.
|
||||
[#728](https://github.com/lovell/sharp/issues/728)
|
||||
|
||||
* Add support for `pages` input option for multi-page input.
|
||||
[#1566](https://github.com/lovell/sharp/issues/1566)
|
||||
|
||||
* Allow Stream-based input of raw pixel data.
|
||||
[#1579](https://github.com/lovell/sharp/issues/1579)
|
||||
|
||||
* Add support for `page` input option to GIF and PDF.
|
||||
[#1595](https://github.com/lovell/sharp/pull/1595)
|
||||
[@ramiel](https://github.com/ramiel)
|
||||
|
||||
### v0.21 - "*teeth*"
|
||||
|
||||
Requires libvips v8.7.0.
|
||||
|
||||
#### v0.21.3 - 19<sup>th</sup> January 2019
|
||||
|
||||
* Input image decoding now fails fast, set `failOnError` to change this behaviour.
|
||||
|
||||
* Failed filesystem-based input now separates missing file and invalid format errors.
|
||||
[#1542](https://github.com/lovell/sharp/issues/1542)
|
||||
|
||||
#### v0.21.2 - 13<sup>th</sup> January 2019
|
||||
|
||||
* Ensure all metadata is removed from PNG output unless `withMetadata` used.
|
||||
|
||||
* Ensure shortest edge is at least one pixel after resizing.
|
||||
[#1003](https://github.com/lovell/sharp/issues/1003)
|
||||
|
||||
* Add `ensureAlpha` operation to add an alpha channel, if missing.
|
||||
[#1153](https://github.com/lovell/sharp/issues/1153)
|
||||
|
||||
* Expose `pages` and `pageHeight` metadata for multi-page input images.
|
||||
[#1205](https://github.com/lovell/sharp/issues/1205)
|
||||
|
||||
* Expose PNG output options requiring libimagequant.
|
||||
[#1484](https://github.com/lovell/sharp/issues/1484)
|
||||
|
||||
* Expose underlying error message for invalid input.
|
||||
[#1505](https://github.com/lovell/sharp/issues/1505)
|
||||
|
||||
* Prevent mutatation of options passed to `jpeg`.
|
||||
[#1516](https://github.com/lovell/sharp/issues/1516)
|
||||
|
||||
* Ensure forced output format applied correctly when output chaining.
|
||||
[#1528](https://github.com/lovell/sharp/issues/1528)
|
||||
|
||||
#### v0.21.1 - 7<sup>th</sup> December 2018
|
||||
|
||||
* Install: support `sharp_dist_base_url` npm config, like existing `SHARP_DIST_BASE_URL`.
|
||||
[#1422](https://github.com/lovell/sharp/pull/1422)
|
||||
[@SethWen](https://github.com/SethWen)
|
||||
|
||||
* Ensure `channel` metadata is correct for raw, greyscale output.
|
||||
[#1425](https://github.com/lovell/sharp/issues/1425)
|
||||
|
||||
* Add support for the "mitchell" kernel for image reductions.
|
||||
[#1438](https://github.com/lovell/sharp/pull/1438)
|
||||
[@Daiz](https://github.com/Daiz)
|
||||
|
||||
* Allow separate parameters for gamma encoding and decoding.
|
||||
[#1439](https://github.com/lovell/sharp/pull/1439)
|
||||
[@Daiz](https://github.com/Daiz)
|
||||
|
||||
* Build prototype with `Object.assign` to allow minification.
|
||||
[#1475](https://github.com/lovell/sharp/pull/1475)
|
||||
[@jaubourg](https://github.com/jaubourg)
|
||||
|
||||
* Expose libvips' recombination matrix operation.
|
||||
[#1477](https://github.com/lovell/sharp/pull/1477)
|
||||
[@fromkeith](https://github.com/fromkeith)
|
||||
|
||||
* Expose libvips' pyramid/tile options for TIFF output.
|
||||
[#1483](https://github.com/lovell/sharp/pull/1483)
|
||||
[@mbklein](https://github.com/mbklein)
|
||||
|
||||
#### v0.21.0 - 4<sup>th</sup> October 2018
|
||||
|
||||
* Deprecate the following resize-related functions:
|
||||
`crop`, `embed`, `ignoreAspectRatio`, `max`, `min` and `withoutEnlargement`.
|
||||
Access to these is now via options passed to the `resize` function.
|
||||
For example:
|
||||
`embed('north')` is now `resize(width, height, { fit: 'contain', position: 'north' })`,
|
||||
`crop('attention')` is now `resize(width, height, { fit: 'cover', position: 'attention' })`,
|
||||
`max().withoutEnlargement()` is now `resize(width, height, { fit: 'inside', withoutEnlargement: true })`.
|
||||
[#1135](https://github.com/lovell/sharp/issues/1135)
|
||||
|
||||
* Deprecate the `background` function.
|
||||
Per-operation `background` options added to `resize`, `extend` and `flatten` operations.
|
||||
[#1392](https://github.com/lovell/sharp/issues/1392)
|
||||
|
||||
* Add `size` to `metadata` response (Stream and Buffer input only).
|
||||
[#695](https://github.com/lovell/sharp/issues/695)
|
||||
|
||||
* Switch from custom trim operation to `vips_find_trim`.
|
||||
[#914](https://github.com/lovell/sharp/issues/914)
|
||||
|
||||
* Add `chromaSubsampling` and `isProgressive` properties to `metadata` response.
|
||||
[#1186](https://github.com/lovell/sharp/issues/1186)
|
||||
|
||||
* Drop Node 4 support.
|
||||
[#1212](https://github.com/lovell/sharp/issues/1212)
|
||||
|
||||
* Enable SIMD convolution by default.
|
||||
[#1213](https://github.com/lovell/sharp/issues/1213)
|
||||
|
||||
* Add experimental prebuilt binaries for musl-based Linux.
|
||||
[#1379](https://github.com/lovell/sharp/issues/1379)
|
||||
|
||||
* Add support for arbitrary rotation angle via vips_rotate.
|
||||
[#1385](https://github.com/lovell/sharp/pull/1385)
|
||||
[@freezy](https://github.com/freezy)
|
||||
|
||||
### v0.20 - "*prebuild*"
|
||||
|
||||
Requires libvips v8.6.1.
|
||||
|
||||
#### v0.20.8 - 5<sup>th</sup> September 2018
|
||||
|
||||
* Avoid race conditions when creating directories during installation.
|
||||
[#1358](https://github.com/lovell/sharp/pull/1358)
|
||||
[@ajhool](https://github.com/ajhool)
|
||||
|
||||
* Accept floating point values for input density parameter.
|
||||
[#1362](https://github.com/lovell/sharp/pull/1362)
|
||||
[@aeirola](https://github.com/aeirola)
|
||||
|
||||
#### v0.20.7 - 21<sup>st</sup> August 2018
|
||||
|
||||
* Use copy+unlink if rename operation fails during installation.
|
||||
[#1345](https://github.com/lovell/sharp/issues/1345)
|
||||
|
||||
#### v0.20.6 - 20<sup>th</sup> August 2018
|
||||
|
||||
* Add removeAlpha operation to remove alpha channel, if any.
|
||||
[#1248](https://github.com/lovell/sharp/issues/1248)
|
||||
|
||||
* Expose mozjpeg quant_table flag.
|
||||
[#1285](https://github.com/lovell/sharp/pull/1285)
|
||||
[@rexxars](https://github.com/rexxars)
|
||||
|
||||
* Allow full WebP alphaQuality range of 0-100.
|
||||
[#1290](https://github.com/lovell/sharp/pull/1290)
|
||||
[@sylvaindumont](https://github.com/sylvaindumont)
|
||||
|
||||
* Cache libvips binaries to reduce re-install time.
|
||||
[#1301](https://github.com/lovell/sharp/issues/1301)
|
||||
|
||||
* Ensure vendor platform mismatch throws error at install time.
|
||||
[#1303](https://github.com/lovell/sharp/issues/1303)
|
||||
|
||||
* Improve install time error messages for FreeBSD users.
|
||||
[#1310](https://github.com/lovell/sharp/issues/1310)
|
||||
|
||||
* Ensure extractChannel works with 16-bit images.
|
||||
[#1330](https://github.com/lovell/sharp/issues/1330)
|
||||
|
||||
* Expose depth option for tile-based output.
|
||||
[#1342](https://github.com/lovell/sharp/pull/1342)
|
||||
[@alundavies](https://github.com/alundavies)
|
||||
|
||||
* Add experimental entropy field to stats response.
|
||||
|
||||
#### v0.20.5 - 27<sup>th</sup> June 2018
|
||||
|
||||
* Expose libjpeg optimize_coding flag.
|
||||
[#1265](https://github.com/lovell/sharp/pull/1265)
|
||||
[@tomlokhorst](https://github.com/tomlokhorst)
|
||||
|
||||
#### v0.20.4 - 20<sup>th</sup> June 2018
|
||||
|
||||
* Prevent possible rounding error when using shrink-on-load and 90/270 degree rotation.
|
||||
[#1241](https://github.com/lovell/sharp/issues/1241)
|
||||
[@anahit42](https://github.com/anahit42)
|
||||
|
||||
* Ensure extractChannel sets correct single-channel colour space interpretation.
|
||||
[#1257](https://github.com/lovell/sharp/issues/1257)
|
||||
[@jeremychone](https://github.com/jeremychone)
|
||||
|
||||
#### v0.20.3 - 29<sup>th</sup> May 2018
|
||||
|
||||
* Fix tint operation by ensuring LAB interpretation and allowing negative values.
|
||||
[#1235](https://github.com/lovell/sharp/issues/1235)
|
||||
[@wezside](https://github.com/wezside)
|
||||
|
||||
#### v0.20.2 - 28<sup>th</sup> April 2018
|
||||
|
||||
* Add tint operation to set image chroma.
|
||||
[#825](https://github.com/lovell/sharp/pull/825)
|
||||
[@rikh42](https://github.com/rikh42)
|
||||
|
||||
* Add environment variable to ignore globally-installed libvips.
|
||||
[#1165](https://github.com/lovell/sharp/pull/1165)
|
||||
[@oncletom](https://github.com/oncletom)
|
||||
|
||||
* Add support for page selection with multi-page input (GIF/TIFF).
|
||||
[#1204](https://github.com/lovell/sharp/pull/1204)
|
||||
[@woolite64](https://github.com/woolite64)
|
||||
|
||||
* Add support for Group4 (CCITTFAX4) compression with TIFF output.
|
||||
[#1208](https://github.com/lovell/sharp/pull/1208)
|
||||
[@woolite64](https://github.com/woolite64)
|
||||
|
||||
#### v0.20.1 - 17<sup>th</sup> March 2018
|
||||
|
||||
* Improve installation experience when a globally-installed libvips below the minimum required version is found.
|
||||
[#1148](https://github.com/lovell/sharp/issues/1148)
|
||||
|
||||
* Prevent smartcrop error when cumulative rounding is below target size.
|
||||
[#1154](https://github.com/lovell/sharp/issues/1154)
|
||||
[@ralrom](https://github.com/ralrom)
|
||||
|
||||
* Expose libvips' median filter operation.
|
||||
[#1161](https://github.com/lovell/sharp/pull/1161)
|
||||
[@BiancoA](https://github.com/BiancoA)
|
||||
|
||||
#### v0.20.0 - 5<sup>th</sup> March 2018
|
||||
|
||||
* Add support for prebuilt sharp binaries on common platforms.
|
||||
[#186](https://github.com/lovell/sharp/issues/186)
|
||||
|
||||
### v0.19 - "*suit*"
|
||||
|
||||
Requires libvips v8.6.1.
|
||||
|
||||
#### v0.19.1 - 24<sup>th</sup> February 2018
|
||||
|
||||
* Expose libvips' linear transform feature.
|
||||
[#1024](https://github.com/lovell/sharp/pull/1024)
|
||||
[@3epnm](https://github.com/3epnm)
|
||||
|
||||
* Expose angle option for tile-based output.
|
||||
[#1121](https://github.com/lovell/sharp/pull/1121)
|
||||
[@BiancoA](https://github.com/BiancoA)
|
||||
|
||||
* Prevent crop operation when image already at or below target dimensions.
|
||||
[#1134](https://github.com/lovell/sharp/issues/1134)
|
||||
[@pieh](https://github.com/pieh)
|
||||
|
||||
#### v0.19.0 - 11<sup>th</sup> January 2018
|
||||
|
||||
* Expose offset coordinates of strategy-based crop.
|
||||
[#868](https://github.com/lovell/sharp/issues/868)
|
||||
[@mirohristov-com](https://github.com/mirohristov-com)
|
||||
|
||||
* PNG output now defaults to adaptiveFiltering=false, compressionLevel=9
|
||||
[#872](https://github.com/lovell/sharp/issues/872)
|
||||
[@wmertens](https://github.com/wmertens)
|
||||
|
||||
* Add stats feature for pixel-derived image statistics.
|
||||
[#915](https://github.com/lovell/sharp/pull/915)
|
||||
[@rnanwani](https://github.com/rnanwani)
|
||||
|
||||
* Add failOnError option to fail-fast on bad input image data.
|
||||
[#976](https://github.com/lovell/sharp/pull/976)
|
||||
[@mceachen](https://github.com/mceachen)
|
||||
|
||||
* Resize: switch to libvips' implementation, make fastShrinkOnLoad optional, remove interpolator and centreSampling options.
|
||||
[#977](https://github.com/lovell/sharp/pull/977)
|
||||
[@jardakotesovec](https://github.com/jardakotesovec)
|
||||
|
||||
* Attach finish event listener to a clone only for Stream-based input.
|
||||
[#995](https://github.com/lovell/sharp/issues/995)
|
||||
[@whmountains](https://github.com/whmountains)
|
||||
|
||||
* Add tilecache before smartcrop to avoid over-computation of previous operations.
|
||||
[#1028](https://github.com/lovell/sharp/issues/1028)
|
||||
[@coffeebite](https://github.com/coffeebite)
|
||||
|
||||
* Prevent toFile extension taking precedence over requested format.
|
||||
[#1037](https://github.com/lovell/sharp/issues/1037)
|
||||
[@tomgallagher](https://github.com/tomgallagher)
|
||||
|
||||
* Add support for gravity option to existing embed feature.
|
||||
[#1038](https://github.com/lovell/sharp/pull/1038)
|
||||
[@AzureByte](https://github.com/AzureByte)
|
||||
|
||||
* Expose IPTC and XMP metadata when available.
|
||||
[#1079](https://github.com/lovell/sharp/pull/1079)
|
||||
[@oaleynik](https://github.com/oaleynik)
|
||||
|
||||
* TIFF output: switch default predictor from 'none' to 'horizontal' to match libvips' behaviour.
|
||||
|
||||
### v0.18 - "*ridge*"
|
||||
|
||||
Requires libvips v8.5.5.
|
||||
|
||||
#### v0.18.4 - 18<sup>th</sup> September 2017
|
||||
|
||||
* Ensure input Buffer really is marked as Persistent, prevents mark-sweep GC.
|
||||
[#950](https://github.com/lovell/sharp/issues/950)
|
||||
[@lfdoherty](https://github.com/lfdoherty)
|
||||
|
||||
#### v0.18.3 - 13<sup>th</sup> September 2017
|
||||
|
||||
* Skip shrink-on-load when trimming.
|
||||
[#888](https://github.com/lovell/sharp/pull/888)
|
||||
[@kleisauke](https://github.com/kleisauke)
|
||||
|
||||
* Migrate from got to simple-get for basic auth support.
|
||||
[#945](https://github.com/lovell/sharp/pull/945)
|
||||
[@pbomb](https://github.com/pbomb)
|
||||
|
||||
#### v0.18.2 - 1<sup>st</sup> July 2017
|
||||
|
||||
* Expose libvips' xres and yres properties for TIFF output.
|
||||
[#828](https://github.com/lovell/sharp/pull/828)
|
||||
[@YvesBos](https://github.com/YvesBos)
|
||||
|
||||
* Ensure flip and flop operations work with auto-rotate.
|
||||
[#837](https://github.com/lovell/sharp/issues/837)
|
||||
[@rexxars](https://github.com/rexxars)
|
||||
|
||||
* Allow binary download URL override via SHARP_DIST_BASE_URL env variable.
|
||||
[#841](https://github.com/lovell/sharp/issues/841)
|
||||
|
||||
* Add support for Solus Linux.
|
||||
[#857](https://github.com/lovell/sharp/pull/857)
|
||||
[@ekremkaraca](https://github.com/ekremkaraca)
|
||||
|
||||
#### v0.18.1 - 30<sup>th</sup> May 2017
|
||||
|
||||
* Remove regression from #781 that could cause incorrect shrink calculation.
|
||||
[#831](https://github.com/lovell/sharp/issues/831)
|
||||
[@suprMax](https://github.com/suprMax)
|
||||
|
||||
#### v0.18.0 - 30<sup>th</sup> May 2017
|
||||
|
||||
* Remove the previously-deprecated output format "option" functions:
|
||||
quality, progressive, compressionLevel, withoutAdaptiveFiltering,
|
||||
withoutChromaSubsampling, trellisQuantisation, trellisQuantization,
|
||||
overshootDeringing, optimiseScans and optimizeScans.
|
||||
|
||||
* Ensure maximum output dimensions are based on the format to be used.
|
||||
[#176](https://github.com/lovell/sharp/issues/176)
|
||||
[@stephanebachelier](https://github.com/stephanebachelier)
|
||||
|
||||
* Avoid costly (un)premultiply when using overlayWith without alpha channel.
|
||||
[#573](https://github.com/lovell/sharp/issues/573)
|
||||
[@strarsis](https://github.com/strarsis)
|
||||
|
||||
* Include pixel depth (e.g. "uchar") when reading metadata.
|
||||
[#577](https://github.com/lovell/sharp/issues/577)
|
||||
[@moedusa](https://github.com/moedusa)
|
||||
|
||||
* Add support for Buffer and Stream-based TIFF output.
|
||||
[#587](https://github.com/lovell/sharp/issues/587)
|
||||
[@strarsis](https://github.com/strarsis)
|
||||
|
||||
* Expose warnings from libvips via NODE_DEBUG=sharp environment variable.
|
||||
[#607](https://github.com/lovell/sharp/issues/607)
|
||||
[@puzrin](https://github.com/puzrin)
|
||||
|
||||
* Switch to the libvips implementation of "attention" and "entropy" crop strategies.
|
||||
[#727](https://github.com/lovell/sharp/issues/727)
|
||||
|
||||
* Improve performance and accuracy of nearest neighbour integral upsampling.
|
||||
[#752](https://github.com/lovell/sharp/issues/752)
|
||||
[@MrIbby](https://github.com/MrIbby)
|
||||
|
||||
* Constructor single argument API: allow plain object, reject null/undefined.
|
||||
[#768](https://github.com/lovell/sharp/issues/768)
|
||||
[@kub1x](https://github.com/kub1x)
|
||||
|
||||
* Ensure ARM64 pre-built binaries use correct C++11 ABI version.
|
||||
[#772](https://github.com/lovell/sharp/issues/772)
|
||||
[@ajiratech2](https://github.com/ajiratech2)
|
||||
|
||||
* Prevent aliasing by using dynamic values for shrink(-on-load).
|
||||
[#781](https://github.com/lovell/sharp/issues/781)
|
||||
[@kleisauke](https://github.com/kleisauke)
|
||||
|
||||
* Expose libvips' "squash" parameter to enable 1-bit TIFF output.
|
||||
[#783](https://github.com/lovell/sharp/pull/783)
|
||||
[@YvesBos](https://github.com/YvesBos)
|
||||
|
||||
* Add support for rotation using any multiple of +/-90 degrees.
|
||||
[#791](https://github.com/lovell/sharp/pull/791)
|
||||
[@ncoden](https://github.com/ncoden)
|
||||
|
||||
* Add "jpg" alias to toFormat as shortened form of "jpeg".
|
||||
[#814](https://github.com/lovell/sharp/pull/814)
|
||||
[@jingsam](https://github.com/jingsam)
|
||||
|
||||
### v0.17 - "*quill*"
|
||||
|
||||
Requires libvips v8.4.2.
|
||||
|
||||
#### v0.17.3 - 1<sup>st</sup> April 2017
|
||||
|
||||
* Allow toBuffer to optionally resolve a Promise with both info and data.
|
||||
[#143](https://github.com/lovell/sharp/issues/143)
|
||||
[@salzhrani](https://github.com/salzhrani)
|
||||
|
||||
* Create blank image of given width, height, channels and background.
|
||||
[#470](https://github.com/lovell/sharp/issues/470)
|
||||
[@pjarts](https://github.com/pjarts)
|
||||
|
||||
* Add support for the "nearest" kernel for image reductions.
|
||||
[#732](https://github.com/lovell/sharp/pull/732)
|
||||
[@alice0meta](https://github.com/alice0meta)
|
||||
|
||||
* Add support for TIFF compression and predictor options.
|
||||
[#738](https://github.com/lovell/sharp/pull/738)
|
||||
[@kristojorg](https://github.com/kristojorg)
|
||||
|
||||
#### v0.17.2 - 11<sup>th</sup> February 2017
|
||||
|
||||
* Ensure Readable side of Stream can start flowing after Writable side has finished.
|
||||
[#671](https://github.com/lovell/sharp/issues/671)
|
||||
[@danhaller](https://github.com/danhaller)
|
||||
|
||||
* Expose WebP alpha quality, lossless and near-lossless output options.
|
||||
[#685](https://github.com/lovell/sharp/pull/685)
|
||||
[@rnanwani](https://github.com/rnanwani)
|
||||
|
||||
#### v0.17.1 - 15<sup>th</sup> January 2017
|
||||
|
||||
* Improve error messages for invalid parameters.
|
||||
[@spikeon](https://github.com/spikeon)
|
||||
[#644](https://github.com/lovell/sharp/pull/644)
|
||||
|
||||
* Simplify expression for finding vips-cpp libdir.
|
||||
[#656](https://github.com/lovell/sharp/pull/656)
|
||||
|
||||
* Allow HTTPS-over-HTTP proxy when downloading pre-compiled dependencies.
|
||||
[@wangzhiwei1888](https://github.com/wangzhiwei1888)
|
||||
[#679](https://github.com/lovell/sharp/issues/679)
|
||||
|
||||
#### v0.17.0 - 11<sup>th</sup> December 2016
|
||||
|
||||
* Drop support for versions of Node prior to v4.
|
||||
|
||||
* Deprecate the following output format "option" functions:
|
||||
quality, progressive, compressionLevel, withoutAdaptiveFiltering,
|
||||
withoutChromaSubsampling, trellisQuantisation, trellisQuantization,
|
||||
overshootDeringing, optimiseScans and optimizeScans.
|
||||
Access to these is now via output format functions, for example `quality(n)`
|
||||
is now `jpeg({quality: n})` and/or `webp({quality: n})`.
|
||||
|
||||
* Autoconvert GIF and SVG input to PNG output if no other format is specified.
|
||||
|
||||
* Expose libvips' "centre" resize option to mimic \*magick's +0.5px convention.
|
||||
[#568](https://github.com/lovell/sharp/issues/568)
|
||||
|
||||
* Ensure support for embedded base64 PNG and JPEG images within an SVG.
|
||||
[#601](https://github.com/lovell/sharp/issues/601)
|
||||
[@dynamite-ready](https://github.com/dynamite-ready)
|
||||
|
||||
* Ensure premultiply operation occurs before box filter shrink.
|
||||
[#605](https://github.com/lovell/sharp/issues/605)
|
||||
[@CmdrShepardsPie](https://github.com/CmdrShepardsPie)
|
||||
[@teroparvinen](https://github.com/teroparvinen)
|
||||
|
||||
* Add support for PNG and WebP tile-based output formats (in addition to JPEG).
|
||||
[#622](https://github.com/lovell/sharp/pull/622)
|
||||
[@ppaskaris](https://github.com/ppaskaris)
|
||||
|
||||
* Allow use of extend with greyscale input.
|
||||
[#623](https://github.com/lovell/sharp/pull/623)
|
||||
[@ppaskaris](https://github.com/ppaskaris)
|
||||
|
||||
* Allow non-RGB input to embed/extend onto background with an alpha channel.
|
||||
[#646](https://github.com/lovell/sharp/issues/646)
|
||||
[@DaGaMs](https://github.com/DaGaMs)
|
||||
|
||||
### v0.16 - "*pencil*"
|
||||
|
||||
Requires libvips v8.3.3
|
||||
|
||||
#### v0.16.2 - 22<sup>nd</sup> October 2016
|
||||
|
||||
* Restrict readelf usage to Linux only when detecting global libvips version.
|
||||
[#602](https://github.com/lovell/sharp/issues/602)
|
||||
[@caoko](https://github.com/caoko)
|
||||
|
||||
#### v0.16.1 - 13<sup>th</sup> October 2016
|
||||
|
||||
* C++11 ABI version is now auto-detected, remove sharp-cxx11 installation flag.
|
||||
|
||||
* Add experimental 'attention' crop strategy.
|
||||
[#295](https://github.com/lovell/sharp/issues/295)
|
||||
|
||||
* Include .node extension for Meteor's require() implementation.
|
||||
[#537](https://github.com/lovell/sharp/issues/537)
|
||||
[@isjackwild](https://github.com/isjackwild)
|
||||
|
||||
* Ensure convolution kernel scale is clamped to a minimum value of 1.
|
||||
[#561](https://github.com/lovell/sharp/issues/561)
|
||||
[@abagshaw](https://github.com/abagshaw)
|
||||
|
||||
* Correct calculation of y-axis placement when overlaying image at a fixed point.
|
||||
[#566](https://github.com/lovell/sharp/issues/566)
|
||||
[@Nateowami](https://github.com/Nateowami)
|
||||
|
||||
#### v0.16.0 - 18<sup>th</sup> August 2016
|
||||
|
||||
* Add pre-compiled libvips for OS X, ARMv7 and ARMv8.
|
||||
[#312](https://github.com/lovell/sharp/issues/312)
|
||||
|
||||
* Ensure boolean, bandbool, extractChannel ops occur before sRGB conversion.
|
||||
[#504](https://github.com/lovell/sharp/pull/504)
|
||||
[@mhirsch](https://github.com/mhirsch)
|
||||
|
||||
* Recalculate factors after WebP shrink-on-load to avoid round-to-zero errors.
|
||||
[#508](https://github.com/lovell/sharp/issues/508)
|
||||
[@asilvas](https://github.com/asilvas)
|
||||
|
||||
* Prevent boolean errors during extract operation.
|
||||
[#511](https://github.com/lovell/sharp/pull/511)
|
||||
[@mhirsch](https://github.com/mhirsch)
|
||||
|
||||
* Add joinChannel and toColourspace/toColorspace operations.
|
||||
[#513](https://github.com/lovell/sharp/pull/513)
|
||||
[@mhirsch](https://github.com/mhirsch)
|
||||
|
||||
* Add support for raw pixel data with boolean and withOverlay operations.
|
||||
[#516](https://github.com/lovell/sharp/pull/516)
|
||||
[@mhirsch](https://github.com/mhirsch)
|
||||
|
||||
* Prevent bandbool creating a single channel sRGB image.
|
||||
[#519](https://github.com/lovell/sharp/pull/519)
|
||||
[@mhirsch](https://github.com/mhirsch)
|
||||
|
||||
* Ensure ICC profiles are removed from PNG output unless withMetadata used.
|
||||
[#521](https://github.com/lovell/sharp/issues/521)
|
||||
[@ChrisPinewood](https://github.com/ChrisPinewood)
|
||||
|
||||
* Add alpha channels, if missing, to overlayWith images.
|
||||
[#540](https://github.com/lovell/sharp/pull/540)
|
||||
[@cmtt](https://github.com/cmtt)
|
||||
|
||||
* Remove deprecated interpolateWith method - use resize(w, h, { interpolator: ... })
|
||||
[#310](https://github.com/lovell/sharp/issues/310)
|
||||
|
||||
### v0.15 - "*outfit*"
|
||||
|
||||
Requires libvips v8.3.1
|
||||
|
||||
#### v0.15.1 - 12<sup>th</sup> July 2016
|
||||
|
||||
* Concat Stream-based input in single operation for ~+3% perf and less GC.
|
||||
[#429](https://github.com/lovell/sharp/issues/429)
|
||||
[@papandreou](https://github.com/papandreou)
|
||||
|
||||
* Add alpha channel, if required, before extend operation.
|
||||
[#439](https://github.com/lovell/sharp/pull/439)
|
||||
[@frulo](https://github.com/frulo)
|
||||
|
||||
* Allow overlay image to be repeated across entire image via tile option.
|
||||
[#443](https://github.com/lovell/sharp/pull/443)
|
||||
[@lemnisk8](https://github.com/lemnisk8)
|
||||
|
||||
* Add cutout option to overlayWith feature, applies only the alpha channel of the overlay image.
|
||||
[#448](https://github.com/lovell/sharp/pull/448)
|
||||
[@kleisauke](https://github.com/kleisauke)
|
||||
|
||||
* Ensure scaling factors are calculated independently to prevent rounding errors.
|
||||
[#452](https://github.com/lovell/sharp/issues/452)
|
||||
[@puzrin](https://github.com/puzrin)
|
||||
|
||||
* Add --sharp-cxx11 flag to compile with gcc's new C++11 ABI.
|
||||
[#456](https://github.com/lovell/sharp/pull/456)
|
||||
[@kapouer](https://github.com/kapouer)
|
||||
|
||||
* Add top/left offset support to overlayWith operation.
|
||||
[#473](https://github.com/lovell/sharp/pull/473)
|
||||
[@rnanwani](https://github.com/rnanwani)
|
||||
|
||||
* Add convolve operation for kernel-based convolution.
|
||||
[#479](https://github.com/lovell/sharp/pull/479)
|
||||
[@mhirsch](https://github.com/mhirsch)
|
||||
|
||||
* Add greyscale option to threshold operation for colourspace conversion control.
|
||||
[#480](https://github.com/lovell/sharp/pull/480)
|
||||
[@mhirsch](https://github.com/mhirsch)
|
||||
|
||||
* Ensure ICC profiles are licenced for distribution.
|
||||
[#486](https://github.com/lovell/sharp/issues/486)
|
||||
[@kapouer](https://github.com/kapouer)
|
||||
|
||||
* Allow images with an alpha channel to work with LAB-colourspace based sharpen.
|
||||
[#490](https://github.com/lovell/sharp/issues/490)
|
||||
[@jwagner](https://github.com/jwagner)
|
||||
|
||||
* Add trim operation to remove "boring" edges.
|
||||
[#492](https://github.com/lovell/sharp/pull/492)
|
||||
[@kleisauke](https://github.com/kleisauke)
|
||||
|
||||
* Add bandbool feature for channel-wise boolean operations.
|
||||
[#496](https://github.com/lovell/sharp/pull/496)
|
||||
[@mhirsch](https://github.com/mhirsch)
|
||||
|
||||
* Add extractChannel operation to extract a channel from an image.
|
||||
[#497](https://github.com/lovell/sharp/pull/497)
|
||||
[@mhirsch](https://github.com/mhirsch)
|
||||
|
||||
* Add ability to read and write native libvips .v files.
|
||||
[#500](https://github.com/lovell/sharp/pull/500)
|
||||
[@mhirsch](https://github.com/mhirsch)
|
||||
|
||||
* Add boolean feature for bitwise image operations.
|
||||
[#501](https://github.com/lovell/sharp/pull/501)
|
||||
[@mhirsch](https://github.com/mhirsch)
|
||||
|
||||
#### v0.15.0 - 21<sup>st</sup> May 2016
|
||||
|
||||
* Use libvips' new Lanczos 3 kernel as default for image reduction.
|
||||
Deprecate interpolateWith method, now provided as a resize option.
|
||||
[#310](https://github.com/lovell/sharp/issues/310)
|
||||
[@jcupitt](https://github.com/jcupitt)
|
||||
|
||||
* Take advantage of libvips v8.3 features.
|
||||
Add support for libvips' new GIF and SVG loaders.
|
||||
Pre-built binaries now include giflib and librsvg, exclude *magick.
|
||||
Use shrink-on-load for WebP input.
|
||||
Break existing sharpen API to accept sigma and improve precision.
|
||||
[#369](https://github.com/lovell/sharp/issues/369)
|
||||
|
||||
* Remove unnecessary (un)premultiply operations when not resizing/compositing.
|
||||
[#413](https://github.com/lovell/sharp/issues/413)
|
||||
[@jardakotesovec](https://github.com/jardakotesovec)
|
||||
|
||||
### v0.14 - "*needle*"
|
||||
|
||||
Requires libvips v8.2.3
|
||||
|
||||
#### v0.14.1 - 16<sup>th</sup> April 2016
|
||||
|
||||
* Allow removal of limitation on input pixel count via limitInputPixels. Use with care.
|
||||
[#250](https://github.com/lovell/sharp/issues/250)
|
||||
[#316](https://github.com/lovell/sharp/pull/316)
|
||||
[@anandthakker](https://github.com/anandthakker)
|
||||
[@kentongray](https://github.com/kentongray)
|
||||
|
||||
* Use final output image for metadata passed to callback.
|
||||
[#399](https://github.com/lovell/sharp/pull/399)
|
||||
[@salzhrani](https://github.com/salzhrani)
|
||||
|
||||
* Add support for writing tiled images to a zip container.
|
||||
[#402](https://github.com/lovell/sharp/pull/402)
|
||||
[@felixbuenemann](https://github.com/felixbuenemann)
|
||||
|
||||
* Allow use of embed with 1 and 2 channel images.
|
||||
[#411](https://github.com/lovell/sharp/issues/411)
|
||||
[@janaz](https://github.com/janaz)
|
||||
|
||||
* Improve Electron compatibility by allowing node-gyp rebuilds without npm.
|
||||
[#412](https://github.com/lovell/sharp/issues/412)
|
||||
[@nouh](https://github.com/nouh)
|
||||
|
||||
#### v0.14.0 - 2<sup>nd</sup> April 2016
|
||||
|
||||
* Add ability to extend (pad) the edges of an image.
|
||||
[#128](https://github.com/lovell/sharp/issues/128)
|
||||
[@blowsie](https://github.com/blowsie)
|
||||
|
||||
* Add support for Zoomify and Google tile layouts. Breaks existing tile API.
|
||||
[#223](https://github.com/lovell/sharp/issues/223)
|
||||
[@bdunnette](https://github.com/bdunnette)
|
||||
|
||||
* Improvements to overlayWith: differing sizes/formats, gravity, buffer input.
|
||||
[#239](https://github.com/lovell/sharp/issues/239)
|
||||
[@chrisriley](https://github.com/chrisriley)
|
||||
|
||||
* Add entropy-based crop strategy to remove least interesting edges.
|
||||
[#295](https://github.com/lovell/sharp/issues/295)
|
||||
[@rightaway](https://github.com/rightaway)
|
||||
|
||||
* Expose density metadata; set density of images from vector input.
|
||||
[#338](https://github.com/lovell/sharp/issues/338)
|
||||
[@lookfirst](https://github.com/lookfirst)
|
||||
|
||||
* Emit post-processing 'info' event for Stream output.
|
||||
[#367](https://github.com/lovell/sharp/issues/367)
|
||||
[@salzhrani](https://github.com/salzhrani)
|
||||
|
||||
* Ensure output image EXIF Orientation values are within 1-8 range.
|
||||
[#385](https://github.com/lovell/sharp/pull/385)
|
||||
[@jtobinisaniceguy](https://github.com/jtobinisaniceguy)
|
||||
|
||||
* Ensure ratios are not swapped when rotating 90/270 and ignoring aspect.
|
||||
[#387](https://github.com/lovell/sharp/issues/387)
|
||||
[@kleisauke](https://github.com/kleisauke)
|
||||
|
||||
* Remove deprecated style of calling extract API. Breaks calls using positional arguments.
|
||||
[#276](https://github.com/lovell/sharp/issues/276)
|
||||
|
||||
### v0.13 - "*mind*"
|
||||
|
||||
Requires libvips v8.2.2
|
||||
|
||||
#### v0.13.1 - 27<sup>th</sup> February 2016
|
||||
|
||||
* Fix embedding onto transparent backgrounds; regression introduced in v0.13.0.
|
||||
[#366](https://github.com/lovell/sharp/issues/366)
|
||||
[@diegocsandrim](https://github.com/diegocsandrim)
|
||||
|
||||
#### v0.13.0 - 15<sup>th</sup> February 2016
|
||||
|
||||
* Improve vector image support by allowing control of density/DPI.
|
||||
Switch pre-built libs from Imagemagick to Graphicsmagick.
|
||||
[#110](https://github.com/lovell/sharp/issues/110)
|
||||
[@bradisbell](https://github.com/bradisbell)
|
||||
|
||||
* Add support for raw, uncompressed pixel Buffer/Stream input.
|
||||
[#220](https://github.com/lovell/sharp/issues/220)
|
||||
[@mikemorris](https://github.com/mikemorris)
|
||||
|
||||
* Switch from libvips' C to C++ bindings, requires upgrade to v8.2.2.
|
||||
[#299](https://github.com/lovell/sharp/issues/299)
|
||||
|
||||
* Control number of open files in libvips' cache; breaks existing `cache` behaviour.
|
||||
[#315](https://github.com/lovell/sharp/issues/315)
|
||||
[@impomezia](https://github.com/impomezia)
|
||||
|
||||
* Ensure 16-bit input images can be normalised and embedded onto transparent backgrounds.
|
||||
[#339](https://github.com/lovell/sharp/issues/339)
|
||||
[#340](https://github.com/lovell/sharp/issues/340)
|
||||
[@janaz](https://github.com/janaz)
|
||||
|
||||
* Ensure selected format takes precedence over any unknown output filename extension.
|
||||
[#344](https://github.com/lovell/sharp/issues/344)
|
||||
[@ubaltaci](https://github.com/ubaltaci)
|
||||
|
||||
* Add support for libvips' PBM, PGM, PPM and FITS image format loaders.
|
||||
[#347](https://github.com/lovell/sharp/issues/347)
|
||||
[@oaleynik](https://github.com/oaleynik)
|
||||
|
||||
* Ensure default crop gravity is center/centre.
|
||||
[#351](https://github.com/lovell/sharp/pull/351)
|
||||
[@joelmukuthu](https://github.com/joelmukuthu)
|
||||
|
||||
* Improve support for musl libc systems e.g. Alpine Linux.
|
||||
[#354](https://github.com/lovell/sharp/issues/354)
|
||||
[#359](https://github.com/lovell/sharp/pull/359)
|
||||
[@download13](https://github.com/download13)
|
||||
[@wjordan](https://github.com/wjordan)
|
||||
|
||||
* Small optimisation when reducing by an integral factor to favour shrink over affine.
|
||||
|
||||
* Add support for gamma correction of images with an alpha channel.
|
||||
|
||||
### v0.12 - "*look*"
|
||||
|
||||
Requires libvips v8.2.0
|
||||
|
||||
#### v0.12.2 - 16<sup>th</sup> January 2016
|
||||
|
||||
* Upgrade libvips to v8.2.0 for improved vips_shrink.
|
||||
|
||||
* Add pre-compiled libvips for ARMv6+ CPUs.
|
||||
|
||||
* Ensure 16-bit input images work with embed option.
|
||||
[#325](https://github.com/lovell/sharp/issues/325)
|
||||
[@janaz](https://github.com/janaz)
|
||||
|
||||
* Allow compilation with gmake to provide FreeBSD support.
|
||||
[#326](https://github.com/lovell/sharp/issues/326)
|
||||
[@c0decafe](https://github.com/c0decafe)
|
||||
|
||||
* Attempt to remove temporary file after installation.
|
||||
[#331](https://github.com/lovell/sharp/issues/331)
|
||||
[@dtoubelis](https://github.com/dtoubelis)
|
||||
|
||||
#### v0.12.1 - 12<sup>th</sup> December 2015
|
||||
|
||||
* Allow use of SIMD vector instructions (via liborc) to be toggled on/off.
|
||||
[#172](https://github.com/lovell/sharp/issues/172)
|
||||
[@bkw](https://github.com/bkw)
|
||||
[@puzrin](https://github.com/puzrin)
|
||||
|
||||
* Ensure embedded ICC profiles output with perceptual intent.
|
||||
[#321](https://github.com/lovell/sharp/issues/321)
|
||||
[@vlapo](https://github.com/vlapo)
|
||||
|
||||
* Use the NPM-configured HTTPS proxy, if any, for binary downloads.
|
||||
|
||||
#### v0.12.0 - 23<sup>rd</sup> November 2015
|
||||
|
||||
* Bundle pre-compiled libvips and its dependencies for 64-bit Linux and Windows.
|
||||
[#42](https://github.com/lovell/sharp/issues/42)
|
||||
|
||||
* Take advantage of libvips v8.1.0+ features.
|
||||
[#152](https://github.com/lovell/sharp/issues/152)
|
||||
|
||||
* Add support for 64-bit Windows. Drop support for 32-bit Windows.
|
||||
[#224](https://github.com/lovell/sharp/issues/224)
|
||||
[@sabrehagen](https://github.com/sabrehagen)
|
||||
|
||||
* Switch default interpolator to bicubic.
|
||||
[#289](https://github.com/lovell/sharp/issues/289)
|
||||
[@mahnunchik](https://github.com/mahnunchik)
|
||||
|
||||
* Pre-extract rotatation should not swap width/height.
|
||||
[#296](https://github.com/lovell/sharp/issues/296)
|
||||
[@asilvas](https://github.com/asilvas)
|
||||
|
||||
* Ensure 16-bit+alpha input images are (un)premultiplied correctly.
|
||||
[#301](https://github.com/lovell/sharp/issues/301)
|
||||
[@izaakschroeder](https://github.com/izaakschroeder)
|
||||
|
||||
* Add `threshold` operation.
|
||||
[#303](https://github.com/lovell/sharp/pull/303)
|
||||
[@dacarley](https://github.com/dacarley)
|
||||
|
||||
* Add `negate` operation.
|
||||
[#306](https://github.com/lovell/sharp/pull/306)
|
||||
[@dacarley](https://github.com/dacarley)
|
||||
|
||||
* Support `options` Object with existing `extract` operation.
|
||||
[#309](https://github.com/lovell/sharp/pull/309)
|
||||
[@papandreou](https://github.com/papandreou)
|
||||
|
||||
### v0.11 - "*knife*"
|
||||
|
||||
#### v0.11.4 - 5<sup>th</sup> November 2015
|
||||
|
||||
* Add corners, e.g. `northeast`, to existing `gravity` option.
|
||||
[#291](https://github.com/lovell/sharp/pull/291)
|
||||
[@brandonaaron](https://github.com/brandonaaron)
|
||||
|
||||
* Ensure correct auto-rotation for EXIF Orientation values 2 and 4.
|
||||
[#288](https://github.com/lovell/sharp/pull/288)
|
||||
[@brandonaaron](https://github.com/brandonaaron)
|
||||
|
||||
* Make static linking possible via `--runtime_link` install option.
|
||||
[#287](https://github.com/lovell/sharp/pull/287)
|
||||
[@vlapo](https://github.com/vlapo)
|
||||
|
||||
#### v0.11.3 - 8<sup>th</sup> September 2015
|
||||
|
||||
* Intrepret blurSigma, sharpenFlat, and sharpenJagged as double precision.
|
||||
[#263](https://github.com/lovell/sharp/pull/263)
|
||||
[@chrisriley](https://github.com/chrisriley)
|
||||
|
||||
#### v0.11.2 - 28<sup>th</sup> August 2015
|
||||
|
||||
* Allow crop gravity to be provided as a String.
|
||||
[#255](https://github.com/lovell/sharp/pull/255)
|
||||
[@papandreou](https://github.com/papandreou)
|
||||
* Add support for io.js v3 and Node v4.
|
||||
[#246](https://github.com/lovell/sharp/issues/246)
|
||||
|
||||
#### v0.11.1 - 12<sup>th</sup> August 2015
|
||||
|
||||
* Silence MSVC warning: "C4530: C++ exception handler used, but unwind semantics are not enabled".
|
||||
[#244](https://github.com/lovell/sharp/pull/244)
|
||||
[@TheThing](https://github.com/TheThing)
|
||||
|
||||
* Suppress gamma correction for input image with alpha transparency.
|
||||
[#249](https://github.com/lovell/sharp/issues/249)
|
||||
[@compeak](https://github.com/compeak)
|
||||
|
||||
#### v0.11.0 - 15<sup>th</sup> July 2015
|
||||
|
||||
* Allow alpha transparency compositing via new `overlayWith` method.
|
||||
[#97](https://github.com/lovell/sharp/issues/97)
|
||||
[@gasi](https://github.com/gasi)
|
||||
|
||||
* Expose raw ICC profile data as a Buffer when using `metadata`.
|
||||
[#129](https://github.com/lovell/sharp/issues/129)
|
||||
[@homerjam](https://github.com/homerjam)
|
||||
|
||||
* Allow image header updates via a parameter passed to existing `withMetadata` method.
|
||||
Provide initial support for EXIF `Orientation` tag,
|
||||
which if present is now removed when using `rotate`, `flip` or `flop`.
|
||||
[#189](https://github.com/lovell/sharp/issues/189)
|
||||
[@h2non](https://github.com/h2non)
|
||||
|
||||
* Tighten constructor parameter checks.
|
||||
[#221](https://github.com/lovell/sharp/issues/221)
|
||||
[@mikemorris](https://github.com/mikemorris)
|
||||
|
||||
* Allow one input Stream to be shared with two or more output Streams via new `clone` method.
|
||||
[#235](https://github.com/lovell/sharp/issues/235)
|
||||
[@jaubourg](https://github.com/jaubourg)
|
||||
|
||||
* Use `round` instead of `floor` when auto-scaling dimensions to avoid floating-point rounding errors.
|
||||
[#238](https://github.com/lovell/sharp/issues/238)
|
||||
[@richardadjogah](https://github.com/richardadjogah)
|
||||
|
||||
### v0.10 - "*judgment*"
|
||||
|
||||
#### v0.10.1 - 1<sup>st</sup> June 2015
|
||||
|
||||
* Allow embed of image with alpha transparency onto non-transparent background.
|
||||
[#204](https://github.com/lovell/sharp/issues/204)
|
||||
[@mikemliu](https://github.com/mikemliu)
|
||||
|
||||
* Include C standard library for `atoi` as Xcode 6.3 appears to no longer do this.
|
||||
[#228](https://github.com/lovell/sharp/issues/228)
|
||||
[@doggan](https://github.com/doggan)
|
||||
|
||||
#### v0.10.0 - 23<sup>rd</sup> April 2015
|
||||
|
||||
* Add support for Windows (x86).
|
||||
[#19](https://github.com/lovell/sharp/issues/19)
|
||||
[@DullReferenceException](https://github.com/DullReferenceException)
|
||||
[@itsananderson](https://github.com/itsananderson)
|
||||
|
||||
* Add support for Openslide input and DeepZoom output.
|
||||
[#146](https://github.com/lovell/sharp/issues/146)
|
||||
[@mvictoras](https://github.com/mvictoras)
|
||||
|
||||
* Allow arbitrary aspect ratios when resizing images via new `ignoreAspectRatio` method.
|
||||
[#192](https://github.com/lovell/sharp/issues/192)
|
||||
[@skedastik](https://github.com/skedastik)
|
||||
|
||||
* Enhance output image contrast by stretching its luminance to cover the full dynamic range via new `normalize` method.
|
||||
[#194](https://github.com/lovell/sharp/issues/194)
|
||||
[@bkw](https://github.com/bkw)
|
||||
[@codingforce](https://github.com/codingforce)
|
||||
5
node_modules/sharp/docs/image/sharp-logo.svg
generated
vendored
Normal file
5
node_modules/sharp/docs/image/sharp-logo.svg
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="86 86 550 550">
|
||||
<!-- Copyright 2019 Lovell Fuller. This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) License. -->
|
||||
<path fill="none" stroke="#9c0" stroke-width="80" d="M258.411 285.777l200.176-26.8M244.113 466.413L451.44 438.66M451.441 438.66V238.484M451.441 88.363v171.572l178.725-23.917M270.323 255.602V477.22M272.71 634.17V462.591L93.984 486.515"/>
|
||||
<path fill="none" stroke="#090" stroke-width="80" d="M451.441 610.246V438.66l178.725-23.91M269.688 112.59v171.58L90.964 308.093"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 592 B |
144
node_modules/sharp/docs/index.md
generated
vendored
Normal file
144
node_modules/sharp/docs/index.md
generated
vendored
Normal file
@ -0,0 +1,144 @@
|
||||
# sharp
|
||||
|
||||
<img src="image/sharp-logo.svg" width="160" height="160" alt="sharp logo" align="right">
|
||||
|
||||
The typical use case for this high speed Node.js module
|
||||
is to convert large images in common formats to
|
||||
smaller, web-friendly JPEG, PNG and WebP images of varying dimensions.
|
||||
|
||||
Resizing an image is typically 4x-5x faster than using the
|
||||
quickest ImageMagick and GraphicsMagick settings.
|
||||
|
||||
Colour spaces, embedded ICC profiles and alpha transparency channels are all handled correctly.
|
||||
Lanczos resampling ensures quality is not sacrificed for speed.
|
||||
|
||||
As well as image resizing, operations such as
|
||||
rotation, extraction, compositing and gamma correction are available.
|
||||
|
||||
Most modern 64-bit OS X, Windows and Linux systems running
|
||||
Node versions 6, 8, 10, 11 and 12
|
||||
do not require any additional install or runtime dependencies.
|
||||
|
||||
[](https://coveralls.io/r/lovell/sharp?branch=master)
|
||||
|
||||
### Formats
|
||||
|
||||
This module supports reading JPEG, PNG, WebP, TIFF, GIF and SVG images.
|
||||
|
||||
Output images can be in JPEG, PNG, WebP and TIFF formats as well as uncompressed raw pixel data.
|
||||
|
||||
Streams, Buffer objects and the filesystem can be used for input and output.
|
||||
|
||||
A single input Stream can be split into multiple processing pipelines and output Streams.
|
||||
|
||||
Deep Zoom image pyramids can be generated,
|
||||
suitable for use with "slippy map" tile viewers like
|
||||
[OpenSeadragon](https://github.com/openseadragon/openseadragon)
|
||||
and [Leaflet](https://github.com/turban/Leaflet.Zoomify).
|
||||
|
||||
### Fast
|
||||
|
||||
This module is powered by the blazingly fast
|
||||
[libvips](https://github.com/libvips/libvips) image processing library,
|
||||
originally created in 1989 at Birkbeck College
|
||||
and currently maintained by
|
||||
[John Cupitt](https://github.com/jcupitt).
|
||||
|
||||
Only small regions of uncompressed image data
|
||||
are held in memory and processed at a time,
|
||||
taking full advantage of multiple CPU cores and L1/L2/L3 cache.
|
||||
|
||||
Everything remains non-blocking thanks to _libuv_,
|
||||
no child processes are spawned and Promises/async/await are supported.
|
||||
|
||||
### Optimal
|
||||
|
||||
Huffman tables are optimised when generating JPEG output images
|
||||
without having to use separate command line tools like
|
||||
[jpegoptim](https://github.com/tjko/jpegoptim) and
|
||||
[jpegtran](http://jpegclub.org/jpegtran/).
|
||||
|
||||
PNG filtering is disabled by default,
|
||||
which for diagrams and line art often produces the same result
|
||||
as [pngcrush](https://pmt.sourceforge.io/pngcrush/).
|
||||
|
||||
### Contributing
|
||||
|
||||
A [guide for contributors](https://github.com/lovell/sharp/blob/master/.github/CONTRIBUTING.md)
|
||||
covers reporting bugs, requesting features and submitting code changes.
|
||||
|
||||
### Credits
|
||||
|
||||
This module would never have been possible without
|
||||
the help and code contributions of the following people:
|
||||
|
||||
* [John Cupitt](https://github.com/jcupitt)
|
||||
* [Pierre Inglebert](https://github.com/pierreinglebert)
|
||||
* [Jonathan Ong](https://github.com/jonathanong)
|
||||
* [Chanon Sajjamanochai](https://github.com/chanon)
|
||||
* [Juliano Julio](https://github.com/julianojulio)
|
||||
* [Daniel Gasienica](https://github.com/gasi)
|
||||
* [Julian Walker](https://github.com/julianwa)
|
||||
* [Amit Pitaru](https://github.com/apitaru)
|
||||
* [Brandon Aaron](https://github.com/brandonaaron)
|
||||
* [Andreas Lind](https://github.com/papandreou)
|
||||
* [Maurus Cuelenaere](https://github.com/mcuelenaere)
|
||||
* [Linus Unnebäck](https://github.com/LinusU)
|
||||
* [Victor Mateevitsi](https://github.com/mvictoras)
|
||||
* [Alaric Holloway](https://github.com/skedastik)
|
||||
* [Bernhard K. Weisshuhn](https://github.com/bkw)
|
||||
* [David A. Carley](https://github.com/dacarley)
|
||||
* [John Tobin](https://github.com/jtobinisaniceguy)
|
||||
* [Kenton Gray](https://github.com/kentongray)
|
||||
* [Felix Bünemann](https://github.com/felixbuenemann)
|
||||
* [Samy Al Zahrani](https://github.com/salzhrani)
|
||||
* [Chintan Thakkar](https://github.com/lemnisk8)
|
||||
* [F. Orlando Galashan](https://github.com/frulo)
|
||||
* [Kleis Auke Wolthuizen](https://github.com/kleisauke)
|
||||
* [Matt Hirsch](https://github.com/mhirsch)
|
||||
* [Rahul Nanwani](https://github.com/rnanwani)
|
||||
* [Matthias Thoemmes](https://github.com/cmtt)
|
||||
* [Patrick Paskaris](https://github.com/ppaskaris)
|
||||
* [Jérémy Lal](https://github.com/kapouer)
|
||||
* [Alice Monday](https://github.com/alice0meta)
|
||||
* [Kristo Jorgenson](https://github.com/kristojorg)
|
||||
* [Yves Bos](https://github.com/YvesBos)
|
||||
* [Nicolas Coden](https://github.com/ncoden)
|
||||
* [Matt Parrish](https://github.com/pbomb)
|
||||
* [Matthew McEachen](https://github.com/mceachen)
|
||||
* [Jarda Kotěšovec](https://github.com/jardakotesovec)
|
||||
* [Kenric D'Souza](https://github.com/AzureByte)
|
||||
* [Oleh Aleinyk](https://github.com/oaleynik)
|
||||
* [Marcel Bretschneider](https://github.com/3epnm)
|
||||
* [Andrea Bianco](https://github.com/BiancoA)
|
||||
* [Rik Heywood](https://github.com/rikh42)
|
||||
* [Thomas Parisot](https://github.com/oncletom)
|
||||
* [Nathan Graves](https://github.com/woolite64)
|
||||
* [Tom Lokhorst](https://github.com/tomlokhorst)
|
||||
* [Espen Hovlandsdal](https://github.com/rexxars)
|
||||
* [Sylvain Dumont](https://github.com/sylvaindumont)
|
||||
* [Alun Davies](https://github.com/alundavies)
|
||||
* [Aidan Hoolachan](https://github.com/ajhool)
|
||||
* [Axel Eirola](https://github.com/aeirola)
|
||||
* [Freezy](https://github.com/freezy)
|
||||
* [Julian Aubourg](https://github.com/jaubourg)
|
||||
* [Keith Belovay](https://github.com/fromkeith)
|
||||
* [Michael B. Klein](https://github.com/mbklein)
|
||||
* [Jakub Michálek](https://github.com/Goues)
|
||||
|
||||
Thank you!
|
||||
|
||||
### Licensing
|
||||
|
||||
Copyright 2013, 2014, 2015, 2016, 2017, 2018, 2019 Lovell Fuller and contributors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
[https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0)
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
285
node_modules/sharp/docs/install.md
generated
vendored
Normal file
285
node_modules/sharp/docs/install.md
generated
vendored
Normal file
@ -0,0 +1,285 @@
|
||||
# Installation
|
||||
|
||||
```sh
|
||||
npm install sharp
|
||||
```
|
||||
|
||||
```sh
|
||||
yarn add sharp
|
||||
```
|
||||
|
||||
## Prerequisites
|
||||
|
||||
* Node.js v6+
|
||||
|
||||
### Building from source
|
||||
|
||||
Pre-compiled binaries for sharp are provided for use with
|
||||
Node versions 6, 8, 10, 11 and 12 on
|
||||
64-bit Windows, OS X and Linux platforms.
|
||||
|
||||
Sharp will be built from source at install time when:
|
||||
|
||||
* a globally-installed libvips is detected,
|
||||
* pre-compiled binaries do not exist for the current platform and Node version, or
|
||||
* when the `npm install --build-from-source` flag is used.
|
||||
|
||||
Building from source requires:
|
||||
|
||||
* C++11 compatible compiler such as gcc 4.8+, clang 3.0+ or MSVC 2013+
|
||||
* [node-gyp](https://github.com/nodejs/node-gyp#installation) and its dependencies (includes Python 2.7)
|
||||
|
||||
## libvips
|
||||
|
||||
### Linux
|
||||
|
||||
[](https://travis-ci.org/lovell/sharp)
|
||||
|
||||
libvips and its dependencies are fetched and stored within `node_modules/sharp/vendor` during `npm install`.
|
||||
This involves an automated HTTPS download of approximately 9MB.
|
||||
|
||||
Most Linux-based (glibc, musl) operating systems running on x64 and ARMv6+ CPUs should "just work", e.g.:
|
||||
|
||||
* Debian 7+
|
||||
* Ubuntu 14.04+
|
||||
* Centos 7+
|
||||
* Alpine 3.8+ (Node 8+)
|
||||
* Fedora
|
||||
* openSUSE 13.2+
|
||||
* Archlinux
|
||||
* Raspbian Jessie
|
||||
* Amazon Linux
|
||||
* Solus
|
||||
|
||||
To use a globally-installed version of libvips instead of the provided binaries,
|
||||
make sure it is at least the version listed under `config.libvips` in the `package.json` file
|
||||
and that it can be located using `pkg-config --modversion vips-cpp`.
|
||||
|
||||
If you are using non-standard paths (anything other than `/usr` or `/usr/local`),
|
||||
you might need to set `PKG_CONFIG_PATH` during `npm install`
|
||||
and `LD_LIBRARY_PATH` at runtime.
|
||||
|
||||
This allows the use of newer versions of libvips with older versions of sharp.
|
||||
|
||||
For 32-bit Intel CPUs and older Linux-based operating systems such as Centos 6,
|
||||
compiling libvips from source is recommended.
|
||||
|
||||
[https://libvips.github.io/libvips/install.html#building-libvips-from-a-source-tarball](https://libvips.github.io/libvips/install.html#building-libvips-from-a-source-tarball)
|
||||
|
||||
#### Alpine Linux
|
||||
|
||||
libvips is available in the
|
||||
[testing repository](https://pkgs.alpinelinux.org/packages?name=vips-dev):
|
||||
|
||||
```sh
|
||||
apk add vips-dev fftw-dev build-base --update-cache \
|
||||
--repository https://alpine.global.ssl.fastly.net/alpine/edge/testing/ \
|
||||
--repository https://alpine.global.ssl.fastly.net/alpine/edge/main
|
||||
```
|
||||
|
||||
The smaller stack size of musl libc means
|
||||
libvips may need to be used without a cache
|
||||
via `sharp.cache(false)` to avoid a stack overflow.
|
||||
|
||||
### Mac OS
|
||||
|
||||
[](https://travis-ci.org/lovell/sharp)
|
||||
|
||||
libvips and its dependencies are fetched and stored within `node_modules/sharp/vendor` during `npm install`.
|
||||
This involves an automated HTTPS download of approximately 8MB.
|
||||
|
||||
To use your own version of libvips instead of the provided binaries, make sure it is
|
||||
at least the version listed under `config.libvips` in the `package.json` file and
|
||||
that it can be located using `pkg-config --modversion vips-cpp`.
|
||||
|
||||
### Windows x64
|
||||
|
||||
[](https://ci.appveyor.com/project/lovell/sharp)
|
||||
|
||||
libvips and its dependencies are fetched and stored within `node_modules\sharp\vendor` during `npm install`.
|
||||
This involves an automated HTTPS download of approximately 14MB.
|
||||
If you are having issues during installation consider removing the directory
|
||||
`C:\Users\[user]\AppData\Roaming\npm-cache\_libvips`.
|
||||
|
||||
Only 64-bit (x64) `node.exe` is supported.
|
||||
|
||||
### FreeBSD
|
||||
|
||||
libvips must be installed before `npm install` is run.
|
||||
|
||||
This can be achieved via package or ports:
|
||||
|
||||
```sh
|
||||
pkg install -y pkgconf vips
|
||||
```
|
||||
|
||||
```sh
|
||||
cd /usr/ports/graphics/vips/ && make install clean
|
||||
```
|
||||
|
||||
FreeBSD's gcc v4 and v5 need `CXXFLAGS=-D_GLIBCXX_USE_C99` set for C++11 support due to
|
||||
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=193528
|
||||
|
||||
### Heroku
|
||||
|
||||
Set [NODE_MODULES_CACHE](https://devcenter.heroku.com/articles/nodejs-support#cache-behavior)
|
||||
to `false` when using the `yarn` package manager.
|
||||
|
||||
### Docker
|
||||
|
||||
[Marc Bachmann](https://github.com/marcbachmann) maintains an
|
||||
[Ubuntu-based Dockerfile for libvips](https://github.com/marcbachmann/dockerfile-libvips).
|
||||
|
||||
```sh
|
||||
docker pull marcbachmann/libvips
|
||||
```
|
||||
|
||||
[Will Jordan](https://github.com/wjordan) maintains an
|
||||
[Alpine-based Dockerfile for libvips](https://github.com/wjordan/dockerfile-libvips).
|
||||
|
||||
```sh
|
||||
docker pull wjordan/libvips
|
||||
```
|
||||
|
||||
[Tailor Brands](https://github.com/TailorBrands) maintain
|
||||
[Debian-based Dockerfiles for libvips and nodejs](https://github.com/TailorBrands/docker-libvips).
|
||||
|
||||
```sh
|
||||
docker pull tailor/docker-libvips
|
||||
```
|
||||
|
||||
### AWS Lambda
|
||||
|
||||
Set the Lambda runtime to Node.js 8.10.
|
||||
|
||||
The binaries in the `node_modules` directory of the
|
||||
[deployment package](https://docs.aws.amazon.com/lambda/latest/dg/nodejs-create-deployment-pkg.html)
|
||||
must be for the Linux x64 platform/architecture.
|
||||
|
||||
On non-Linux machines such as OS X and Windows run the following:
|
||||
|
||||
```sh
|
||||
rm -rf node_modules/sharp
|
||||
npm install --arch=x64 --platform=linux --target=8.10.0 sharp
|
||||
```
|
||||
|
||||
Alternatively a Docker container closely matching the Lambda runtime can be used:
|
||||
|
||||
```sh
|
||||
rm -rf node_modules/sharp
|
||||
docker run -v "$PWD":/var/task lambci/lambda:build-nodejs8.10 npm install sharp
|
||||
```
|
||||
|
||||
To get the best performance select the largest memory available.
|
||||
A 1536 MB function provides ~12x more CPU time than a 128 MB function.
|
||||
|
||||
### NW.js
|
||||
|
||||
Run the `nw-gyp` tool after installation.
|
||||
|
||||
```sh
|
||||
cd node-modules/sharp
|
||||
nw-gyp rebuild --arch=x64 --target=[your nw version]
|
||||
node node_modules/sharp/install/dll-copy
|
||||
```
|
||||
|
||||
[http://docs.nwjs.io/en/latest/For%20Users/Advanced/Use%20Native%20Node%20Modules/](http://docs.nwjs.io/en/latest/For%20Users/Advanced/Use%20Native%20Node%20Modules/)
|
||||
|
||||
### Build tools
|
||||
|
||||
* [gulp-responsive](https://www.npmjs.com/package/gulp-responsive)
|
||||
* [grunt-sharp](https://www.npmjs.com/package/grunt-sharp)
|
||||
|
||||
### Coding tools
|
||||
|
||||
* [Sharp TypeScript Types](https://www.npmjs.com/package/@types/sharp)
|
||||
|
||||
### CLI tools
|
||||
|
||||
* [sharp-cli](https://www.npmjs.com/package/sharp-cli)
|
||||
|
||||
### Security
|
||||
|
||||
Many users of this module process untrusted, user-supplied images,
|
||||
but there are aspects of security to consider when doing so.
|
||||
|
||||
It is possible to compile libvips with support for various third-party image loaders.
|
||||
Each of these libraries has undergone differing levels of security testing.
|
||||
|
||||
Whilst tools such as [American Fuzzy Lop](http://lcamtuf.coredump.cx/afl/)
|
||||
and [Valgrind](http://valgrind.org/) have been used to test
|
||||
the most popular web-based formats, as well as libvips itself,
|
||||
you are advised to perform your own testing and sandboxing.
|
||||
|
||||
### Pre-compiled libvips binaries
|
||||
|
||||
This module will attempt to download a pre-compiled bundle of libvips
|
||||
and its dependencies on Linux and Windows machines under either of these
|
||||
conditions:
|
||||
|
||||
1. If a global installation of libvips that meets the
|
||||
minimum version requirement cannot be found;
|
||||
1. If `SHARP_IGNORE_GLOBAL_LIBVIPS` environment variable is set.
|
||||
|
||||
```sh
|
||||
SHARP_IGNORE_GLOBAL_LIBVIPS=1 npm install sharp
|
||||
```
|
||||
|
||||
Should you need to manually download and inspect these files,
|
||||
you can do so via
|
||||
[https://github.com/lovell/sharp-libvips/releases](https://github.com/lovell/sharp-libvips/releases)
|
||||
|
||||
Should you wish to install these from your own location,
|
||||
set the `sharp_dist_base_url` npm config option, e.g.
|
||||
|
||||
```sh
|
||||
npm config set sharp_dist_base_url "https://hostname/path/"
|
||||
npm install sharp
|
||||
```
|
||||
|
||||
or set the `SHARP_DIST_BASE_URL` environment variable, e.g.
|
||||
|
||||
```sh
|
||||
SHARP_DIST_BASE_URL="https://hostname/path/" npm install sharp
|
||||
```
|
||||
|
||||
to use `https://hostname/path/libvips-x.y.z-platform.tar.gz`.
|
||||
|
||||
### Licences
|
||||
|
||||
This module is licensed under the terms of the
|
||||
[Apache 2.0 Licence](https://github.com/lovell/sharp/blob/master/LICENSE).
|
||||
|
||||
The libraries downloaded and used by this module
|
||||
are done so under the terms of the following licences,
|
||||
all of which are compatible with the Apache 2.0 Licence.
|
||||
|
||||
Use of libraries under the terms of the LGPLv3 is via the
|
||||
"any later version" clause of the LGPLv2 or LGPLv2.1.
|
||||
|
||||
| Library | Used under the terms of |
|
||||
|---------------|----------------------------------------------------------------------------------------------------------|
|
||||
| cairo | Mozilla Public License 2.0 |
|
||||
| expat | MIT Licence |
|
||||
| fontconfig | [fontconfig Licence](https://cgit.freedesktop.org/fontconfig/tree/COPYING) (BSD-like) |
|
||||
| freetype | [freetype Licence](http://git.savannah.gnu.org/cgit/freetype/freetype2.git/tree/docs/FTL.TXT) (BSD-like) |
|
||||
| fribidi | LGPLv3 |
|
||||
| gettext | LGPLv3 |
|
||||
| giflib | MIT Licence |
|
||||
| glib | LGPLv3 |
|
||||
| harfbuzz | MIT Licence |
|
||||
| lcms | MIT Licence |
|
||||
| libcroco | LGPLv3 |
|
||||
| libexif | LGPLv3 |
|
||||
| libffi | MIT Licence |
|
||||
| libgsf | LGPLv3 |
|
||||
| libjpeg-turbo | [zlib License, IJG License](https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/LICENSE.md) |
|
||||
| libpng | [libpng License](http://www.libpng.org/pub/png/src/libpng-LICENSE.txt) |
|
||||
| librsvg | LGPLv3 |
|
||||
| libtiff | [libtiff License](http://www.libtiff.org/misc.html) (BSD-like) |
|
||||
| libvips | LGPLv3 |
|
||||
| libwebp | New BSD License |
|
||||
| libxml2 | MIT Licence |
|
||||
| pango | LGPLv3 |
|
||||
| pixman | MIT Licence |
|
||||
| zlib | [zlib Licence](https://github.com/madler/zlib/blob/master/zlib.h) |
|
||||
69
node_modules/sharp/docs/performance.md
generated
vendored
Normal file
69
node_modules/sharp/docs/performance.md
generated
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
# Performance
|
||||
|
||||
### Test environment
|
||||
|
||||
* AWS EC2 eu-west-1 [c5.large](https://aws.amazon.com/ec2/instance-types/c5/) (2x Xeon Platinum 8124M CPU @ 3.00GHz)
|
||||
* Ubuntu 18.04 (hvm-ssd/ubuntu-bionic-18.04-amd64-server-20180912 ami-00035f41c82244dab)
|
||||
* Node.js v10.11.0
|
||||
|
||||
### The contenders
|
||||
|
||||
* [jimp](https://www.npmjs.com/package/jimp) v0.5.3 - Image processing in pure JavaScript. Provides bicubic interpolation.
|
||||
* [mapnik](https://www.npmjs.org/package/mapnik) v4.0.1 - Whilst primarily a map renderer, Mapnik contains bitmap image utilities.
|
||||
* [imagemagick-native](https://www.npmjs.com/package/imagemagick-native) v1.9.3 - Wrapper around libmagick++, supports Buffers only.
|
||||
* [imagemagick](https://www.npmjs.com/package/imagemagick) v0.1.3 - Supports filesystem only and "*has been unmaintained for a long time*".
|
||||
* [gm](https://www.npmjs.com/package/gm) v1.23.1 - Fully featured wrapper around GraphicsMagick's `gm` command line utility.
|
||||
* sharp v0.21.0 / libvips v8.7.0 - Caching within libvips disabled to ensure a fair comparison.
|
||||
|
||||
### The task
|
||||
|
||||
Decompress a 2725x2225 JPEG image,
|
||||
resize to 720x588 using Lanczos 3 resampling (where available),
|
||||
then compress to JPEG at a "quality" setting of 80.
|
||||
|
||||
### Results
|
||||
|
||||
| Module | Input | Output | Ops/sec | Speed-up |
|
||||
| :----------------- | :----- | :----- | ------: | -------: |
|
||||
| jimp | buffer | buffer | 0.71 | 1.0 |
|
||||
| mapnik | buffer | buffer | 3.32 | 4.7 |
|
||||
| gm | buffer | buffer | 3.97 | 5.6 |
|
||||
| imagemagick-native | buffer | buffer | 4.06 | 5.7 |
|
||||
| imagemagick | file | file | 4.24 | 6.0 |
|
||||
| sharp | stream | stream | 25.30 | 35.6 |
|
||||
| sharp | file | file | 26.17 | 36.9 |
|
||||
| sharp | buffer | buffer | 26.45 | 37.3 |
|
||||
|
||||
Greater libvips performance can be expected with caching enabled (default)
|
||||
and using 8+ core machines, especially those with larger L1/L2 CPU caches.
|
||||
|
||||
The I/O limits of the relevant (de)compression library will generally determine maximum throughput.
|
||||
|
||||
### Benchmark test prerequisites
|
||||
|
||||
Requires _ImageMagick_, _GraphicsMagick_ and _Mapnik_:
|
||||
|
||||
```sh
|
||||
brew install imagemagick
|
||||
brew install graphicsmagick
|
||||
brew install mapnik
|
||||
```
|
||||
|
||||
```sh
|
||||
sudo apt-get install imagemagick libmagick++-dev graphicsmagick libmapnik-dev
|
||||
```
|
||||
|
||||
```sh
|
||||
sudo yum install ImageMagick-devel ImageMagick-c++-devel GraphicsMagick mapnik-devel
|
||||
```
|
||||
|
||||
### Running the benchmark test
|
||||
|
||||
```sh
|
||||
git clone https://github.com/lovell/sharp.git
|
||||
cd sharp
|
||||
npm install
|
||||
cd test/bench
|
||||
npm install
|
||||
npm test
|
||||
```
|
||||
Reference in New Issue
Block a user