mirror of
https://github.com/lovell/sharp.git
synced 2026-02-05 14:16:17 +01:00
Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
815d076b35 | ||
|
|
86b4816b3f | ||
|
|
473055468a | ||
|
|
c6a28db8b1 | ||
|
|
971f567571 | ||
|
|
7e2eca3d1e | ||
|
|
86b0053bf0 | ||
|
|
cfc4b282f0 | ||
|
|
b85d2aa565 | ||
|
|
70a3d4fb5e | ||
|
|
d9b667e346 | ||
|
|
3a1db53d5a |
@@ -74,7 +74,7 @@ covers reporting bugs, requesting features and submitting code changes.
|
|||||||
|
|
||||||
### Licence
|
### Licence
|
||||||
|
|
||||||
Copyright 2013, 2014, 2015, 2016 Lovell Fuller and contributors.
|
Copyright 2013, 2014, 2015, 2016, 2017 Lovell Fuller and contributors.
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -107,7 +107,7 @@
|
|||||||
['OS == "linux"', {
|
['OS == "linux"', {
|
||||||
'defines': [
|
'defines': [
|
||||||
# Inspect libvips-cpp.so to determine which C++11 ABI version was used and set _GLIBCXX_USE_CXX11_ABI accordingly. This is quite horrible.
|
# Inspect libvips-cpp.so to determine which C++11 ABI version was used and set _GLIBCXX_USE_CXX11_ABI accordingly. This is quite horrible.
|
||||||
'_GLIBCXX_USE_CXX11_ABI=<!(if readelf -Ws "$(PKG_CONFIG_PATH="<(pkg_config_path)" pkg-config --libs-only-L vips-cpp | cut -c 3- | sed -e "s/[[:space:]]*$//" | sed -e "s/^$/\/usr\/lib/")/libvips-cpp.so" | c++filt | grep -qF __cxx11;then echo "1";else echo "0";fi)'
|
'_GLIBCXX_USE_CXX11_ABI=<!(if readelf -Ws "$(PKG_CONFIG_PATH="<(pkg_config_path)" pkg-config --variable libdir vips-cpp)/libvips-cpp.so" | c++filt | grep -qF __cxx11;then echo "1";else echo "0";fi)'
|
||||||
]
|
]
|
||||||
}]
|
}]
|
||||||
]
|
]
|
||||||
|
|||||||
10
binding.js
10
binding.js
@@ -98,11 +98,11 @@ module.exports.download_vips = function () {
|
|||||||
} catch (err) {}
|
} catch (err) {}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
const gotOpt = {};
|
const gotOpt = {
|
||||||
if (process.env.npm_config_https_proxy) {
|
agent: caw(null, {
|
||||||
// Use the NPM-configured HTTPS proxy
|
protocol: 'https'
|
||||||
gotOpt.agent = caw(process.env.npm_config_https_proxy);
|
})
|
||||||
}
|
};
|
||||||
const url = distBaseUrl + tarFilename;
|
const url = distBaseUrl + tarFilename;
|
||||||
got.stream(url, gotOpt).on('response', function (response) {
|
got.stream(url, gotOpt).on('response', function (response) {
|
||||||
if (response.statusCode !== 200) {
|
if (response.statusCode !== 200) {
|
||||||
|
|||||||
@@ -1,6 +1,12 @@
|
|||||||
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
||||||
|
|
||||||
# extractChannel
|
### Table of Contents
|
||||||
|
|
||||||
|
- [extractChannel](#extractchannel)
|
||||||
|
- [joinChannel](#joinchannel)
|
||||||
|
- [bandbool](#bandbool)
|
||||||
|
|
||||||
|
## extractChannel
|
||||||
|
|
||||||
Extract a single channel from a multi-channel image.
|
Extract a single channel from a multi-channel image.
|
||||||
|
|
||||||
@@ -23,7 +29,7 @@ sharp(input)
|
|||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp**
|
||||||
|
|
||||||
# joinChannel
|
## joinChannel
|
||||||
|
|
||||||
Join one or more channels to the image.
|
Join one or more channels to the image.
|
||||||
The meaning of the added channels depends on the output colourspace, set with `toColourspace()`.
|
The meaning of the added channels depends on the output colourspace, set with `toColourspace()`.
|
||||||
@@ -46,7 +52,7 @@ For raw pixel input, the `options` object should contain a `raw` attribute, whic
|
|||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp**
|
||||||
|
|
||||||
# bandbool
|
## bandbool
|
||||||
|
|
||||||
Perform a bitwise boolean operation on all input image channels (bands) to produce a single channel output image.
|
Perform a bitwise boolean operation on all input image channels (bands) to produce a single channel output image.
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,14 @@
|
|||||||
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
||||||
|
|
||||||
# background
|
### Table of Contents
|
||||||
|
|
||||||
|
- [background](#background)
|
||||||
|
- [greyscale](#greyscale)
|
||||||
|
- [grayscale](#grayscale)
|
||||||
|
- [toColourspace](#tocolourspace)
|
||||||
|
- [toColorspace](#tocolorspace)
|
||||||
|
|
||||||
|
## background
|
||||||
|
|
||||||
Set the background for the `embed`, `flatten` and `extend` operations.
|
Set the background for the `embed`, `flatten` and `extend` operations.
|
||||||
The default background is `{r: 0, g: 0, b: 0, alpha: 1}`, black without transparency.
|
The default background is `{r: 0, g: 0, b: 0, alpha: 1}`, black without transparency.
|
||||||
@@ -18,7 +26,7 @@ The alpha value is a float between `0` (transparent) and `1` (opaque).
|
|||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp**
|
||||||
|
|
||||||
# greyscale
|
## greyscale
|
||||||
|
|
||||||
Convert to 8-bit greyscale; 256 shades of grey.
|
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.
|
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.
|
||||||
@@ -33,7 +41,7 @@ An alpha channel may be present, and will be unchanged by the operation.
|
|||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp**
|
||||||
|
|
||||||
# grayscale
|
## grayscale
|
||||||
|
|
||||||
Alternative spelling of `greyscale`.
|
Alternative spelling of `greyscale`.
|
||||||
|
|
||||||
@@ -43,7 +51,7 @@ Alternative spelling of `greyscale`.
|
|||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp**
|
||||||
|
|
||||||
# toColourspace
|
## toColourspace
|
||||||
|
|
||||||
Set the output colourspace.
|
Set the output colourspace.
|
||||||
By default output image will be web-friendly sRGB, with additional channels interpreted as alpha channels.
|
By default output image will be web-friendly sRGB, with additional channels interpreted as alpha channels.
|
||||||
@@ -57,7 +65,7 @@ By default output image will be web-friendly sRGB, with additional channels inte
|
|||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp**
|
||||||
|
|
||||||
# toColorspace
|
## toColorspace
|
||||||
|
|
||||||
Alternative spelling of `toColourspace`.
|
Alternative spelling of `toColourspace`.
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
||||||
|
|
||||||
# overlayWith
|
### Table of Contents
|
||||||
|
|
||||||
|
- [overlayWith](#overlaywith)
|
||||||
|
|
||||||
|
## overlayWith
|
||||||
|
|
||||||
Overlay (composite) an image over the processed (resized, extracted etc.) image.
|
Overlay (composite) an image over the processed (resized, extracted etc.) image.
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,13 @@
|
|||||||
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
||||||
|
|
||||||
# Sharp
|
### Table of Contents
|
||||||
|
|
||||||
|
- [Sharp](#sharp)
|
||||||
|
- [format](#format)
|
||||||
|
- [versions](#versions)
|
||||||
|
- [queue](#queue)
|
||||||
|
|
||||||
|
## Sharp
|
||||||
|
|
||||||
**Parameters**
|
**Parameters**
|
||||||
|
|
||||||
@@ -43,7 +50,7 @@ readableStream.pipe(transformer).pipe(writableStream);
|
|||||||
|
|
||||||
Returns **[Sharp](#sharp)**
|
Returns **[Sharp](#sharp)**
|
||||||
|
|
||||||
## format
|
### format
|
||||||
|
|
||||||
An Object containing nested boolean values representing the available input and output formats/methods.
|
An Object containing nested boolean values representing the available input and output formats/methods.
|
||||||
|
|
||||||
@@ -55,7 +62,7 @@ console.log(sharp.format());
|
|||||||
|
|
||||||
Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
|
Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
|
||||||
|
|
||||||
## versions
|
### versions
|
||||||
|
|
||||||
An Object containing the version numbers of libvips and its dependencies.
|
An Object containing the version numbers of libvips and its dependencies.
|
||||||
|
|
||||||
@@ -65,7 +72,7 @@ An Object containing the version numbers of libvips and its dependencies.
|
|||||||
console.log(sharp.versions);
|
console.log(sharp.versions);
|
||||||
```
|
```
|
||||||
|
|
||||||
# queue
|
## queue
|
||||||
|
|
||||||
An EventEmitter that emits a `change` event when a task is either:
|
An EventEmitter that emits a `change` event when a task is either:
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,13 @@
|
|||||||
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
||||||
|
|
||||||
# clone
|
### Table of Contents
|
||||||
|
|
||||||
|
- [clone](#clone)
|
||||||
|
- [metadata](#metadata)
|
||||||
|
- [limitInputPixels](#limitinputpixels)
|
||||||
|
- [sequentialRead](#sequentialread)
|
||||||
|
|
||||||
|
## clone
|
||||||
|
|
||||||
Take a "snapshot" of the Sharp instance, returning a new instance.
|
Take a "snapshot" of the Sharp instance, returning a new instance.
|
||||||
Cloned instances inherit the input of their parent instance.
|
Cloned instances inherit the input of their parent instance.
|
||||||
@@ -19,7 +26,7 @@ readableStream.pipe(pipeline);
|
|||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp**
|
||||||
|
|
||||||
# metadata
|
## metadata
|
||||||
|
|
||||||
Fast access to image metadata without decoding any compressed image data.
|
Fast access to image metadata without decoding any compressed image data.
|
||||||
A Promises/A+ promise is returned when `callback` is not provided.
|
A Promises/A+ promise is returned when `callback` is not provided.
|
||||||
@@ -59,7 +66,7 @@ image
|
|||||||
|
|
||||||
Returns **([Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)> | Sharp)**
|
Returns **([Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)> | Sharp)**
|
||||||
|
|
||||||
# limitInputPixels
|
## limitInputPixels
|
||||||
|
|
||||||
Do not process input images where the number of pixels (width _ height) exceeds this limit.
|
Do not process input images where the number of pixels (width _ height) exceeds this limit.
|
||||||
Assumes image dimensions contained in the input metadata can be trusted.
|
Assumes image dimensions contained in the input metadata can be trusted.
|
||||||
@@ -74,7 +81,7 @@ The default limit is 268402689 (0x3FFF _ 0x3FFF) pixels.
|
|||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp**
|
||||||
|
|
||||||
# sequentialRead
|
## sequentialRead
|
||||||
|
|
||||||
An advanced setting that switches the libvips access method to `VIPS_ACCESS_SEQUENTIAL`.
|
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.
|
This will reduce memory usage and can improve performance on some systems.
|
||||||
|
|||||||
@@ -1,6 +1,25 @@
|
|||||||
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
||||||
|
|
||||||
# rotate
|
### Table of Contents
|
||||||
|
|
||||||
|
- [rotate](#rotate)
|
||||||
|
- [extract](#extract)
|
||||||
|
- [flip](#flip)
|
||||||
|
- [flop](#flop)
|
||||||
|
- [sharpen](#sharpen)
|
||||||
|
- [blur](#blur)
|
||||||
|
- [extend](#extend)
|
||||||
|
- [flatten](#flatten)
|
||||||
|
- [trim](#trim)
|
||||||
|
- [gamma](#gamma)
|
||||||
|
- [negate](#negate)
|
||||||
|
- [normalise](#normalise)
|
||||||
|
- [normalize](#normalize)
|
||||||
|
- [convolve](#convolve)
|
||||||
|
- [threshold](#threshold)
|
||||||
|
- [boolean](#boolean)
|
||||||
|
|
||||||
|
## rotate
|
||||||
|
|
||||||
Rotate the output image by either an explicit angle
|
Rotate the output image by either an explicit angle
|
||||||
or auto-orient based on the EXIF `Orientation` tag.
|
or auto-orient based on the EXIF `Orientation` tag.
|
||||||
@@ -35,7 +54,7 @@ readableStream.pipe(pipeline);
|
|||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp**
|
||||||
|
|
||||||
# extract
|
## extract
|
||||||
|
|
||||||
Extract a region of the image.
|
Extract a region of the image.
|
||||||
|
|
||||||
@@ -75,7 +94,7 @@ sharp(input)
|
|||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp**
|
||||||
|
|
||||||
# flip
|
## flip
|
||||||
|
|
||||||
Flip the image about the vertical Y axis. This always occurs after rotation, if any.
|
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.
|
The use of `flip` implies the removal of the EXIF `Orientation` tag, if any.
|
||||||
@@ -86,7 +105,7 @@ The use of `flip` implies the removal of the EXIF `Orientation` tag, if any.
|
|||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp**
|
||||||
|
|
||||||
# flop
|
## flop
|
||||||
|
|
||||||
Flop the image about the horizontal X axis. This always occurs after rotation, if any.
|
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.
|
The use of `flop` implies the removal of the EXIF `Orientation` tag, if any.
|
||||||
@@ -97,7 +116,7 @@ The use of `flop` implies the removal of the EXIF `Orientation` tag, if any.
|
|||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp**
|
||||||
|
|
||||||
# sharpen
|
## sharpen
|
||||||
|
|
||||||
Sharpen the image.
|
Sharpen the image.
|
||||||
When used without parameters, performs a fast, mild sharpen of the output image.
|
When used without parameters, performs a fast, mild sharpen of the output image.
|
||||||
@@ -115,7 +134,7 @@ Separate control over the level of sharpening in "flat" and "jagged" areas is av
|
|||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp**
|
||||||
|
|
||||||
# blur
|
## blur
|
||||||
|
|
||||||
Blur the image.
|
Blur the image.
|
||||||
When used without parameters, performs a fast, mild blur of the output image.
|
When used without parameters, performs a fast, mild blur of the output image.
|
||||||
@@ -130,7 +149,7 @@ When a `sigma` is provided, performs a slower, more accurate Gaussian blur.
|
|||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp**
|
||||||
|
|
||||||
# extend
|
## extend
|
||||||
|
|
||||||
Extends/pads the edges of the image with the colour provided to the `background` method.
|
Extends/pads the edges of the image with the colour provided to the `background` method.
|
||||||
This operation will always occur after resizing and extraction, if any.
|
This operation will always occur after resizing and extraction, if any.
|
||||||
@@ -150,7 +169,7 @@ This operation will always occur after resizing and extraction, if any.
|
|||||||
// to the top, left and right edges and 20 to the bottom edge
|
// to the top, left and right edges and 20 to the bottom edge
|
||||||
sharp(input)
|
sharp(input)
|
||||||
.resize(140)
|
.resize(140)
|
||||||
.background({r: 0, g: 0, b: 0, a: 0})
|
.background({r: 0, g: 0, b: 0, alpha: 0})
|
||||||
.extend({top: 10, bottom: 20, left: 10, right: 10})
|
.extend({top: 10, bottom: 20, left: 10, right: 10})
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
@@ -159,7 +178,7 @@ sharp(input)
|
|||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp**
|
||||||
|
|
||||||
# flatten
|
## flatten
|
||||||
|
|
||||||
Merge alpha transparency channel, if any, with `background`.
|
Merge alpha transparency channel, if any, with `background`.
|
||||||
|
|
||||||
@@ -169,7 +188,7 @@ Merge alpha transparency channel, if any, with `background`.
|
|||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp**
|
||||||
|
|
||||||
# trim
|
## trim
|
||||||
|
|
||||||
Trim "boring" pixels from all edges that contain values within a percentage similarity of the top-left pixel.
|
Trim "boring" pixels from all edges that contain values within a percentage similarity of the top-left pixel.
|
||||||
|
|
||||||
@@ -182,7 +201,7 @@ Trim "boring" pixels from all edges that contain values within a percentage simi
|
|||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp**
|
||||||
|
|
||||||
# gamma
|
## gamma
|
||||||
|
|
||||||
Apply a gamma correction by reducing the encoding (darken) pre-resize at a factor of `1/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`.
|
then increasing the encoding (brighten) post-resize at a factor of `gamma`.
|
||||||
@@ -199,7 +218,7 @@ when applying a gamma correction.
|
|||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp**
|
||||||
|
|
||||||
# negate
|
## negate
|
||||||
|
|
||||||
Produce the "negative" of the image.
|
Produce the "negative" of the image.
|
||||||
|
|
||||||
@@ -209,7 +228,7 @@ Produce the "negative" of the image.
|
|||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp**
|
||||||
|
|
||||||
# normalise
|
## normalise
|
||||||
|
|
||||||
Enhance output image contrast by stretching its luminance to cover the full dynamic range.
|
Enhance output image contrast by stretching its luminance to cover the full dynamic range.
|
||||||
|
|
||||||
@@ -219,7 +238,7 @@ Enhance output image contrast by stretching its luminance to cover the full dyna
|
|||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp**
|
||||||
|
|
||||||
# normalize
|
## normalize
|
||||||
|
|
||||||
Alternative spelling of normalise.
|
Alternative spelling of normalise.
|
||||||
|
|
||||||
@@ -229,7 +248,7 @@ Alternative spelling of normalise.
|
|||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp**
|
||||||
|
|
||||||
# convolve
|
## convolve
|
||||||
|
|
||||||
Convolve the image with the specified kernel.
|
Convolve the image with the specified kernel.
|
||||||
|
|
||||||
@@ -262,7 +281,7 @@ sharp(input)
|
|||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp**
|
||||||
|
|
||||||
# threshold
|
## threshold
|
||||||
|
|
||||||
Any pixel value greather than or equal to the threshold value will be set to 255, otherwise it will be set to 0.
|
Any pixel value greather than or equal to the threshold value will be set to 255, otherwise it will be set to 0.
|
||||||
|
|
||||||
@@ -278,7 +297,7 @@ Any pixel value greather than or equal to the threshold value will be set to 255
|
|||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp**
|
||||||
|
|
||||||
# boolean
|
## boolean
|
||||||
|
|
||||||
Perform a bitwise boolean operation with operand image.
|
Perform a bitwise boolean operation with operand image.
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,19 @@
|
|||||||
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
||||||
|
|
||||||
# toFile
|
### Table of Contents
|
||||||
|
|
||||||
|
- [toFile](#tofile)
|
||||||
|
- [toBuffer](#tobuffer)
|
||||||
|
- [withMetadata](#withmetadata)
|
||||||
|
- [jpeg](#jpeg)
|
||||||
|
- [png](#png)
|
||||||
|
- [webp](#webp)
|
||||||
|
- [tiff](#tiff)
|
||||||
|
- [raw](#raw)
|
||||||
|
- [toFormat](#toformat)
|
||||||
|
- [tile](#tile)
|
||||||
|
|
||||||
|
## toFile
|
||||||
|
|
||||||
Write output image data to a file.
|
Write output image data to a file.
|
||||||
|
|
||||||
@@ -21,7 +34,7 @@ A Promises/A+ promise is returned when `callback` is not provided.
|
|||||||
|
|
||||||
Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)>** when no callback is provided
|
Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)>** when no callback is provided
|
||||||
|
|
||||||
# toBuffer
|
## toBuffer
|
||||||
|
|
||||||
Write output to a Buffer.
|
Write output to a Buffer.
|
||||||
JPEG, PNG, WebP, and RAW output are supported.
|
JPEG, PNG, WebP, and RAW output are supported.
|
||||||
@@ -40,7 +53,7 @@ By default, the format will match the input image, except GIF and SVG input whic
|
|||||||
|
|
||||||
Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[Buffer](https://nodejs.org/api/buffer.html)>** when no callback is provided
|
Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[Buffer](https://nodejs.org/api/buffer.html)>** when no callback is provided
|
||||||
|
|
||||||
# withMetadata
|
## withMetadata
|
||||||
|
|
||||||
Include all metadata (EXIF, XMP, IPTC) from the input image in the output image.
|
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.
|
The default behaviour, when `withMetadata` is not used, is to strip all metadata and convert to the device-independent sRGB colour space.
|
||||||
@@ -56,7 +69,7 @@ This will also convert to and add a web-friendly sRGB ICC profile.
|
|||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp**
|
||||||
|
|
||||||
# jpeg
|
## jpeg
|
||||||
|
|
||||||
Use these JPEG options for output image.
|
Use these JPEG options for output image.
|
||||||
|
|
||||||
@@ -77,7 +90,7 @@ Use these JPEG options for output image.
|
|||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp**
|
||||||
|
|
||||||
# png
|
## png
|
||||||
|
|
||||||
Use these PNG options for output image.
|
Use these PNG options for output image.
|
||||||
|
|
||||||
@@ -94,7 +107,7 @@ Use these PNG options for output image.
|
|||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp**
|
||||||
|
|
||||||
# webp
|
## webp
|
||||||
|
|
||||||
Use these WebP options for output image.
|
Use these WebP options for output image.
|
||||||
|
|
||||||
@@ -109,7 +122,7 @@ Use these WebP options for output image.
|
|||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp**
|
||||||
|
|
||||||
# tiff
|
## tiff
|
||||||
|
|
||||||
Use these TIFF options for output image.
|
Use these TIFF options for output image.
|
||||||
|
|
||||||
@@ -124,13 +137,13 @@ Use these TIFF options for output image.
|
|||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp**
|
||||||
|
|
||||||
# raw
|
## raw
|
||||||
|
|
||||||
Force output to be raw, uncompressed uint8 pixel data.
|
Force output to be raw, uncompressed uint8 pixel data.
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp**
|
||||||
|
|
||||||
# toFormat
|
## toFormat
|
||||||
|
|
||||||
Force output to a given format.
|
Force output to a given format.
|
||||||
|
|
||||||
@@ -144,7 +157,7 @@ Force output to a given format.
|
|||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp**
|
||||||
|
|
||||||
# tile
|
## tile
|
||||||
|
|
||||||
Use tile-based deep zoom (image pyramid) output.
|
Use tile-based deep zoom (image pyramid) output.
|
||||||
Set the format and options for tile images via the `toFormat`, `jpeg`, `png` or `webp` functions.
|
Set the format and options for tile images via the `toFormat`, `jpeg`, `png` or `webp` functions.
|
||||||
|
|||||||
@@ -1,6 +1,16 @@
|
|||||||
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
||||||
|
|
||||||
# resize
|
### Table of Contents
|
||||||
|
|
||||||
|
- [resize](#resize)
|
||||||
|
- [crop](#crop)
|
||||||
|
- [embed](#embed)
|
||||||
|
- [max](#max)
|
||||||
|
- [min](#min)
|
||||||
|
- [ignoreAspectRatio](#ignoreaspectratio)
|
||||||
|
- [withoutEnlargement](#withoutenlargement)
|
||||||
|
|
||||||
|
## resize
|
||||||
|
|
||||||
Resize image to `width` x `height`.
|
Resize image to `width` x `height`.
|
||||||
By default, the resized image is centre cropped to the exact size specified.
|
By default, the resized image is centre cropped to the exact size specified.
|
||||||
@@ -52,7 +62,7 @@ sharp(inputBuffer)
|
|||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp**
|
||||||
|
|
||||||
# crop
|
## crop
|
||||||
|
|
||||||
Crop the resized image to the exact size specified, the default behaviour.
|
Crop the resized image to the exact size specified, the default behaviour.
|
||||||
|
|
||||||
@@ -87,7 +97,7 @@ readableStream.pipe(transformer).pipe(writableStream);
|
|||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp**
|
||||||
|
|
||||||
# embed
|
## embed
|
||||||
|
|
||||||
Preserving aspect ratio, resize the image to the maximum `width` or `height` specified
|
Preserving aspect ratio, resize the image to the maximum `width` or `height` specified
|
||||||
then embed on a background of the exact `width` and `height` specified.
|
then embed on a background of the exact `width` and `height` specified.
|
||||||
@@ -100,7 +110,7 @@ contain an alpha channel, even when the input image does not.
|
|||||||
```javascript
|
```javascript
|
||||||
sharp('input.gif')
|
sharp('input.gif')
|
||||||
.resize(200, 300)
|
.resize(200, 300)
|
||||||
.background({r: 0, g: 0, b: 0, a: 0})
|
.background({r: 0, g: 0, b: 0, alpha: 0})
|
||||||
.embed()
|
.embed()
|
||||||
.toFormat(sharp.format.webp)
|
.toFormat(sharp.format.webp)
|
||||||
.toBuffer(function(err, outputBuffer) {
|
.toBuffer(function(err, outputBuffer) {
|
||||||
@@ -114,7 +124,7 @@ sharp('input.gif')
|
|||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp**
|
||||||
|
|
||||||
# max
|
## max
|
||||||
|
|
||||||
Preserving aspect ratio, resize the image to be as large as possible
|
Preserving aspect ratio, resize the image to be as large as possible
|
||||||
while ensuring its dimensions are less than or equal to the `width` and `height` specified.
|
while ensuring its dimensions are less than or equal to the `width` and `height` specified.
|
||||||
@@ -137,7 +147,7 @@ sharp(inputBuffer)
|
|||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp**
|
||||||
|
|
||||||
# min
|
## min
|
||||||
|
|
||||||
Preserving aspect ratio, resize the image to be as small as possible
|
Preserving aspect ratio, resize the image to be as small as possible
|
||||||
while ensuring its dimensions are greater than or equal to the `width` and `height` specified.
|
while ensuring its dimensions are greater than or equal to the `width` and `height` specified.
|
||||||
@@ -146,14 +156,14 @@ Both `width` and `height` must be provided via `resize` otherwise the behaviour
|
|||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp**
|
||||||
|
|
||||||
# ignoreAspectRatio
|
## ignoreAspectRatio
|
||||||
|
|
||||||
Ignoring the aspect ratio of the input, stretch the image to
|
Ignoring the aspect ratio of the input, stretch the image to
|
||||||
the exact `width` and/or `height` provided via `resize`.
|
the exact `width` and/or `height` provided via `resize`.
|
||||||
|
|
||||||
Returns **Sharp**
|
Returns **Sharp**
|
||||||
|
|
||||||
# withoutEnlargement
|
## withoutEnlargement
|
||||||
|
|
||||||
Do not enlarge the output image if the input image width _or_ height are already less than the required dimensions.
|
Do not enlarge the output image if the input image width _or_ height are already less than the required dimensions.
|
||||||
This is equivalent to GraphicsMagick's `>` geometry option:
|
This is equivalent to GraphicsMagick's `>` geometry option:
|
||||||
|
|||||||
@@ -1,6 +1,13 @@
|
|||||||
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
||||||
|
|
||||||
# cache
|
### Table of Contents
|
||||||
|
|
||||||
|
- [cache](#cache)
|
||||||
|
- [concurrency](#concurrency)
|
||||||
|
- [counters](#counters)
|
||||||
|
- [simd](#simd)
|
||||||
|
|
||||||
|
## cache
|
||||||
|
|
||||||
Gets, or when options are provided sets, the limits of _libvips'_ operation 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.
|
Existing entries in the cache will be trimmed after any change in limits.
|
||||||
@@ -28,7 +35,7 @@ sharp.cache(false);
|
|||||||
|
|
||||||
Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
|
Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
|
||||||
|
|
||||||
# concurrency
|
## concurrency
|
||||||
|
|
||||||
Gets, or when a concurrency is provided sets,
|
Gets, or when a concurrency is provided sets,
|
||||||
the number of threads _libvips'_ should create to process each image.
|
the number of threads _libvips'_ should create to process each image.
|
||||||
@@ -54,7 +61,7 @@ sharp.concurrency(0); // 4
|
|||||||
|
|
||||||
Returns **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** concurrency
|
Returns **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** concurrency
|
||||||
|
|
||||||
# counters
|
## counters
|
||||||
|
|
||||||
Provides access to internal task counters.
|
Provides access to internal task counters.
|
||||||
|
|
||||||
@@ -69,7 +76,7 @@ const counters = sharp.counters(); // { queue: 2, process: 4 }
|
|||||||
|
|
||||||
Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
|
Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**
|
||||||
|
|
||||||
# simd
|
## simd
|
||||||
|
|
||||||
Get and set use of SIMD vector unit instructions.
|
Get and set use of SIMD vector unit instructions.
|
||||||
Requires libvips to have been compiled with liborc support.
|
Requires libvips to have been compiled with liborc support.
|
||||||
|
|||||||
@@ -4,6 +4,19 @@
|
|||||||
|
|
||||||
Requires libvips v8.4.2.
|
Requires libvips v8.4.2.
|
||||||
|
|
||||||
|
#### 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
|
#### v0.17.0 - 11<sup>th</sup> December 2016
|
||||||
|
|
||||||
* Drop support for versions of Node prior to v4.
|
* Drop support for versions of Node prior to v4.
|
||||||
|
|||||||
@@ -94,12 +94,15 @@ the help and code contributions of the following people:
|
|||||||
* [Kleis Auke Wolthuizen](https://github.com/kleisauke)
|
* [Kleis Auke Wolthuizen](https://github.com/kleisauke)
|
||||||
* [Matt Hirsch](https://github.com/mhirsch)
|
* [Matt Hirsch](https://github.com/mhirsch)
|
||||||
* [Rahul Nanwani](https://github.com/rnanwani)
|
* [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)
|
||||||
|
|
||||||
Thank you!
|
Thank you!
|
||||||
|
|
||||||
### Licence
|
### Licence
|
||||||
|
|
||||||
Copyright 2013, 2014, 2015, 2016 Lovell Fuller and contributors.
|
Copyright 2013, 2014, 2015, 2016, 2017 Lovell Fuller and contributors.
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
|||||||
18
lib/is.js
18
lib/is.js
@@ -80,6 +80,21 @@ const inArray = function (val, list) {
|
|||||||
return list.indexOf(val) !== -1;
|
return list.indexOf(val) !== -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an Error with a message relating to an invalid parameter.
|
||||||
|
*
|
||||||
|
* @param {String} name - parameter name.
|
||||||
|
* @param {String} expected - description of the type/value/range expected.
|
||||||
|
* @param {*} actual - the value received.
|
||||||
|
* @returns {Error} Containing the formatted message.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
const invalidParameterError = function (name, expected, actual) {
|
||||||
|
return new Error(
|
||||||
|
`Expected ${expected} for ${name} but received ${actual} of type ${typeof actual}`
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
defined: defined,
|
defined: defined,
|
||||||
object: object,
|
object: object,
|
||||||
@@ -90,5 +105,6 @@ module.exports = {
|
|||||||
number: number,
|
number: number,
|
||||||
integer: integer,
|
integer: integer,
|
||||||
inRange: inRange,
|
inRange: inRange,
|
||||||
inArray: inArray
|
inArray: inArray,
|
||||||
|
invalidParameterError: invalidParameterError
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ const blur = function blur (sigma) {
|
|||||||
* // to the top, left and right edges and 20 to the bottom edge
|
* // to the top, left and right edges and 20 to the bottom edge
|
||||||
* sharp(input)
|
* sharp(input)
|
||||||
* .resize(140)
|
* .resize(140)
|
||||||
* .background({r: 0, g: 0, b: 0, a: 0})
|
* .background({r: 0, g: 0, b: 0, alpha: 0})
|
||||||
* .extend({top: 10, bottom: 20, left: 10, right: 10})
|
* .extend({top: 10, bottom: 20, left: 10, right: 10})
|
||||||
* ...
|
* ...
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ const resize = function resize (width, height, options) {
|
|||||||
if (is.integer(width) && is.inRange(width, 1, this.constructor.maximum.width)) {
|
if (is.integer(width) && is.inRange(width, 1, this.constructor.maximum.width)) {
|
||||||
this.options.width = width;
|
this.options.width = width;
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Invalid width (1 to ' + this.constructor.maximum.width + ') ' + width);
|
throw is.invalidParameterError('width', `integer between 1 and ${this.constructor.maximum.width}`, width);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.options.width = -1;
|
this.options.width = -1;
|
||||||
@@ -113,7 +113,7 @@ const resize = function resize (width, height, options) {
|
|||||||
if (is.integer(height) && is.inRange(height, 1, this.constructor.maximum.height)) {
|
if (is.integer(height) && is.inRange(height, 1, this.constructor.maximum.height)) {
|
||||||
this.options.height = height;
|
this.options.height = height;
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Invalid height (1 to ' + this.constructor.maximum.height + ') ' + height);
|
throw is.invalidParameterError('height', `integer between 1 and ${this.constructor.maximum.height}`, height);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.options.height = -1;
|
this.options.height = -1;
|
||||||
@@ -124,7 +124,7 @@ const resize = function resize (width, height, options) {
|
|||||||
if (is.string(kernel[options.kernel])) {
|
if (is.string(kernel[options.kernel])) {
|
||||||
this.options.kernel = kernel[options.kernel];
|
this.options.kernel = kernel[options.kernel];
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Invalid kernel ' + options.kernel);
|
throw is.invalidParameterError('kernel', 'valid kernel name', options.kernel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Interpolator
|
// Interpolator
|
||||||
@@ -132,7 +132,7 @@ const resize = function resize (width, height, options) {
|
|||||||
if (is.string(interpolator[options.interpolator])) {
|
if (is.string(interpolator[options.interpolator])) {
|
||||||
this.options.interpolator = interpolator[options.interpolator];
|
this.options.interpolator = interpolator[options.interpolator];
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Invalid interpolator ' + options.interpolator);
|
throw is.invalidParameterError('interpolator', 'valid interpolator name', options.interpolator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Centre sampling
|
// Centre sampling
|
||||||
@@ -185,7 +185,7 @@ const crop = function crop (crop) {
|
|||||||
// Strategy
|
// Strategy
|
||||||
this.options.crop = crop;
|
this.options.crop = crop;
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Unsupported crop ' + crop);
|
throw is.invalidParameterError('crop', 'valid crop id/name/strategy', crop);
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
@@ -200,7 +200,7 @@ const crop = function crop (crop) {
|
|||||||
* @example
|
* @example
|
||||||
* sharp('input.gif')
|
* sharp('input.gif')
|
||||||
* .resize(200, 300)
|
* .resize(200, 300)
|
||||||
* .background({r: 0, g: 0, b: 0, a: 0})
|
* .background({r: 0, g: 0, b: 0, alpha: 0})
|
||||||
* .embed()
|
* .embed()
|
||||||
* .toFormat(sharp.format.webp)
|
* .toFormat(sharp.format.webp)
|
||||||
* .toBuffer(function(err, outputBuffer) {
|
* .toBuffer(function(err, outputBuffer) {
|
||||||
|
|||||||
19
package.json
19
package.json
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "sharp",
|
"name": "sharp",
|
||||||
"description": "High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP and TIFF images",
|
"description": "High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP and TIFF images",
|
||||||
"version": "0.17.0",
|
"version": "0.17.1",
|
||||||
"author": "Lovell Fuller <npm@lovell.info>",
|
"author": "Lovell Fuller <npm@lovell.info>",
|
||||||
"contributors": [
|
"contributors": [
|
||||||
"Pierre Inglebert <pierre.inglebert@gmail.com>",
|
"Pierre Inglebert <pierre.inglebert@gmail.com>",
|
||||||
@@ -29,7 +29,8 @@
|
|||||||
"Kleis Auke Wolthuizen <info@kleisauke.nl>",
|
"Kleis Auke Wolthuizen <info@kleisauke.nl>",
|
||||||
"Matt Hirsch <mhirsch@media.mit.edu>",
|
"Matt Hirsch <mhirsch@media.mit.edu>",
|
||||||
"Matthias Thoemmes <thoemmes@gmail.com>",
|
"Matthias Thoemmes <thoemmes@gmail.com>",
|
||||||
"Patrick Paskaris <patrick@paskaris.gr>"
|
"Patrick Paskaris <patrick@paskaris.gr>",
|
||||||
|
"Jérémy Lal <kapouer@melix.org>"
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"clean": "rm -rf node_modules/ build/ vendor/ coverage/ test/fixtures/output.*",
|
"clean": "rm -rf node_modules/ build/ vendor/ coverage/ test/fixtures/output.*",
|
||||||
@@ -60,19 +61,19 @@
|
|||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"caw": "^2.0.0",
|
"caw": "^2.0.0",
|
||||||
"color": "^1.0.2",
|
"color": "^1.0.3",
|
||||||
"got": "^6.6.3",
|
"got": "^6.7.1",
|
||||||
"nan": "^2.4.0",
|
"nan": "^2.5.0",
|
||||||
"semver": "^5.3.0",
|
"semver": "^5.3.0",
|
||||||
"tar": "^2.2.1"
|
"tar": "^2.2.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"async": "^2.1.4",
|
"async": "^2.1.4",
|
||||||
"bufferutil": "^1.3.0",
|
"bufferutil": "^1.3.0",
|
||||||
"cross-env": "^3.1.3",
|
"cross-env": "^3.1.4",
|
||||||
"documentation": "^4.0.0-beta16",
|
"documentation": "^4.0.0-beta.18",
|
||||||
"exif-reader": "^1.0.1",
|
"exif-reader": "^1.0.2",
|
||||||
"icc": "^0.0.2",
|
"icc": "^1.0.0",
|
||||||
"mocha": "^3.2.0",
|
"mocha": "^3.2.0",
|
||||||
"node-cpplint": "^0.4.0",
|
"node-cpplint": "^0.4.0",
|
||||||
"nyc": "^10.0.0",
|
"nyc": "^10.0.0",
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ export CFLAGS="${FLAGS}"
|
|||||||
export CXXFLAGS="${FLAGS}"
|
export CXXFLAGS="${FLAGS}"
|
||||||
|
|
||||||
# Dependency version numbers
|
# Dependency version numbers
|
||||||
VERSION_ZLIB=1.2.8
|
VERSION_ZLIB=1.2.10
|
||||||
VERSION_FFI=3.2.1
|
VERSION_FFI=3.2.1
|
||||||
VERSION_GLIB=2.50.1
|
VERSION_GLIB=2.50.1
|
||||||
VERSION_XML2=2.9.4
|
VERSION_XML2=2.9.4
|
||||||
@@ -24,7 +24,7 @@ VERSION_GSF=1.14.40
|
|||||||
VERSION_EXIF=0.6.21
|
VERSION_EXIF=0.6.21
|
||||||
VERSION_LCMS2=2.8
|
VERSION_LCMS2=2.8
|
||||||
VERSION_JPEG=1.5.1
|
VERSION_JPEG=1.5.1
|
||||||
VERSION_PNG16=1.6.25
|
VERSION_PNG16=1.6.28
|
||||||
VERSION_WEBP=0.5.1
|
VERSION_WEBP=0.5.1
|
||||||
VERSION_TIFF=4.0.6
|
VERSION_TIFF=4.0.6
|
||||||
VERSION_ORC=0.4.26
|
VERSION_ORC=0.4.26
|
||||||
|
|||||||
316
preinstall.sh
316
preinstall.sh
@@ -1,316 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# Use of this script is deprecated
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo "WARNING: THIS SCRIPT WILL STOP WORKING AT THE END OF 2016"
|
|
||||||
echo
|
|
||||||
echo "WARNING: THIS SCRIPT IS NO LONGER REQUIRED ON MOST 64-BIT LINUX SYSTEMS WHEN USING SHARP V0.12.0+"
|
|
||||||
echo
|
|
||||||
echo "See http://sharp.dimens.io/page/install#linux"
|
|
||||||
echo
|
|
||||||
echo "If you really, really need this script, it will attempt"
|
|
||||||
echo "to globally install libvips if not already available."
|
|
||||||
echo
|
|
||||||
sleep 5
|
|
||||||
|
|
||||||
vips_version_minimum=8.4.2
|
|
||||||
vips_version_latest_major_minor=8.4
|
|
||||||
vips_version_latest_patch=2
|
|
||||||
|
|
||||||
openslide_version_minimum=3.4.0
|
|
||||||
openslide_version_latest_major_minor=3.4
|
|
||||||
openslide_version_latest_patch=1
|
|
||||||
|
|
||||||
install_libvips_from_source() {
|
|
||||||
echo "Compiling libvips $vips_version_latest_major_minor.$vips_version_latest_patch from source"
|
|
||||||
curl -O http://www.vips.ecs.soton.ac.uk/supported/$vips_version_latest_major_minor/vips-$vips_version_latest_major_minor.$vips_version_latest_patch.tar.gz
|
|
||||||
tar zvxf vips-$vips_version_latest_major_minor.$vips_version_latest_patch.tar.gz
|
|
||||||
cd vips-$vips_version_latest_major_minor.$vips_version_latest_patch
|
|
||||||
CXXFLAGS="-D_GLIBCXX_USE_CXX11_ABI=0" ./configure --disable-debug --disable-docs --disable-static --disable-introspection --disable-dependency-tracking --enable-cxx=yes --without-python --without-orc --without-fftw $1
|
|
||||||
make
|
|
||||||
make install
|
|
||||||
cd ..
|
|
||||||
rm -rf vips-$vips_version_latest_major_minor.$vips_version_latest_patch
|
|
||||||
rm vips-$vips_version_latest_major_minor.$vips_version_latest_patch.tar.gz
|
|
||||||
ldconfig
|
|
||||||
echo "Installed libvips $(PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig pkg-config --modversion vips)"
|
|
||||||
}
|
|
||||||
|
|
||||||
install_libopenslide_from_source() {
|
|
||||||
echo "Compiling openslide $openslide_version_latest_major_minor.$openslide_version_latest_patch from source"
|
|
||||||
curl -O -L https://github.com/openslide/openslide/releases/download/v$openslide_version_latest_major_minor.$openslide_version_latest_patch/openslide-$openslide_version_latest_major_minor.$openslide_version_latest_patch.tar.gz
|
|
||||||
tar xzvf openslide-$openslide_version_latest_major_minor.$openslide_version_latest_patch.tar.gz
|
|
||||||
cd openslide-$openslide_version_latest_major_minor.$openslide_version_latest_patch
|
|
||||||
PKG_CONFIG_PATH=$pkg_config_path ./configure $1
|
|
||||||
make
|
|
||||||
make install
|
|
||||||
cd ..
|
|
||||||
rm -rf openslide-$openslide_version_latest_major_minor.$openslide_version_latest_patch
|
|
||||||
rm openslide-$openslide_version_latest_major_minor.$openslide_version_latest_patch.tar.gz
|
|
||||||
ldconfig
|
|
||||||
echo "Installed libopenslide $openslide_version_latest_major_minor.$openslide_version_latest_patch"
|
|
||||||
}
|
|
||||||
|
|
||||||
sorry() {
|
|
||||||
echo "Sorry, I don't yet know how to install lib$1 on $2"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
pkg_config_path="$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig"
|
|
||||||
|
|
||||||
check_if_library_exists() {
|
|
||||||
PKG_CONFIG_PATH=$pkg_config_path pkg-config --exists $1
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
version_found=$(PKG_CONFIG_PATH=$pkg_config_path pkg-config --modversion $1)
|
|
||||||
PKG_CONFIG_PATH=$pkg_config_path pkg-config --atleast-version=$2 $1
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
# Found suitable version of libvips
|
|
||||||
echo "Found lib$1 $version_found"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
echo "Found lib$1 $version_found but require $2"
|
|
||||||
else
|
|
||||||
echo "Could not find lib$1 using a PKG_CONFIG_PATH of '$pkg_config_path'"
|
|
||||||
fi
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
enable_openslide=0
|
|
||||||
# Is libvips already installed, and is it at least the minimum required version?
|
|
||||||
if [ $# -eq 1 ]; then
|
|
||||||
if [ "$1" = "--with-openslide" ]; then
|
|
||||||
echo "Installing vips with openslide support"
|
|
||||||
enable_openslide=1
|
|
||||||
else
|
|
||||||
echo "Sorry, $1 is not supported. Did you mean --with-openslide?"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! type pkg-config >/dev/null; then
|
|
||||||
sorry "vips" "a system without pkg-config"
|
|
||||||
fi
|
|
||||||
|
|
||||||
openslide_exists=0
|
|
||||||
if [ $enable_openslide -eq 1 ]; then
|
|
||||||
check_if_library_exists "openslide" "$openslide_version_minimum"
|
|
||||||
openslide_exists=$?
|
|
||||||
fi
|
|
||||||
|
|
||||||
check_if_library_exists "vips" "$vips_version_minimum"
|
|
||||||
vips_exists=$?
|
|
||||||
if [ $vips_exists -eq 1 ] && [ $enable_openslide -eq 1 ]; then
|
|
||||||
if [ $openslide_exists -eq 1 ]; then
|
|
||||||
# Check if vips compiled with openslide support
|
|
||||||
vips_with_openslide=`vips list classes | grep -i opensli`
|
|
||||||
if [ -z $vips_with_openslide ]; then
|
|
||||||
echo "Vips compiled without openslide support."
|
|
||||||
else
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
elif [ $vips_exists -eq 1 ] && [ $enable_openslide -eq 0 ]; then
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Verify root/sudo access
|
|
||||||
if [ "$(id -u)" -ne "0" ]; then
|
|
||||||
echo "Sorry, I need root/sudo access to continue"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Deprecation warning
|
|
||||||
if [ "$(arch)" == "x86_64" ]; then
|
|
||||||
echo "This script is no longer required on most 64-bit Linux systems when using sharp v0.12.0+"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# OS-specific installations of libopenslide follows
|
|
||||||
# Either openslide does not exist, or vips is installed without openslide support
|
|
||||||
if [ $enable_openslide -eq 1 ] && [ -z $vips_with_openslide ] && [ $openslide_exists -eq 0 ]; then
|
|
||||||
if [ -f /etc/debian_version ]; then
|
|
||||||
# Debian Linux
|
|
||||||
DISTRO=$(lsb_release -c -s)
|
|
||||||
echo "Detected Debian Linux '$DISTRO'"
|
|
||||||
case "$DISTRO" in
|
|
||||||
jessie|vivid|wily|xenial)
|
|
||||||
# Debian 8, Ubuntu 15
|
|
||||||
echo "Installing libopenslide via apt-get"
|
|
||||||
apt-get install -y libopenslide-dev
|
|
||||||
;;
|
|
||||||
trusty|utopic|qiana|rebecca|rafaela|freya)
|
|
||||||
# Ubuntu 14, Mint 17
|
|
||||||
echo "Installing libopenslide dependencies via apt-get"
|
|
||||||
apt-get install -y automake build-essential curl zlib1g-dev libopenjpeg-dev libpng12-dev libjpeg-dev libtiff5-dev libgdk-pixbuf2.0-dev libxml2-dev libsqlite3-dev libcairo2-dev libglib2.0-dev sqlite3 libsqlite3-dev
|
|
||||||
install_libopenslide_from_source
|
|
||||||
;;
|
|
||||||
precise|wheezy|maya)
|
|
||||||
# Debian 7, Ubuntu 12.04, Mint 13
|
|
||||||
echo "Installing libopenslide dependencies via apt-get"
|
|
||||||
apt-get install -y automake build-essential curl zlib1g-dev libopenjpeg-dev libpng12-dev libjpeg-dev libtiff5-dev libgdk-pixbuf2.0-dev libxml2-dev libsqlite3-dev libcairo2-dev libglib2.0-dev sqlite3 libsqlite3-dev
|
|
||||||
install_libopenslide_from_source
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
# Unsupported Debian-based OS
|
|
||||||
sorry "openslide" "Debian-based $DISTRO"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
elif [ -f /etc/redhat-release ]; then
|
|
||||||
# Red Hat Linux
|
|
||||||
RELEASE=$(cat /etc/redhat-release)
|
|
||||||
echo "Detected Red Hat Linux '$RELEASE'"
|
|
||||||
case $RELEASE in
|
|
||||||
"Red Hat Enterprise Linux release 7."*|"CentOS Linux release 7."*|"Scientific Linux release 7."*)
|
|
||||||
# RHEL/CentOS 7
|
|
||||||
echo "Installing libopenslide dependencies via yum"
|
|
||||||
yum groupinstall -y "Development Tools"
|
|
||||||
yum install -y tar curl libpng-devel libjpeg-devel libxml2-devel zlib-devel openjpeg-devel libtiff-devel gdk-pixbuf2-devel sqlite-devel cairo-devel glib2-devel
|
|
||||||
install_libopenslide_from_source "--prefix=/usr"
|
|
||||||
;;
|
|
||||||
"Red Hat Enterprise Linux release 6."*|"CentOS release 6."*|"Scientific Linux release 6."*)
|
|
||||||
# RHEL/CentOS 6
|
|
||||||
echo "Installing libopenslide dependencies via yum"
|
|
||||||
yum groupinstall -y "Development Tools"
|
|
||||||
yum install -y tar curl libpng-devel libjpeg-devel libxml2-devel zlib-devel openjpeg-devel libtiff-devel gdk-pixbuf2-devel sqlite-devel cairo-devel glib2-devel
|
|
||||||
install_libopenslide_from_source "--prefix=/usr"
|
|
||||||
;;
|
|
||||||
"Fedora release 21 "*|"Fedora release 22 "*)
|
|
||||||
# Fedora 21, 22
|
|
||||||
echo "Installing libopenslide via yum"
|
|
||||||
yum install -y openslide-devel
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
# Unsupported RHEL-based OS
|
|
||||||
sorry "openslide" "$RELEASE"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
elif [ -f /etc/os-release ]; then
|
|
||||||
RELEASE=$(cat /etc/os-release | grep VERSION)
|
|
||||||
echo "Detected OpenSuse Linux '$RELEASE'"
|
|
||||||
case $RELEASE in
|
|
||||||
*"13.2"*)
|
|
||||||
echo "Installing libopenslide via zypper"
|
|
||||||
zypper --gpg-auto-import-keys install -y libopenslide-devel
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
elif [ -f /etc/SuSE-brand ]; then
|
|
||||||
RELEASE=$(cat /etc/SuSE-brand | grep VERSION)
|
|
||||||
echo "Detected OpenSuse Linux '$RELEASE'"
|
|
||||||
case $RELEASE in
|
|
||||||
*"13.1")
|
|
||||||
echo "Installing libopenslide dependencies via zypper"
|
|
||||||
zypper --gpg-auto-import-keys install -y --type pattern devel_basis
|
|
||||||
zypper --gpg-auto-import-keys install -y tar curl libpng16-devel libjpeg-turbo libjpeg8-devel libxml2-devel zlib-devel openjpeg-devel libtiff-devel libgdk_pixbuf-2_0-0 sqlite3-devel cairo-devel glib2-devel
|
|
||||||
install_libopenslide_from_source
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
else
|
|
||||||
# Unsupported OS
|
|
||||||
sorry "openslide" "$(uname -a)"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# OS-specific installations of libvips follows
|
|
||||||
|
|
||||||
if [ -f /etc/debian_version ]; then
|
|
||||||
# Debian Linux
|
|
||||||
DISTRO=$(lsb_release -c -s)
|
|
||||||
echo "Detected Debian Linux '$DISTRO'"
|
|
||||||
case "$DISTRO" in
|
|
||||||
jessie|trusty|utopic|vivid|wily|xenial|qiana|rebecca|rafaela|freya)
|
|
||||||
# Debian 8, Ubuntu 14.04+, Mint 17
|
|
||||||
echo "Installing libvips dependencies via apt-get"
|
|
||||||
apt-get install -y automake build-essential gobject-introspection gtk-doc-tools libglib2.0-dev libjpeg-dev libpng12-dev libwebp-dev libtiff5-dev libexif-dev libgsf-1-dev liblcms2-dev libxml2-dev swig libmagickcore-dev curl
|
|
||||||
install_libvips_from_source
|
|
||||||
;;
|
|
||||||
precise|wheezy|maya)
|
|
||||||
# Debian 7, Ubuntu 12.04, Mint 13
|
|
||||||
echo "Installing libvips dependencies via apt-get"
|
|
||||||
add-apt-repository -y ppa:lyrasis/precise-backports
|
|
||||||
apt-get update
|
|
||||||
apt-get install -y automake build-essential gobject-introspection gtk-doc-tools libglib2.0-dev libjpeg-dev libpng12-dev libwebp-dev libtiff4-dev libexif-dev libgsf-1-dev liblcms2-dev libxml2-dev swig libmagickcore-dev curl
|
|
||||||
install_libvips_from_source
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
# Unsupported Debian-based OS
|
|
||||||
sorry "vips" "Debian-based $DISTRO"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
elif [ -f /etc/redhat-release ]; then
|
|
||||||
# Red Hat Linux
|
|
||||||
RELEASE=$(cat /etc/redhat-release)
|
|
||||||
echo "Detected Red Hat Linux '$RELEASE'"
|
|
||||||
case $RELEASE in
|
|
||||||
"Red Hat Enterprise Linux release 7."*|"CentOS Linux release 7."*|"Scientific Linux release 7."*)
|
|
||||||
# RHEL/CentOS 7
|
|
||||||
echo "Installing libvips dependencies via yum"
|
|
||||||
yum groupinstall -y "Development Tools"
|
|
||||||
yum install -y tar curl gtk-doc libxml2-devel libjpeg-turbo-devel libpng-devel libtiff-devel libexif-devel libgsf-devel lcms2-devel ImageMagick-devel gobject-introspection-devel libwebp-devel
|
|
||||||
install_libvips_from_source "--prefix=/usr"
|
|
||||||
;;
|
|
||||||
"Red Hat Enterprise Linux release 6."*|"CentOS release 6."*|"Scientific Linux release 6."*)
|
|
||||||
# RHEL/CentOS 6
|
|
||||||
echo "Installing libvips dependencies via yum"
|
|
||||||
yum groupinstall -y "Development Tools"
|
|
||||||
yum install -y tar curl gtk-doc libxml2-devel libjpeg-turbo-devel libpng-devel libtiff-devel libexif-devel libgsf-devel lcms-devel ImageMagick-devel
|
|
||||||
yum install -y http://li.nux.ro/download/nux/dextop/el6/x86_64/nux-dextop-release-0-2.el6.nux.noarch.rpm
|
|
||||||
yum install -y --enablerepo=nux-dextop gobject-introspection-devel
|
|
||||||
yum install -y http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
|
|
||||||
yum install -y --enablerepo=remi libwebp-devel
|
|
||||||
install_libvips_from_source "--prefix=/usr"
|
|
||||||
;;
|
|
||||||
"Fedora"*)
|
|
||||||
# Fedora 21, 22, 23
|
|
||||||
echo "Installing libvips dependencies via yum"
|
|
||||||
yum groupinstall -y "Development Tools"
|
|
||||||
yum install -y gcc-c++ gtk-doc libxml2-devel libjpeg-turbo-devel libpng-devel libtiff-devel libexif-devel lcms-devel ImageMagick-devel gobject-introspection-devel libwebp-devel curl
|
|
||||||
install_libvips_from_source "--prefix=/usr"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
# Unsupported RHEL-based OS
|
|
||||||
sorry "vips" "$RELEASE"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
elif [ -f /etc/system-release ]; then
|
|
||||||
# Probably Amazon Linux
|
|
||||||
RELEASE=$(cat /etc/system-release)
|
|
||||||
case $RELEASE in
|
|
||||||
"Amazon Linux AMI release 2015.03"|"Amazon Linux AMI release 2015.09")
|
|
||||||
# Amazon Linux
|
|
||||||
echo "Detected '$RELEASE'"
|
|
||||||
echo "Installing libvips dependencies via yum"
|
|
||||||
yum groupinstall -y "Development Tools"
|
|
||||||
yum install -y gtk-doc libxml2-devel libjpeg-turbo-devel libpng-devel libtiff-devel libexif-devel libgsf-devel lcms2-devel ImageMagick-devel gobject-introspection-devel libwebp-devel curl
|
|
||||||
install_libvips_from_source "--prefix=/usr"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
# Unsupported Amazon Linux version
|
|
||||||
sorry "vips" "$RELEASE"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
elif [ -f /etc/os-release ]; then
|
|
||||||
RELEASE=$(cat /etc/os-release | grep VERSION)
|
|
||||||
echo "Detected OpenSuse Linux '$RELEASE'"
|
|
||||||
case $RELEASE in
|
|
||||||
*"13.2"*)
|
|
||||||
echo "Installing libvips dependencies via zypper"
|
|
||||||
zypper --gpg-auto-import-keys install -y --type pattern devel_basis
|
|
||||||
zypper --gpg-auto-import-keys install -y tar curl gtk-doc libxml2-devel libjpeg-turbo libjpeg8-devel libpng16-devel libtiff-devel libexif-devel liblcms2-devel ImageMagick-devel gobject-introspection-devel libwebp-devel
|
|
||||||
install_libvips_from_source
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
elif [ -f /etc/SuSE-brand ]; then
|
|
||||||
RELEASE=$(cat /etc/SuSE-brand | grep VERSION)
|
|
||||||
echo "Detected OpenSuse Linux '$RELEASE'"
|
|
||||||
case $RELEASE in
|
|
||||||
*"13.1")
|
|
||||||
echo "Installing libvips dependencies via zypper"
|
|
||||||
zypper --gpg-auto-import-keys install -y --type pattern devel_basis
|
|
||||||
zypper --gpg-auto-import-keys install -y tar curl gtk-doc libxml2-devel libjpeg-turbo libjpeg8-devel libpng16-devel libtiff-devel libexif-devel liblcms2-devel ImageMagick-devel gobject-introspection-devel libwebp-devel
|
|
||||||
install_libvips_from_source
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
else
|
|
||||||
# Unsupported OS
|
|
||||||
sorry "vips" "$(uname -a)"
|
|
||||||
fi
|
|
||||||
@@ -141,16 +141,16 @@ describe('Crop', function () {
|
|||||||
it('Invalid values fail', function () {
|
it('Invalid values fail', function () {
|
||||||
assert.throws(function () {
|
assert.throws(function () {
|
||||||
sharp().crop(9);
|
sharp().crop(9);
|
||||||
});
|
}, /Expected valid crop id\/name\/strategy for crop but received 9 of type number/);
|
||||||
assert.throws(function () {
|
assert.throws(function () {
|
||||||
sharp().crop(1.1);
|
sharp().crop(1.1);
|
||||||
});
|
}, /Expected valid crop id\/name\/strategy for crop but received 1.1 of type number/);
|
||||||
assert.throws(function () {
|
assert.throws(function () {
|
||||||
sharp().crop(-1);
|
sharp().crop(-1);
|
||||||
});
|
}, /Expected valid crop id\/name\/strategy for crop but received -1 of type number/);
|
||||||
assert.throws(function () {
|
assert.throws(function () {
|
||||||
sharp().crop('zoinks');
|
sharp().crop('zoinks');
|
||||||
});
|
}, /Expected valid crop id\/name\/strategy for crop but received zoinks of type string/);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Uses default value when none specified', function () {
|
it('Uses default value when none specified', function () {
|
||||||
|
|||||||
@@ -66,37 +66,37 @@ describe('Resize dimensions', function () {
|
|||||||
it('Invalid width - NaN', function () {
|
it('Invalid width - NaN', function () {
|
||||||
assert.throws(function () {
|
assert.throws(function () {
|
||||||
sharp().resize('spoons', 240);
|
sharp().resize('spoons', 240);
|
||||||
});
|
}, /Expected integer between 1 and 16383 for width but received spoons of type string/);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Invalid height - NaN', function () {
|
it('Invalid height - NaN', function () {
|
||||||
assert.throws(function () {
|
assert.throws(function () {
|
||||||
sharp().resize(320, 'spoons');
|
sharp().resize(320, 'spoons');
|
||||||
});
|
}, /Expected integer between 1 and 16383 for height but received spoons of type string/);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Invalid width - float', function () {
|
it('Invalid width - float', function () {
|
||||||
assert.throws(function () {
|
assert.throws(function () {
|
||||||
sharp().resize(1.5, 240);
|
sharp().resize(1.5, 240);
|
||||||
});
|
}, /Expected integer between 1 and 16383 for width but received 1.5 of type number/);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Invalid height - float', function () {
|
it('Invalid height - float', function () {
|
||||||
assert.throws(function () {
|
assert.throws(function () {
|
||||||
sharp().resize(320, 1.5);
|
sharp().resize(320, 1.5);
|
||||||
});
|
}, /Expected integer between 1 and 16383 for height but received 1.5 of type number/);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Invalid width - too large', function () {
|
it('Invalid width - too large', function () {
|
||||||
assert.throws(function () {
|
assert.throws(function () {
|
||||||
sharp().resize(0x4000, 240);
|
sharp().resize(0x4000, 240);
|
||||||
});
|
}, /Expected integer between 1 and 16383 for width but received 16384 of type number/);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Invalid height - too large', function () {
|
it('Invalid height - too large', function () {
|
||||||
assert.throws(function () {
|
assert.throws(function () {
|
||||||
sharp().resize(320, 0x4000);
|
sharp().resize(320, 0x4000);
|
||||||
});
|
}, /Expected integer between 1 and 16383 for height but received 16384 of type number/);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('WebP shrink-on-load rounds to zero, ensure recalculation is correct', function (done) {
|
it('WebP shrink-on-load rounds to zero, ensure recalculation is correct', function (done) {
|
||||||
|
|||||||
Reference in New Issue
Block a user