sharp 0.31.3 → 0.32.0
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 +1 -1
- package/binding.gyp +1 -1
- package/install/can-compile.js +3 -0
- package/install/dll-copy.js +3 -0
- package/install/libvips.js +3 -4
- package/lib/agent.js +3 -0
- package/lib/channel.js +3 -0
- package/lib/colour.js +3 -0
- package/lib/composite.js +3 -0
- package/lib/constructor.js +16 -8
- package/lib/index.d.ts +1614 -0
- package/lib/index.js +3 -0
- package/lib/input.js +32 -6
- package/lib/is.js +12 -0
- package/lib/libvips.js +4 -0
- package/lib/operation.js +75 -35
- package/lib/output.js +17 -8
- package/lib/platform.js +3 -0
- package/lib/resize.js +52 -19
- package/lib/sharp.js +3 -0
- package/lib/utility.js +5 -1
- package/package.json +28 -21
- package/src/common.cc +29 -14
- package/src/common.h +19 -16
- package/src/libvips/cplusplus/vips-operators.cpp +7 -0
- package/src/metadata.cc +12 -17
- package/src/metadata.h +3 -13
- package/src/operations.cc +11 -21
- package/src/operations.h +4 -15
- package/src/pipeline.cc +72 -49
- package/src/pipeline.h +18 -15
- package/src/sharp.cc +2 -13
- package/src/stats.cc +6 -17
- package/src/stats.h +2 -13
- package/src/utilities.cc +16 -27
- package/src/utilities.h +2 -13
package/README.md
CHANGED
|
@@ -102,7 +102,7 @@ covers reporting bugs, requesting features and submitting code changes.
|
|
|
102
102
|
|
|
103
103
|
## Licensing
|
|
104
104
|
|
|
105
|
-
Copyright 2013
|
|
105
|
+
Copyright 2013 Lovell Fuller and others.
|
|
106
106
|
|
|
107
107
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
108
108
|
you may not use this file except in compliance with the License.
|
package/binding.gyp
CHANGED
|
@@ -179,7 +179,7 @@
|
|
|
179
179
|
],
|
|
180
180
|
'xcode_settings': {
|
|
181
181
|
'CLANG_CXX_LANGUAGE_STANDARD': 'c++11',
|
|
182
|
-
'MACOSX_DEPLOYMENT_TARGET': '10.
|
|
182
|
+
'MACOSX_DEPLOYMENT_TARGET': '10.13',
|
|
183
183
|
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
|
|
184
184
|
'GCC_ENABLE_CPP_RTTI': 'YES',
|
|
185
185
|
'OTHER_CPLUSPLUSFLAGS': [
|
package/install/can-compile.js
CHANGED
package/install/dll-copy.js
CHANGED
package/install/libvips.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// Copyright 2013 Lovell Fuller and others.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
1
4
|
'use strict';
|
|
2
5
|
|
|
3
6
|
const fs = require('fs');
|
|
@@ -128,9 +131,6 @@ try {
|
|
|
128
131
|
if (arch === 'ia32' && !platformAndArch.startsWith('win32')) {
|
|
129
132
|
throw new Error(`Intel Architecture 32-bit systems require manual installation of libvips >= ${minimumLibvipsVersion}`);
|
|
130
133
|
}
|
|
131
|
-
if (platformAndArch === 'darwin-arm64') {
|
|
132
|
-
throw new Error("Please run 'brew install vips' to install libvips on Apple M1 (ARM64) systems");
|
|
133
|
-
}
|
|
134
134
|
if (platformAndArch === 'freebsd-x64' || platformAndArch === 'openbsd-x64' || platformAndArch === 'sunos-x64') {
|
|
135
135
|
throw new Error(`BSD/SunOS systems require manual installation of libvips >= ${minimumLibvipsVersion}`);
|
|
136
136
|
}
|
|
@@ -153,7 +153,6 @@ try {
|
|
|
153
153
|
if (!semverSatisfies(process.versions.node, supportedNodeVersion)) {
|
|
154
154
|
handleError(new Error(`Expected Node.js version ${supportedNodeVersion} but found ${process.versions.node}`));
|
|
155
155
|
}
|
|
156
|
-
|
|
157
156
|
// Download to per-process temporary file
|
|
158
157
|
const tarFilename = ['libvips', minimumLibvipsVersionLabelled, platformAndArch].join('-') + '.tar.br';
|
|
159
158
|
const tarPathCache = path.join(libvips.cachePath(), tarFilename);
|
package/lib/agent.js
CHANGED
package/lib/channel.js
CHANGED
package/lib/colour.js
CHANGED
package/lib/composite.js
CHANGED
package/lib/constructor.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// Copyright 2013 Lovell Fuller and others.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
1
4
|
'use strict';
|
|
2
5
|
|
|
3
6
|
const util = require('util');
|
|
@@ -113,8 +116,8 @@ const debuglog = util.debuglog('sharp');
|
|
|
113
116
|
* }
|
|
114
117
|
* }).toFile('text_rgba.png');
|
|
115
118
|
*
|
|
116
|
-
* @param {(Buffer|Uint8Array|Uint8ClampedArray|Int8Array|Uint16Array|Int16Array|Uint32Array|Int32Array|Float32Array|Float64Array|string)} [input] - if present, can be
|
|
117
|
-
* a Buffer / Uint8Array / Uint8ClampedArray containing JPEG, PNG, WebP, AVIF, GIF, SVG or TIFF image data, or
|
|
119
|
+
* @param {(Buffer|ArrayBuffer|Uint8Array|Uint8ClampedArray|Int8Array|Uint16Array|Int16Array|Uint32Array|Int32Array|Float32Array|Float64Array|string)} [input] - if present, can be
|
|
120
|
+
* a Buffer / ArrayBuffer / Uint8Array / Uint8ClampedArray containing JPEG, PNG, WebP, AVIF, GIF, SVG or TIFF image data, or
|
|
118
121
|
* a TypedArray containing raw pixel image data, or
|
|
119
122
|
* a String containing the filesystem path to an JPEG, PNG, WebP, AVIF, GIF, SVG or TIFF image file.
|
|
120
123
|
* JPEG, PNG, WebP, AVIF, GIF, SVG, TIFF or raw pixel image data can be streamed into the object when not present.
|
|
@@ -124,14 +127,14 @@ const debuglog = util.debuglog('sharp');
|
|
|
124
127
|
* (width x height) exceeds this limit. Assumes image dimensions contained in the input metadata can be trusted.
|
|
125
128
|
* An integral Number of pixels, zero or false to remove limit, true to use default limit of 268402689 (0x3FFF x 0x3FFF).
|
|
126
129
|
* @param {boolean} [options.unlimited=false] - Set this to `true` to remove safety features that help prevent memory exhaustion (JPEG, PNG, SVG, HEIF).
|
|
127
|
-
* @param {boolean} [options.sequentialRead=
|
|
128
|
-
* This can reduce memory usage and might improve performance on some systems.
|
|
130
|
+
* @param {boolean} [options.sequentialRead=true] - Set this to `false` to use random access rather than sequential read. Some operations will do this automatically.
|
|
129
131
|
* @param {number} [options.density=72] - number representing the DPI for vector images in the range 1 to 100000.
|
|
130
|
-
* @param {number} [options.
|
|
131
|
-
* @param {number} [options.
|
|
132
|
+
* @param {number} [options.ignoreIcc=false] - should the embedded ICC profile, if any, be ignored.
|
|
133
|
+
* @param {number} [options.pages=1] - Number of pages to extract for multi-page input (GIF, WebP, TIFF), use -1 for all pages.
|
|
134
|
+
* @param {number} [options.page=0] - Page number to start extracting from for multi-page input (GIF, WebP, TIFF), zero based.
|
|
132
135
|
* @param {number} [options.subifd=-1] - subIFD (Sub Image File Directory) to extract for OME-TIFF, defaults to main image.
|
|
133
136
|
* @param {number} [options.level=0] - level to extract from a multi-level input (OpenSlide), zero based.
|
|
134
|
-
* @param {boolean} [options.animated=false] - Set to `true` to read all frames/pages of an animated image (equivalent of setting `pages` to `-1
|
|
137
|
+
* @param {boolean} [options.animated=false] - Set to `true` to read all frames/pages of an animated image (GIF, WebP, TIFF), equivalent of setting `pages` to `-1`.
|
|
135
138
|
* @param {Object} [options.raw] - describes raw pixel input image data. See `raw()` for pixel ordering.
|
|
136
139
|
* @param {number} [options.raw.width] - integral number of pixels wide.
|
|
137
140
|
* @param {number} [options.raw.height] - integral number of pixels high.
|
|
@@ -158,6 +161,7 @@ const debuglog = util.debuglog('sharp');
|
|
|
158
161
|
* @param {number} [options.text.dpi=72] - the resolution (size) at which to render the text. Does not take effect if `height` is specified.
|
|
159
162
|
* @param {boolean} [options.text.rgba=false] - set this to true to enable RGBA output. This is useful for colour emoji rendering, or support for pango markup features like `<span foreground="red">Red!</span>`.
|
|
160
163
|
* @param {number} [options.text.spacing=0] - text line height in points. Will use the font line height if none is specified.
|
|
164
|
+
* @param {string} [options.text.wrap='word'] - word wrapping style when width is provided, one of: 'word', 'char', 'charWord' (prefer char, fallback to word) or 'none'.
|
|
161
165
|
* @returns {Sharp}
|
|
162
166
|
* @throws {Error} Invalid parameters
|
|
163
167
|
*/
|
|
@@ -196,6 +200,7 @@ const Sharp = function (input, options) {
|
|
|
196
200
|
extendLeft: 0,
|
|
197
201
|
extendRight: 0,
|
|
198
202
|
extendBackground: [0, 0, 0, 255],
|
|
203
|
+
extendWith: 'background',
|
|
199
204
|
withoutEnlargement: false,
|
|
200
205
|
withoutReduction: false,
|
|
201
206
|
affineMatrix: [],
|
|
@@ -230,6 +235,8 @@ const Sharp = function (input, options) {
|
|
|
230
235
|
gammaOut: 0,
|
|
231
236
|
greyscale: false,
|
|
232
237
|
normalise: false,
|
|
238
|
+
normaliseLower: 1,
|
|
239
|
+
normaliseUpper: 99,
|
|
233
240
|
claheWidth: 0,
|
|
234
241
|
claheHeight: 0,
|
|
235
242
|
claheMaxSlope: 3,
|
|
@@ -291,7 +298,8 @@ const Sharp = function (input, options) {
|
|
|
291
298
|
gifDither: 1,
|
|
292
299
|
gifInterFrameMaxError: 0,
|
|
293
300
|
gifInterPaletteMaxError: 3,
|
|
294
|
-
|
|
301
|
+
gifReuse: true,
|
|
302
|
+
gifProgressive: false,
|
|
295
303
|
tiffQuality: 80,
|
|
296
304
|
tiffCompression: 'jpeg',
|
|
297
305
|
tiffPredictor: 'horizontal',
|