sharp 0.20.8 → 0.21.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -11
- package/binding.gyp +16 -1
- package/docs/api-channel.md +16 -0
- package/docs/api-colour.md +1 -19
- package/docs/api-composite.md +2 -3
- package/docs/api-constructor.md +2 -3
- package/docs/api-input.md +7 -2
- package/docs/api-operation.md +73 -115
- package/docs/api-output.md +9 -0
- package/docs/api-resize.md +160 -108
- package/docs/api-utility.md +4 -7
- package/docs/changelog.md +102 -0
- package/docs/image/sharp-logo.svg +5 -0
- package/docs/index.md +12 -6
- package/docs/install.md +41 -42
- package/docs/performance.md +14 -21
- package/install/libvips.js +28 -24
- package/lib/channel.js +20 -4
- package/lib/colour.js +35 -18
- package/lib/composite.js +2 -3
- package/lib/constructor.js +27 -42
- package/lib/input.js +9 -6
- package/lib/libvips.js +7 -1
- package/lib/operation.js +81 -123
- package/lib/output.js +128 -60
- package/lib/platform.js +4 -1
- package/lib/resize.js +310 -107
- package/lib/utility.js +5 -8
- package/package.json +30 -21
- package/src/common.cc +59 -14
- package/src/common.h +15 -12
- package/src/libvips/cplusplus/VImage.cpp +95 -95
- package/src/libvips/cplusplus/vips-operators.cpp +268 -185
- package/src/metadata.cc +34 -1
- package/src/metadata.h +10 -1
- package/src/operations.cc +47 -49
- package/src/operations.h +13 -2
- package/src/pipeline.cc +101 -95
- package/src/pipeline.h +40 -14
- package/src/sharp.cc +1 -1
- package/src/stats.cc +1 -1
- package/src/stats.h +1 -1
- package/src/utilities.cc +2 -2
- package/src/utilities.h +1 -1
package/docs/api-resize.md
CHANGED
|
@@ -2,181 +2,233 @@
|
|
|
2
2
|
|
|
3
3
|
## resize
|
|
4
4
|
|
|
5
|
-
Resize image to `width` x
|
|
6
|
-
By default, the resized image is centre cropped to the exact size specified.
|
|
5
|
+
Resize image to `width`, `height` or `width x height`.
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
When both a `width` and `height` are provided, the possible methods by which the image should **fit** these are:
|
|
9
8
|
|
|
10
|
-
- `
|
|
11
|
-
- `
|
|
12
|
-
- `
|
|
9
|
+
- `cover`: Crop to cover both provided dimensions (the default).
|
|
10
|
+
- `contain`: Embed within both provided dimensions.
|
|
11
|
+
- `fill`: Ignore the aspect ratio of the input and stretch to both provided dimensions.
|
|
12
|
+
- `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.
|
|
13
|
+
- `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.
|
|
14
|
+
Some of these values are based on the [object-fit][1] CSS property.
|
|
15
|
+
|
|
16
|
+
When using a `fit` of `cover` or `contain`, the default **position** is `centre`. Other options are:
|
|
17
|
+
|
|
18
|
+
- `sharp.position`: `top`, `right top`, `right`, `right bottom`, `bottom`, `left bottom`, `left`, `left top`.
|
|
19
|
+
- `sharp.gravity`: `north`, `northeast`, `east`, `southeast`, `south`, `southwest`, `west`, `northwest`, `center` or `centre`.
|
|
20
|
+
- `sharp.strategy`: `cover` only, dynamically crop using either the `entropy` or `attention` strategy.
|
|
21
|
+
Some of these values are based on the [object-position][2] CSS property.
|
|
22
|
+
|
|
23
|
+
The experimental strategy-based approach resizes so one dimension is at its target length
|
|
24
|
+
then repeatedly ranks edge regions, discarding the edge with the lowest score based on the selected strategy.
|
|
25
|
+
|
|
26
|
+
- `entropy`: focus on the region with the highest [Shannon entropy][3].
|
|
27
|
+
- `attention`: focus on the region with the highest luminance frequency, colour saturation and presence of skin tones.
|
|
28
|
+
|
|
29
|
+
Possible interpolation kernels are:
|
|
30
|
+
|
|
31
|
+
- `nearest`: Use [nearest neighbour interpolation][4].
|
|
32
|
+
- `cubic`: Use a [Catmull-Rom spline][5].
|
|
33
|
+
- `mitchell`: Use a [Mitchell-Netravali spline][6].
|
|
34
|
+
- `lanczos2`: Use a [Lanczos kernel][7] with `a=2`.
|
|
13
35
|
- `lanczos3`: Use a Lanczos kernel with `a=3` (the default).
|
|
14
36
|
|
|
15
37
|
### Parameters
|
|
16
38
|
|
|
17
|
-
- `width` **[Number][
|
|
18
|
-
- `height` **[Number][
|
|
19
|
-
- `options` **[Object][
|
|
20
|
-
- `options.
|
|
21
|
-
- `options.
|
|
39
|
+
- `width` **[Number][8]?** pixels wide the resultant image should be. Use `null` or `undefined` to auto-scale the width to match the height.
|
|
40
|
+
- `height` **[Number][8]?** pixels high the resultant image should be. Use `null` or `undefined` to auto-scale the height to match the width.
|
|
41
|
+
- `options` **[Object][9]?**
|
|
42
|
+
- `options.width` **[String][10]?** alternative means of specifying `width`. If both are present this take priority.
|
|
43
|
+
- `options.height` **[String][10]?** alternative means of specifying `height`. If both are present this take priority.
|
|
44
|
+
- `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'`)
|
|
45
|
+
- `options.position` **[String][10]** position, gravity or strategy to use when `fit` is `cover` or `contain`. (optional, default `'centre'`)
|
|
46
|
+
- `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}`)
|
|
47
|
+
- `options.kernel` **[String][10]** the kernel to use for image reduction. (optional, default `'lanczos3'`)
|
|
48
|
+
- `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`)
|
|
49
|
+
- `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`)
|
|
22
50
|
|
|
23
51
|
### Examples
|
|
24
52
|
|
|
25
53
|
```javascript
|
|
26
|
-
sharp(
|
|
54
|
+
sharp(input)
|
|
55
|
+
.resize({ width: 100 })
|
|
56
|
+
.toBuffer()
|
|
57
|
+
.then(data => {
|
|
58
|
+
// 100 pixels wide, auto-scaled height
|
|
59
|
+
});
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
```javascript
|
|
63
|
+
sharp(input)
|
|
64
|
+
.resize({ height: 100 })
|
|
65
|
+
.toBuffer()
|
|
66
|
+
.then(data => {
|
|
67
|
+
// 100 pixels high, auto-scaled width
|
|
68
|
+
});
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
```javascript
|
|
72
|
+
sharp(input)
|
|
27
73
|
.resize(200, 300, {
|
|
28
|
-
kernel: sharp.kernel.nearest
|
|
74
|
+
kernel: sharp.kernel.nearest,
|
|
75
|
+
fit: 'contain',
|
|
76
|
+
position: 'right top',
|
|
77
|
+
background: { r: 255, g: 255, b: 255, alpha: 0.5 }
|
|
29
78
|
})
|
|
30
|
-
.
|
|
31
|
-
.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
//
|
|
35
|
-
// containing a nearest-neighbour scaled version, embedded on a white canvas,
|
|
36
|
-
// of the image data in inputBuffer
|
|
79
|
+
.toFile('output.png')
|
|
80
|
+
.then(() => {
|
|
81
|
+
// output.png is a 200 pixels wide and 300 pixels high image
|
|
82
|
+
// containing a nearest-neighbour scaled version
|
|
83
|
+
// contained within the north-east corner of a semi-transparent white canvas
|
|
37
84
|
});
|
|
38
85
|
```
|
|
39
86
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
87
|
+
```javascript
|
|
88
|
+
const transformer = sharp()
|
|
89
|
+
.resize({
|
|
90
|
+
width: 200,
|
|
91
|
+
height: 200,
|
|
92
|
+
fit: sharp.fit.cover,
|
|
93
|
+
position: sharp.strategy.entropy
|
|
94
|
+
});
|
|
95
|
+
// Read image data from readableStream
|
|
96
|
+
// Write 200px square auto-cropped image data to writableStream
|
|
97
|
+
readableStream
|
|
98
|
+
.pipe(transformer)
|
|
99
|
+
.pipe(writableStream);
|
|
100
|
+
```
|
|
43
101
|
|
|
44
|
-
|
|
102
|
+
```javascript
|
|
103
|
+
sharp(input)
|
|
104
|
+
.resize(200, 200, {
|
|
105
|
+
fit: sharp.fit.inside,
|
|
106
|
+
withoutEnlargement: true
|
|
107
|
+
})
|
|
108
|
+
.toFormat('jpeg')
|
|
109
|
+
.toBuffer()
|
|
110
|
+
.then(function(outputBuffer) {
|
|
111
|
+
// outputBuffer contains JPEG image data
|
|
112
|
+
// no wider and no higher than 200 pixels
|
|
113
|
+
// and no larger than the input image
|
|
114
|
+
});
|
|
115
|
+
```
|
|
45
116
|
|
|
46
|
-
|
|
117
|
+
- Throws **[Error][13]** Invalid parameters
|
|
47
118
|
|
|
48
|
-
|
|
49
|
-
`southwest`, `west`, `northwest`, `center` and `centre`.
|
|
119
|
+
Returns **Sharp**
|
|
50
120
|
|
|
51
|
-
|
|
52
|
-
then repeatedly ranks edge regions, discarding the edge with the lowest score based on the selected strategy.
|
|
121
|
+
## extend
|
|
53
122
|
|
|
54
|
-
|
|
55
|
-
|
|
123
|
+
Extends/pads the edges of the image with the provided background colour.
|
|
124
|
+
This operation will always occur after resizing and extraction, if any.
|
|
56
125
|
|
|
57
126
|
### Parameters
|
|
58
127
|
|
|
59
|
-
- `
|
|
128
|
+
- `extend` **([Number][8] \| [Object][9])** single pixel count to add to all edges or an Object with per-edge counts
|
|
129
|
+
- `extend.top` **[Number][8]?**
|
|
130
|
+
- `extend.left` **[Number][8]?**
|
|
131
|
+
- `extend.bottom` **[Number][8]?**
|
|
132
|
+
- `extend.right` **[Number][8]?**
|
|
133
|
+
- `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}`)
|
|
60
134
|
|
|
61
135
|
### Examples
|
|
62
136
|
|
|
63
137
|
```javascript
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
.
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
138
|
+
// Resize to 140 pixels wide, then add 10 transparent pixels
|
|
139
|
+
// to the top, left and right edges and 20 to the bottom edge
|
|
140
|
+
sharp(input)
|
|
141
|
+
.resize(140)
|
|
142
|
+
.extend({
|
|
143
|
+
top: 10,
|
|
144
|
+
bottom: 20,
|
|
145
|
+
left: 10,
|
|
146
|
+
right: 10
|
|
147
|
+
background: { r: 0, g: 0, b: 0, alpha: 0 }
|
|
148
|
+
})
|
|
149
|
+
...
|
|
73
150
|
```
|
|
74
151
|
|
|
75
|
-
- Throws **[Error][
|
|
152
|
+
- Throws **[Error][13]** Invalid parameters
|
|
76
153
|
|
|
77
154
|
Returns **Sharp**
|
|
78
155
|
|
|
79
|
-
##
|
|
156
|
+
## extract
|
|
80
157
|
|
|
81
|
-
|
|
82
|
-
then embed on a background of the exact `width` and `height` specified.
|
|
158
|
+
Extract a region of the image.
|
|
83
159
|
|
|
84
|
-
|
|
85
|
-
|
|
160
|
+
- Use `extract` before `resize` for pre-resize extraction.
|
|
161
|
+
- Use `extract` after `resize` for post-resize extraction.
|
|
162
|
+
- Use `extract` before and after for both.
|
|
86
163
|
|
|
87
164
|
### Parameters
|
|
88
165
|
|
|
89
|
-
- `
|
|
166
|
+
- `options` **[Object][9]**
|
|
167
|
+
- `options.left` **[Number][8]** zero-indexed offset from left edge
|
|
168
|
+
- `options.top` **[Number][8]** zero-indexed offset from top edge
|
|
169
|
+
- `options.width` **[Number][8]** dimension of extracted image
|
|
170
|
+
- `options.height` **[Number][8]** dimension of extracted image
|
|
90
171
|
|
|
91
172
|
### Examples
|
|
92
173
|
|
|
93
174
|
```javascript
|
|
94
|
-
sharp(
|
|
95
|
-
.
|
|
96
|
-
.
|
|
97
|
-
|
|
98
|
-
.toFormat(sharp.format.webp)
|
|
99
|
-
.toBuffer(function(err, outputBuffer) {
|
|
100
|
-
if (err) {
|
|
101
|
-
throw err;
|
|
102
|
-
}
|
|
103
|
-
// outputBuffer contains WebP image data of a 200 pixels wide and 300 pixels high
|
|
104
|
-
// containing a scaled version, embedded on a transparent canvas, of input.gif
|
|
175
|
+
sharp(input)
|
|
176
|
+
.extract({ left: left, top: top, width: width, height: height })
|
|
177
|
+
.toFile(output, function(err) {
|
|
178
|
+
// Extract a region of the input image, saving in the same format.
|
|
105
179
|
});
|
|
106
180
|
```
|
|
107
181
|
|
|
108
|
-
- Throws **[Error][8]** Invalid parameters
|
|
109
|
-
|
|
110
|
-
Returns **Sharp**
|
|
111
|
-
|
|
112
|
-
## max
|
|
113
|
-
|
|
114
|
-
Preserving aspect ratio, resize the image to be as large as possible
|
|
115
|
-
while ensuring its dimensions are less than or equal to the `width` and `height` specified.
|
|
116
|
-
|
|
117
|
-
Both `width` and `height` must be provided via `resize` otherwise the behaviour will default to `crop`.
|
|
118
|
-
|
|
119
|
-
### Examples
|
|
120
|
-
|
|
121
182
|
```javascript
|
|
122
|
-
sharp(
|
|
123
|
-
.
|
|
124
|
-
.
|
|
125
|
-
.
|
|
126
|
-
.
|
|
127
|
-
|
|
128
|
-
// outputBuffer contains JPEG image data no wider than 200 pixels and no higher
|
|
129
|
-
// than 200 pixels regardless of the inputBuffer image dimensions
|
|
183
|
+
sharp(input)
|
|
184
|
+
.extract({ left: leftOffsetPre, top: topOffsetPre, width: widthPre, height: heightPre })
|
|
185
|
+
.resize(width, height)
|
|
186
|
+
.extract({ left: leftOffsetPost, top: topOffsetPost, width: widthPost, height: heightPost })
|
|
187
|
+
.toFile(output, function(err) {
|
|
188
|
+
// Extract a region, resize, then extract from the resized image
|
|
130
189
|
});
|
|
131
190
|
```
|
|
132
191
|
|
|
192
|
+
- Throws **[Error][13]** Invalid parameters
|
|
193
|
+
|
|
133
194
|
Returns **Sharp**
|
|
134
195
|
|
|
135
|
-
##
|
|
196
|
+
## trim
|
|
136
197
|
|
|
137
|
-
|
|
138
|
-
|
|
198
|
+
Trim "boring" pixels from all edges that contain values similar to the top-left pixel.
|
|
199
|
+
The `info` response Object will contain `trimOffsetLeft` and `trimOffsetTop` properties.
|
|
139
200
|
|
|
140
|
-
|
|
201
|
+
### Parameters
|
|
141
202
|
|
|
142
|
-
|
|
203
|
+
- `threshold` **[Number][8]** the allowed difference from the top-left pixel, a number greater than zero. (optional, default `10`)
|
|
143
204
|
|
|
144
|
-
## ignoreAspectRatio
|
|
145
205
|
|
|
146
|
-
|
|
147
|
-
the exact `width` and/or `height` provided via `resize`.
|
|
206
|
+
- Throws **[Error][13]** Invalid parameters
|
|
148
207
|
|
|
149
208
|
Returns **Sharp**
|
|
150
209
|
|
|
151
|
-
|
|
210
|
+
[1]: https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit
|
|
152
211
|
|
|
153
|
-
|
|
154
|
-
This is equivalent to GraphicsMagick's `>` geometry option:
|
|
155
|
-
"_change the dimensions of the image only if its width or height exceeds the geometry specification_".
|
|
156
|
-
Use with `max()` to preserve the image's aspect ratio.
|
|
212
|
+
[2]: https://developer.mozilla.org/en-US/docs/Web/CSS/object-position
|
|
157
213
|
|
|
158
|
-
|
|
214
|
+
[3]: https://en.wikipedia.org/wiki/Entropy_%28information_theory%29
|
|
159
215
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
- `withoutEnlargement` **[Boolean][7]** (optional, default `true`)
|
|
163
|
-
|
|
164
|
-
Returns **Sharp**
|
|
216
|
+
[4]: http://en.wikipedia.org/wiki/Nearest-neighbor_interpolation
|
|
165
217
|
|
|
166
|
-
[
|
|
218
|
+
[5]: https://en.wikipedia.org/wiki/Centripetal_Catmull%E2%80%93Rom_spline
|
|
167
219
|
|
|
168
|
-
[
|
|
220
|
+
[6]: https://www.cs.utexas.edu/~fussell/courses/cs384g-fall2013/lectures/mitchell/Mitchell.pdf
|
|
169
221
|
|
|
170
|
-
[
|
|
222
|
+
[7]: https://en.wikipedia.org/wiki/Lanczos_resampling#Lanczos_kernel
|
|
171
223
|
|
|
172
|
-
[
|
|
224
|
+
[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
|
173
225
|
|
|
174
|
-
[
|
|
226
|
+
[9]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
|
175
227
|
|
|
176
|
-
[
|
|
228
|
+
[10]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
|
177
229
|
|
|
178
|
-
[
|
|
230
|
+
[11]: https://www.npmjs.org/package/color
|
|
179
231
|
|
|
180
|
-
[
|
|
232
|
+
[12]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
|
|
181
233
|
|
|
182
|
-
[
|
|
234
|
+
[13]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error
|
package/docs/api-utility.md
CHANGED
|
@@ -77,23 +77,20 @@ Requires libvips to have been compiled with liborc support.
|
|
|
77
77
|
Improves the performance of `resize`, `blur` and `sharpen` operations
|
|
78
78
|
by taking advantage of the SIMD vector unit of the CPU, e.g. Intel SSE and ARM NEON.
|
|
79
79
|
|
|
80
|
-
This feature is currently off by default but future versions may reverse this.
|
|
81
|
-
Versions of liborc prior to 0.4.25 are known to segfault under heavy load.
|
|
82
|
-
|
|
83
80
|
### Parameters
|
|
84
81
|
|
|
85
|
-
- `simd` **[Boolean][2]** (optional, default `
|
|
82
|
+
- `simd` **[Boolean][2]** (optional, default `true`)
|
|
86
83
|
|
|
87
84
|
### Examples
|
|
88
85
|
|
|
89
86
|
```javascript
|
|
90
87
|
const simd = sharp.simd();
|
|
91
|
-
// simd is `true` if
|
|
88
|
+
// simd is `true` if the runtime use of liborc is currently enabled
|
|
92
89
|
```
|
|
93
90
|
|
|
94
91
|
```javascript
|
|
95
|
-
const simd = sharp.simd(
|
|
96
|
-
//
|
|
92
|
+
const simd = sharp.simd(false);
|
|
93
|
+
// prevent libvips from using liborc at runtime
|
|
97
94
|
```
|
|
98
95
|
|
|
99
96
|
Returns **[Boolean][2]**
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,107 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
### v0.21 - "*teeth*"
|
|
4
|
+
|
|
5
|
+
Requires libvips v8.7.0.
|
|
6
|
+
|
|
7
|
+
#### v0.21.3 - 19<sup>th</sup> January 2019
|
|
8
|
+
|
|
9
|
+
* Input image decoding now fails fast, set `failOnError` to change this behaviour.
|
|
10
|
+
|
|
11
|
+
* Failed filesystem-based input now separates missing file and invalid format errors.
|
|
12
|
+
[#1542](https://github.com/lovell/sharp/issues/1542)
|
|
13
|
+
|
|
14
|
+
#### v0.21.2 - 13<sup>th</sup> January 2019
|
|
15
|
+
|
|
16
|
+
* Ensure all metadata is removed from PNG output unless `withMetadata` used.
|
|
17
|
+
|
|
18
|
+
* Ensure shortest edge is at least one pixel after resizing.
|
|
19
|
+
[#1003](https://github.com/lovell/sharp/issues/1003)
|
|
20
|
+
|
|
21
|
+
* Add `ensureAlpha` operation to add an alpha channel, if missing.
|
|
22
|
+
[#1153](https://github.com/lovell/sharp/issues/1153)
|
|
23
|
+
|
|
24
|
+
* Expose `pages` and `pageHeight` metadata for multi-page input images.
|
|
25
|
+
[#1205](https://github.com/lovell/sharp/issues/1205)
|
|
26
|
+
|
|
27
|
+
* Expose PNG output options requiring libimagequant.
|
|
28
|
+
[#1484](https://github.com/lovell/sharp/issues/1484)
|
|
29
|
+
|
|
30
|
+
* Expose underlying error message for invalid input.
|
|
31
|
+
[#1505](https://github.com/lovell/sharp/issues/1505)
|
|
32
|
+
|
|
33
|
+
* Prevent mutatation of options passed to `jpeg`.
|
|
34
|
+
[#1516](https://github.com/lovell/sharp/issues/1516)
|
|
35
|
+
|
|
36
|
+
* Ensure forced output format applied correctly when output chaining.
|
|
37
|
+
[#1528](https://github.com/lovell/sharp/issues/1528)
|
|
38
|
+
|
|
39
|
+
#### v0.21.1 - 7<sup>th</sup> December 2018
|
|
40
|
+
|
|
41
|
+
* Install: support `sharp_dist_base_url` npm config, like existing `SHARP_DIST_BASE_URL`.
|
|
42
|
+
[#1422](https://github.com/lovell/sharp/pull/1422)
|
|
43
|
+
[@SethWen](https://github.com/SethWen)
|
|
44
|
+
|
|
45
|
+
* Ensure `channel` metadata is correct for raw, greyscale output.
|
|
46
|
+
[#1425](https://github.com/lovell/sharp/issues/1425)
|
|
47
|
+
|
|
48
|
+
* Add support for the "mitchell" kernel for image reductions.
|
|
49
|
+
[#1438](https://github.com/lovell/sharp/pull/1438)
|
|
50
|
+
[@Daiz](https://github.com/Daiz)
|
|
51
|
+
|
|
52
|
+
* Allow separate parameters for gamma encoding and decoding.
|
|
53
|
+
[#1439](https://github.com/lovell/sharp/pull/1439)
|
|
54
|
+
[@Daiz](https://github.com/Daiz)
|
|
55
|
+
|
|
56
|
+
* Build prototype with `Object.assign` to allow minification.
|
|
57
|
+
[#1475](https://github.com/lovell/sharp/pull/1475)
|
|
58
|
+
[@jaubourg](https://github.com/jaubourg)
|
|
59
|
+
|
|
60
|
+
* Expose libvips' recombination matrix operation.
|
|
61
|
+
[#1477](https://github.com/lovell/sharp/pull/1477)
|
|
62
|
+
[@fromkeith](https://github.com/fromkeith)
|
|
63
|
+
|
|
64
|
+
* Expose libvips' pyramid/tile options for TIFF output.
|
|
65
|
+
[#1483](https://github.com/lovell/sharp/pull/1483)
|
|
66
|
+
[@mbklein](https://github.com/mbklein)
|
|
67
|
+
|
|
68
|
+
#### v0.21.0 - 4<sup>th</sup> October 2018
|
|
69
|
+
|
|
70
|
+
* Deprecate the following resize-related functions:
|
|
71
|
+
`crop`, `embed`, `ignoreAspectRatio`, `max`, `min` and `withoutEnlargement`.
|
|
72
|
+
Access to these is now via options passed to the `resize` function.
|
|
73
|
+
For example:
|
|
74
|
+
`embed('north')` is now `resize(width, height, { fit: 'contain', position: 'north' })`,
|
|
75
|
+
`crop('attention')` is now `resize(width, height, { fit: 'cover', position: 'attention' })`,
|
|
76
|
+
`max().withoutEnlargement()` is now `resize(width, height, { fit: 'inside', withoutEnlargement: true })`.
|
|
77
|
+
[#1135](https://github.com/lovell/sharp/issues/1135)
|
|
78
|
+
|
|
79
|
+
* Deprecate the `background` function.
|
|
80
|
+
Per-operation `background` options added to `resize`, `extend` and `flatten` operations.
|
|
81
|
+
[#1392](https://github.com/lovell/sharp/issues/1392)
|
|
82
|
+
|
|
83
|
+
* Add `size` to `metadata` response (Stream and Buffer input only).
|
|
84
|
+
[#695](https://github.com/lovell/sharp/issues/695)
|
|
85
|
+
|
|
86
|
+
* Switch from custom trim operation to `vips_find_trim`.
|
|
87
|
+
[#914](https://github.com/lovell/sharp/issues/914)
|
|
88
|
+
|
|
89
|
+
* Add `chromaSubsampling` and `isProgressive` properties to `metadata` response.
|
|
90
|
+
[#1186](https://github.com/lovell/sharp/issues/1186)
|
|
91
|
+
|
|
92
|
+
* Drop Node 4 support.
|
|
93
|
+
[#1212](https://github.com/lovell/sharp/issues/1212)
|
|
94
|
+
|
|
95
|
+
* Enable SIMD convolution by default.
|
|
96
|
+
[#1213](https://github.com/lovell/sharp/issues/1213)
|
|
97
|
+
|
|
98
|
+
* Add experimental prebuilt binaries for musl-based Linux.
|
|
99
|
+
[#1379](https://github.com/lovell/sharp/issues/1379)
|
|
100
|
+
|
|
101
|
+
* Add support for arbitrary rotation angle via vips_rotate.
|
|
102
|
+
[#1385](https://github.com/lovell/sharp/pull/1385)
|
|
103
|
+
[@freezy](https://github.com/freezy)
|
|
104
|
+
|
|
3
105
|
### v0.20 - "*prebuild*"
|
|
4
106
|
|
|
5
107
|
Requires libvips v8.6.1.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="86 86 550 550">
|
|
2
|
+
<!-- Copyright 2019 Lovell Fuller. This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) License. -->
|
|
3
|
+
<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"/>
|
|
4
|
+
<path fill="none" stroke="#090" stroke-width="80" d="M451.441 610.246V438.66l178.725-23.91M269.688 112.59v171.58L90.964 308.093"/>
|
|
5
|
+
</svg>
|
package/docs/index.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# sharp
|
|
2
2
|
|
|
3
|
+
<img src="image/sharp-logo.svg" width="160" height="160" alt="sharp logo" align="right">
|
|
4
|
+
|
|
3
5
|
The typical use case for this high speed Node.js module
|
|
4
6
|
is to convert large images in common formats to
|
|
5
7
|
smaller, web-friendly JPEG, PNG and WebP images of varying dimensions.
|
|
@@ -13,8 +15,8 @@ Lanczos resampling ensures quality is not sacrificed for speed.
|
|
|
13
15
|
As well as image resizing, operations such as
|
|
14
16
|
rotation, extraction, compositing and gamma correction are available.
|
|
15
17
|
|
|
16
|
-
Most 64-bit OS X, Windows and Linux
|
|
17
|
-
Node versions
|
|
18
|
+
Most modern 64-bit OS X, Windows and Linux systems running
|
|
19
|
+
Node versions 6, 8 and 10
|
|
18
20
|
do not require any additional install or runtime dependencies.
|
|
19
21
|
|
|
20
22
|
[](https://coveralls.io/r/lovell/sharp?branch=master)
|
|
@@ -37,7 +39,7 @@ and [Leaflet](https://github.com/turban/Leaflet.Zoomify).
|
|
|
37
39
|
### Fast
|
|
38
40
|
|
|
39
41
|
This module is powered by the blazingly fast
|
|
40
|
-
[libvips](https://github.com/
|
|
42
|
+
[libvips](https://github.com/libvips/libvips) image processing library,
|
|
41
43
|
originally created in 1989 at Birkbeck College
|
|
42
44
|
and currently maintained by
|
|
43
45
|
[John Cupitt](https://github.com/jcupitt).
|
|
@@ -118,17 +120,21 @@ the help and code contributions of the following people:
|
|
|
118
120
|
* [Alun Davies](https://github.com/alundavies)
|
|
119
121
|
* [Aidan Hoolachan](https://github.com/ajhool)
|
|
120
122
|
* [Axel Eirola](https://github.com/aeirola)
|
|
123
|
+
* [Freezy](https://github.com/freezy)
|
|
124
|
+
* [Julian Aubourg](https://github.com/jaubourg)
|
|
125
|
+
* [Keith Belovay](https://github.com/fromkeith)
|
|
126
|
+
* [Michael B. Klein](https://github.com/mbklein)
|
|
121
127
|
|
|
122
128
|
Thank you!
|
|
123
129
|
|
|
124
|
-
###
|
|
130
|
+
### Licensing
|
|
125
131
|
|
|
126
|
-
Copyright 2013, 2014, 2015, 2016, 2017, 2018 Lovell Fuller and contributors.
|
|
132
|
+
Copyright 2013, 2014, 2015, 2016, 2017, 2018, 2019 Lovell Fuller and contributors.
|
|
127
133
|
|
|
128
134
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
129
135
|
you may not use this file except in compliance with the License.
|
|
130
136
|
You may obtain a copy of the License at
|
|
131
|
-
[
|
|
137
|
+
[https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0)
|
|
132
138
|
|
|
133
139
|
Unless required by applicable law or agreed to in writing, software
|
|
134
140
|
distributed under the License is distributed on an "AS IS" BASIS,
|