sharp 0.26.1 → 0.26.2
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/install/libvips.js +5 -2
- package/lib/constructor.js +1 -0
- package/lib/output.js +7 -0
- package/lib/resize.js +2 -1
- package/package.json +1 -1
- package/src/common.cc +2 -0
- package/src/common.h +1 -0
- package/src/pipeline.cc +2 -0
- package/src/pipeline.h +1 -0
package/install/libvips.js
CHANGED
|
@@ -80,9 +80,12 @@ try {
|
|
|
80
80
|
throw new Error(`Use with glibc ${detectLibc.version} requires manual installation of libvips >= ${minimumLibvipsVersion}`);
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
|
|
84
|
+
const supportedNodeVersion = process.env.npm_package_engines_node || require('../package.json').engines.node;
|
|
85
|
+
if (!semver.satisfies(process.versions.node, supportedNodeVersion)) {
|
|
86
|
+
throw new Error(`Expected Node.js version ${supportedNodeVersion} but found ${process.versions.node}`);
|
|
85
87
|
}
|
|
88
|
+
|
|
86
89
|
// Download to per-process temporary file
|
|
87
90
|
const tarFilename = ['libvips', minimumLibvipsVersion, platformAndArch].join('-') + '.tar.br';
|
|
88
91
|
const tarPathCache = path.join(libvips.cachePath(), tarFilename);
|
package/lib/constructor.js
CHANGED
package/lib/output.js
CHANGED
|
@@ -658,6 +658,8 @@ function raw () {
|
|
|
658
658
|
* @param {number} [options.skipBlanks=-1] threshold to skip tile generation, a value 0 - 255 for 8-bit images or 0 - 65535 for 16-bit images
|
|
659
659
|
* @param {string} [options.container='fs'] tile container, with value `fs` (filesystem) or `zip` (compressed file).
|
|
660
660
|
* @param {string} [options.layout='dz'] filesystem layout, possible values are `dz`, `iiif`, `zoomify` or `google`.
|
|
661
|
+
* @param {boolean} [options.centre=false] centre image in tile.
|
|
662
|
+
* @param {boolean} [options.center=false] alternative spelling of centre.
|
|
661
663
|
* @returns {Sharp}
|
|
662
664
|
* @throws {Error} Invalid parameters
|
|
663
665
|
*/
|
|
@@ -726,6 +728,11 @@ function tile (options) {
|
|
|
726
728
|
} else if (is.defined(options.layout) && options.layout === 'google') {
|
|
727
729
|
this.options.tileSkipBlanks = 5;
|
|
728
730
|
}
|
|
731
|
+
// Center image in tile
|
|
732
|
+
const centre = is.bool(options.center) ? options.center : options.centre;
|
|
733
|
+
if (is.defined(centre)) {
|
|
734
|
+
this._setBooleanOption('tileCentre', centre);
|
|
735
|
+
}
|
|
729
736
|
}
|
|
730
737
|
// Format
|
|
731
738
|
if (is.inArray(this.options.formatOut, ['jpeg', 'png', 'webp'])) {
|
package/lib/resize.js
CHANGED
|
@@ -386,7 +386,8 @@ function extract (options) {
|
|
|
386
386
|
* Trim "boring" pixels from all edges that contain values similar to the top-left pixel.
|
|
387
387
|
* Images consisting entirely of a single colour will calculate "boring" using the alpha channel, if any.
|
|
388
388
|
*
|
|
389
|
-
* The `info` response Object
|
|
389
|
+
* The `info` response Object, obtained from callback of `.toFile()` or `.toBuffer()`,
|
|
390
|
+
* will contain `trimOffsetLeft` and `trimOffsetTop` properties.
|
|
390
391
|
*
|
|
391
392
|
* @param {number} [threshold=10] the allowed difference from the top-left pixel, a number greater than zero.
|
|
392
393
|
* @returns {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 and TIFF images",
|
|
4
|
-
"version": "0.26.
|
|
4
|
+
"version": "0.26.2",
|
|
5
5
|
"author": "Lovell Fuller <npm@lovell.info>",
|
|
6
6
|
"homepage": "https://github.com/lovell/sharp",
|
|
7
7
|
"contributors": [
|
package/src/common.cc
CHANGED
|
@@ -180,6 +180,7 @@ namespace sharp {
|
|
|
180
180
|
case ImageType::OPENSLIDE: id = "openslide"; break;
|
|
181
181
|
case ImageType::PPM: id = "ppm"; break;
|
|
182
182
|
case ImageType::FITS: id = "fits"; break;
|
|
183
|
+
case ImageType::EXR: id = "exr"; break;
|
|
183
184
|
case ImageType::VIPS: id = "vips"; break;
|
|
184
185
|
case ImageType::RAW: id = "raw"; break;
|
|
185
186
|
case ImageType::UNKNOWN: id = "unknown"; break;
|
|
@@ -210,6 +211,7 @@ namespace sharp {
|
|
|
210
211
|
{ "openslideload", ImageType::OPENSLIDE },
|
|
211
212
|
{ "ppmload", ImageType::PPM },
|
|
212
213
|
{ "fitsload", ImageType::FITS },
|
|
214
|
+
{ "openexrload", ImageType::EXR },
|
|
213
215
|
{ "vipsload", ImageType::VIPS },
|
|
214
216
|
{ "rawload", ImageType::RAW }
|
|
215
217
|
};
|
package/src/common.h
CHANGED
package/src/pipeline.cc
CHANGED
|
@@ -1014,6 +1014,7 @@ class PipelineWorker : public Napi::AsyncWorker {
|
|
|
1014
1014
|
->set("suffix", const_cast<char*>(suffix.data()))
|
|
1015
1015
|
->set("angle", CalculateAngleRotation(baton->tileAngle))
|
|
1016
1016
|
->set("background", baton->tileBackground)
|
|
1017
|
+
->set("centre", baton->tileCentre)
|
|
1017
1018
|
->set("skip_blanks", baton->tileSkipBlanks);
|
|
1018
1019
|
// libvips chooses a default depth based on layout. Instead of replicating that logic here by
|
|
1019
1020
|
// not passing anything - libvips will handle choice
|
|
@@ -1403,6 +1404,7 @@ Napi::Value pipeline(const Napi::CallbackInfo& info) {
|
|
|
1403
1404
|
baton->tileDepth = static_cast<VipsForeignDzDepth>(
|
|
1404
1405
|
vips_enum_from_nick(nullptr, VIPS_TYPE_FOREIGN_DZ_DEPTH,
|
|
1405
1406
|
sharp::AttrAsStr(options, "tileDepth").data()));
|
|
1407
|
+
baton->tileCentre = sharp::AttrAsBool(options, "tileCentre");
|
|
1406
1408
|
|
|
1407
1409
|
// Force random access for certain operations
|
|
1408
1410
|
if (baton->input->access == VIPS_ACCESS_SEQUENTIAL) {
|