sharp 0.30.6 → 0.30.7
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/lib/input.js +1 -1
- package/lib/output.js +1 -1
- package/lib/resize.js +1 -1
- package/lib/sharp.js +3 -0
- package/package.json +3 -3
- package/src/pipeline.cc +6 -4
package/lib/input.js
CHANGED
|
@@ -357,7 +357,7 @@ function _isStreamInput () {
|
|
|
357
357
|
* const size = getNormalSize(await sharp(input).metadata());
|
|
358
358
|
*
|
|
359
359
|
* function getNormalSize({ width, height, orientation }) {
|
|
360
|
-
* return orientation || 0 >= 5
|
|
360
|
+
* return (orientation || 0) >= 5
|
|
361
361
|
* ? { width: height, height: width }
|
|
362
362
|
* : { width, height };
|
|
363
363
|
* }
|
package/lib/output.js
CHANGED
|
@@ -495,7 +495,7 @@ function webp (options) {
|
|
|
495
495
|
if (is.defined(options.smartSubsample)) {
|
|
496
496
|
this._setBooleanOption('webpSmartSubsample', options.smartSubsample);
|
|
497
497
|
}
|
|
498
|
-
const effort = options.effort
|
|
498
|
+
const effort = is.defined(options.effort) ? options.effort : options.reductionEffort;
|
|
499
499
|
if (is.defined(effort)) {
|
|
500
500
|
if (is.integer(effort) && is.inRange(effort, 0, 6)) {
|
|
501
501
|
this.options.webpEffort = effort;
|
package/lib/resize.js
CHANGED
|
@@ -211,7 +211,7 @@ function isRotationExpected (options) {
|
|
|
211
211
|
* @param {String} [options.height] - alternative means of specifying `height`. If both are present this take priority.
|
|
212
212
|
* @param {String} [options.fit='cover'] - how the image should be resized to fit both provided dimensions, one of `cover`, `contain`, `fill`, `inside` or `outside`.
|
|
213
213
|
* @param {String} [options.position='centre'] - position, gravity or strategy to use when `fit` is `cover` or `contain`.
|
|
214
|
-
* @param {String|Object} [options.background={r: 0, g: 0, b: 0, alpha: 1}] - background colour when
|
|
214
|
+
* @param {String|Object} [options.background={r: 0, g: 0, b: 0, alpha: 1}] - background colour when `fit` is `contain`, parsed by the [color](https://www.npmjs.org/package/color) module, defaults to black without transparency.
|
|
215
215
|
* @param {String} [options.kernel='lanczos3'] - the kernel to use for image reduction.
|
|
216
216
|
* @param {Boolean} [options.withoutEnlargement=false] - do not enlarge if the width *or* height are already less than the specified dimensions, equivalent to GraphicsMagick's `>` geometry option.
|
|
217
217
|
* @param {Boolean} [options.withoutReduction=false] - do not reduce if the width *or* height are already greater than the specified dimensions, equivalent to GraphicsMagick's `<` geometry option.
|
package/lib/sharp.js
CHANGED
|
@@ -12,6 +12,9 @@ try {
|
|
|
12
12
|
help.push('- Update Homebrew: "brew update && brew upgrade vips"');
|
|
13
13
|
} else {
|
|
14
14
|
const [platform, arch] = platformAndArch.split('-');
|
|
15
|
+
if (platform === 'linux' && /Module did not self-register/.test(err.message)) {
|
|
16
|
+
help.push('- Using worker threads? See https://sharp.pixelplumbing.com/install#worker-threads');
|
|
17
|
+
}
|
|
15
18
|
help.push(
|
|
16
19
|
'- Install with verbose logging and look for errors: "npm install --ignore-scripts=false --foreground-scripts --verbose sharp"',
|
|
17
20
|
`- Install for the current ${platformAndArch} runtime: "npm install --platform=${platform} --arch=${arch} sharp"`
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sharp",
|
|
3
3
|
"description": "High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, GIF, AVIF and TIFF images",
|
|
4
|
-
"version": "0.30.
|
|
4
|
+
"version": "0.30.7",
|
|
5
5
|
"author": "Lovell Fuller <npm@lovell.info>",
|
|
6
6
|
"homepage": "https://github.com/lovell/sharp",
|
|
7
7
|
"contributors": [
|
|
@@ -131,14 +131,14 @@
|
|
|
131
131
|
"color": "^4.2.3",
|
|
132
132
|
"detect-libc": "^2.0.1",
|
|
133
133
|
"node-addon-api": "^5.0.0",
|
|
134
|
-
"prebuild-install": "^7.1.
|
|
134
|
+
"prebuild-install": "^7.1.1",
|
|
135
135
|
"semver": "^7.3.7",
|
|
136
136
|
"simple-get": "^4.0.1",
|
|
137
137
|
"tar-fs": "^2.1.1",
|
|
138
138
|
"tunnel-agent": "^0.6.0"
|
|
139
139
|
},
|
|
140
140
|
"devDependencies": {
|
|
141
|
-
"async": "^3.2.
|
|
141
|
+
"async": "^3.2.4",
|
|
142
142
|
"cc": "^3.0.1",
|
|
143
143
|
"decompress-zip": "^0.3.3",
|
|
144
144
|
"documentation": "^13.2.5",
|
package/src/pipeline.cc
CHANGED
|
@@ -188,8 +188,10 @@ class PipelineWorker : public Napi::AsyncWorker {
|
|
|
188
188
|
if (jpegShrinkOnLoad > 1 && static_cast<int>(shrink) == jpegShrinkOnLoad) {
|
|
189
189
|
jpegShrinkOnLoad /= 2;
|
|
190
190
|
}
|
|
191
|
-
} else if (inputImageType == sharp::ImageType::WEBP
|
|
192
|
-
|
|
191
|
+
} else if (inputImageType == sharp::ImageType::WEBP && shrink > 1.0) {
|
|
192
|
+
// Avoid upscaling via webp
|
|
193
|
+
scale = 1.0 / shrink;
|
|
194
|
+
} else if (inputImageType == sharp::ImageType::SVG ||
|
|
193
195
|
inputImageType == sharp::ImageType::PDF) {
|
|
194
196
|
scale = 1.0 / shrink;
|
|
195
197
|
}
|
|
@@ -607,14 +609,14 @@ class PipelineWorker : public Napi::AsyncWorker {
|
|
|
607
609
|
int across = 0;
|
|
608
610
|
int down = 0;
|
|
609
611
|
// Use gravity in overlay
|
|
610
|
-
if (compositeImage.width() <=
|
|
612
|
+
if (compositeImage.width() <= image.width()) {
|
|
611
613
|
across = static_cast<int>(ceil(static_cast<double>(image.width()) / compositeImage.width()));
|
|
612
614
|
// Ensure odd number of tiles across when gravity is centre, north or south
|
|
613
615
|
if (composite->gravity == 0 || composite->gravity == 1 || composite->gravity == 3) {
|
|
614
616
|
across |= 1;
|
|
615
617
|
}
|
|
616
618
|
}
|
|
617
|
-
if (compositeImage.height() <=
|
|
619
|
+
if (compositeImage.height() <= image.height()) {
|
|
618
620
|
down = static_cast<int>(ceil(static_cast<double>(image.height()) / compositeImage.height()));
|
|
619
621
|
// Ensure odd number of tiles down when gravity is centre, east or west
|
|
620
622
|
if (composite->gravity == 0 || composite->gravity == 2 || composite->gravity == 4) {
|