sharp 0.35.5-rc.0 → 0.35.5
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/package.json +32 -32
- package/src/binding.gyp +1 -1
- package/src/common.h +2 -2
- package/src/pipeline.cc +31 -6
- package/src/utilities.cc +1 -1
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.35.5
|
|
4
|
+
"version": "0.35.5",
|
|
5
5
|
"author": "Lovell Fuller <npm@lovell.info>",
|
|
6
6
|
"homepage": "https://sharp.pixelplumbing.com",
|
|
7
7
|
"contributors": [
|
|
@@ -163,31 +163,31 @@
|
|
|
163
163
|
"semver": "^7.8.5"
|
|
164
164
|
},
|
|
165
165
|
"optionalDependencies": {
|
|
166
|
-
"@img/sharp-darwin-arm64": "0.35.5
|
|
167
|
-
"@img/sharp-darwin-x64": "0.35.5
|
|
168
|
-
"@img/sharp-freebsd-wasm32": "0.35.5
|
|
169
|
-
"@img/sharp-libvips-darwin-arm64": "1.3.4
|
|
170
|
-
"@img/sharp-libvips-darwin-x64": "1.3.4
|
|
171
|
-
"@img/sharp-libvips-linux-arm": "1.3.4
|
|
172
|
-
"@img/sharp-libvips-linux-arm64": "1.3.4
|
|
173
|
-
"@img/sharp-libvips-linux-ppc64": "1.3.4
|
|
174
|
-
"@img/sharp-libvips-linux-riscv64": "1.3.4
|
|
175
|
-
"@img/sharp-libvips-linux-s390x": "1.3.4
|
|
176
|
-
"@img/sharp-libvips-linux-x64": "1.3.4
|
|
177
|
-
"@img/sharp-libvips-linuxmusl-arm64": "1.3.4
|
|
178
|
-
"@img/sharp-libvips-linuxmusl-x64": "1.3.4
|
|
179
|
-
"@img/sharp-linux-arm": "0.35.5
|
|
180
|
-
"@img/sharp-linux-arm64": "0.35.5
|
|
181
|
-
"@img/sharp-linux-ppc64": "0.35.5
|
|
182
|
-
"@img/sharp-linux-riscv64": "0.35.5
|
|
183
|
-
"@img/sharp-linux-s390x": "0.35.5
|
|
184
|
-
"@img/sharp-linux-x64": "0.35.5
|
|
185
|
-
"@img/sharp-linuxmusl-arm64": "0.35.5
|
|
186
|
-
"@img/sharp-linuxmusl-x64": "0.35.5
|
|
187
|
-
"@img/sharp-webcontainers-wasm32": "0.35.5
|
|
188
|
-
"@img/sharp-win32-arm64": "0.35.5
|
|
189
|
-
"@img/sharp-win32-ia32": "0.35.5
|
|
190
|
-
"@img/sharp-win32-x64": "0.35.5
|
|
166
|
+
"@img/sharp-darwin-arm64": "0.35.5",
|
|
167
|
+
"@img/sharp-darwin-x64": "0.35.5",
|
|
168
|
+
"@img/sharp-freebsd-wasm32": "0.35.5",
|
|
169
|
+
"@img/sharp-libvips-darwin-arm64": "1.3.4",
|
|
170
|
+
"@img/sharp-libvips-darwin-x64": "1.3.4",
|
|
171
|
+
"@img/sharp-libvips-linux-arm": "1.3.4",
|
|
172
|
+
"@img/sharp-libvips-linux-arm64": "1.3.4",
|
|
173
|
+
"@img/sharp-libvips-linux-ppc64": "1.3.4",
|
|
174
|
+
"@img/sharp-libvips-linux-riscv64": "1.3.4",
|
|
175
|
+
"@img/sharp-libvips-linux-s390x": "1.3.4",
|
|
176
|
+
"@img/sharp-libvips-linux-x64": "1.3.4",
|
|
177
|
+
"@img/sharp-libvips-linuxmusl-arm64": "1.3.4",
|
|
178
|
+
"@img/sharp-libvips-linuxmusl-x64": "1.3.4",
|
|
179
|
+
"@img/sharp-linux-arm": "0.35.5",
|
|
180
|
+
"@img/sharp-linux-arm64": "0.35.5",
|
|
181
|
+
"@img/sharp-linux-ppc64": "0.35.5",
|
|
182
|
+
"@img/sharp-linux-riscv64": "0.35.5",
|
|
183
|
+
"@img/sharp-linux-s390x": "0.35.5",
|
|
184
|
+
"@img/sharp-linux-x64": "0.35.5",
|
|
185
|
+
"@img/sharp-linuxmusl-arm64": "0.35.5",
|
|
186
|
+
"@img/sharp-linuxmusl-x64": "0.35.5",
|
|
187
|
+
"@img/sharp-webcontainers-wasm32": "0.35.5",
|
|
188
|
+
"@img/sharp-win32-arm64": "0.35.5",
|
|
189
|
+
"@img/sharp-win32-ia32": "0.35.5",
|
|
190
|
+
"@img/sharp-win32-x64": "0.35.5"
|
|
191
191
|
},
|
|
192
192
|
"peerDependenciesMeta": {
|
|
193
193
|
"@types/node": {
|
|
@@ -198,11 +198,11 @@
|
|
|
198
198
|
"@biomejs/biome": "^2.5.14",
|
|
199
199
|
"@cpplint/cli": "^0.1.0",
|
|
200
200
|
"@emnapi/runtime": "^1.11.3",
|
|
201
|
-
"@img/sharp-libvips-dev": "1.3.4
|
|
202
|
-
"@img/sharp-libvips-dev-wasm32": "1.3.4
|
|
203
|
-
"@img/sharp-libvips-win32-arm64": "1.3.4
|
|
204
|
-
"@img/sharp-libvips-win32-ia32": "1.3.4
|
|
205
|
-
"@img/sharp-libvips-win32-x64": "1.3.4
|
|
201
|
+
"@img/sharp-libvips-dev": "1.3.4",
|
|
202
|
+
"@img/sharp-libvips-dev-wasm32": "1.3.4",
|
|
203
|
+
"@img/sharp-libvips-win32-arm64": "1.3.4",
|
|
204
|
+
"@img/sharp-libvips-win32-ia32": "1.3.4",
|
|
205
|
+
"@img/sharp-libvips-win32-x64": "1.3.4",
|
|
206
206
|
"@types/node": "*",
|
|
207
207
|
"emnapi": "^1.11.3",
|
|
208
208
|
"exif-reader": "^2.0.3",
|
|
@@ -219,7 +219,7 @@
|
|
|
219
219
|
"node": ">=20.9.0"
|
|
220
220
|
},
|
|
221
221
|
"config": {
|
|
222
|
-
"libvips": ">=8.18.
|
|
222
|
+
"libvips": ">=8.18.7"
|
|
223
223
|
},
|
|
224
224
|
"funding": {
|
|
225
225
|
"url": "https://opencollective.com/libvips"
|
package/src/binding.gyp
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Copyright 2013 Lovell Fuller and others.
|
|
2
2
|
# SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
{
|
|
4
|
+
{ # noqa: B018
|
|
5
5
|
'variables': {
|
|
6
6
|
'vips_version': '<!(node -p "require(\'../dist/libvips.cjs\').minimumLibvipsVersion")',
|
|
7
7
|
'platform_and_arch': '<!(node -p "require(\'../dist/libvips.cjs\').buildPlatformArch()")',
|
package/src/common.h
CHANGED
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
|
|
20
20
|
#if (VIPS_MAJOR_VERSION < 8) || \
|
|
21
21
|
(VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION < 18) || \
|
|
22
|
-
(VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION == 18 && VIPS_MICRO_VERSION <
|
|
23
|
-
#error "libvips version 8.18.
|
|
22
|
+
(VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION == 18 && VIPS_MICRO_VERSION < 7)
|
|
23
|
+
#error "libvips version 8.18.7+ is required - please see https://sharp.pixelplumbing.com/install"
|
|
24
24
|
#endif
|
|
25
25
|
|
|
26
26
|
#if defined(__has_include)
|
package/src/pipeline.cc
CHANGED
|
@@ -56,9 +56,9 @@ class PipelineWorker : public Napi::AsyncWorker {
|
|
|
56
56
|
hasAlpha |= image.has_alpha();
|
|
57
57
|
}
|
|
58
58
|
if (hasAlpha) {
|
|
59
|
-
for (
|
|
60
|
-
if (!
|
|
61
|
-
|
|
59
|
+
for (size_t i = 0; i < images.size(); i++) {
|
|
60
|
+
if (!images[i].has_alpha()) {
|
|
61
|
+
images[i] = sharp::EnsureAlpha(images[i], 1);
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
} else {
|
|
@@ -94,7 +94,10 @@ class PipelineWorker : public Napi::AsyncWorker {
|
|
|
94
94
|
// Calculate angle of rotation
|
|
95
95
|
VipsAngle rotation = VIPS_ANGLE_D0;
|
|
96
96
|
VipsAngle autoRotation = VIPS_ANGLE_D0;
|
|
97
|
+
VipsAngle gainMapRotation = VIPS_ANGLE_D0;
|
|
97
98
|
bool autoFlop = false;
|
|
99
|
+
bool gainMapFlip = false;
|
|
100
|
+
bool gainMapFlop = false;
|
|
98
101
|
|
|
99
102
|
if (baton->input->autoOrient) {
|
|
100
103
|
// Rotate and flip image according to Exif orientation
|
|
@@ -115,11 +118,13 @@ class PipelineWorker : public Napi::AsyncWorker {
|
|
|
115
118
|
MultiPageUnsupported(nPages, "Rotate");
|
|
116
119
|
}
|
|
117
120
|
image = image.rot(autoRotation);
|
|
121
|
+
gainMapRotation = autoRotation;
|
|
118
122
|
autoRotation = VIPS_ANGLE_D0;
|
|
119
123
|
}
|
|
120
124
|
if (autoFlop) {
|
|
121
125
|
image = image.flip(VIPS_DIRECTION_HORIZONTAL);
|
|
122
126
|
autoFlop = false;
|
|
127
|
+
gainMapFlop = true;
|
|
123
128
|
}
|
|
124
129
|
}
|
|
125
130
|
|
|
@@ -128,20 +133,24 @@ class PipelineWorker : public Napi::AsyncWorker {
|
|
|
128
133
|
if (baton->flip) {
|
|
129
134
|
image = image.flip(VIPS_DIRECTION_VERTICAL);
|
|
130
135
|
baton->flip = false;
|
|
136
|
+
gainMapFlip = true;
|
|
131
137
|
}
|
|
132
138
|
if (baton->flop) {
|
|
133
139
|
image = image.flip(VIPS_DIRECTION_HORIZONTAL);
|
|
134
140
|
baton->flop = false;
|
|
141
|
+
gainMapFlop = true;
|
|
135
142
|
}
|
|
136
143
|
if (rotation != VIPS_ANGLE_D0) {
|
|
137
144
|
if (rotation != VIPS_ANGLE_D180) {
|
|
138
145
|
MultiPageUnsupported(nPages, "Rotate");
|
|
139
146
|
}
|
|
140
147
|
image = image.rot(rotation);
|
|
148
|
+
gainMapRotation = rotation;
|
|
141
149
|
rotation = VIPS_ANGLE_D0;
|
|
142
150
|
}
|
|
143
151
|
if (baton->rotationAngle != 0.0) {
|
|
144
152
|
MultiPageUnsupported(nPages, "Rotate");
|
|
153
|
+
KeepGainMapUnsupported(baton->keepGainMap, "Rotate");
|
|
145
154
|
std::vector<double> background;
|
|
146
155
|
std::tie(image, background) = sharp::ApplyAlpha(image, baton->rotationBackground, false);
|
|
147
156
|
image = image.rotate(baton->rotationAngle, VImage::option()->set("background", background)).copy_memory();
|
|
@@ -152,6 +161,7 @@ class PipelineWorker : public Napi::AsyncWorker {
|
|
|
152
161
|
// Trim
|
|
153
162
|
if (baton->trimThreshold >= 0.0) {
|
|
154
163
|
MultiPageUnsupported(nPages, "Trim");
|
|
164
|
+
KeepGainMapUnsupported(baton->keepGainMap, "Trim");
|
|
155
165
|
image = sharp::StaySequential(image);
|
|
156
166
|
image = sharp::Trim(image, baton->trimBackground, baton->trimThreshold, baton->trimLineArt, baton->trimMargin);
|
|
157
167
|
baton->trimOffsetLeft = image.xoffset();
|
|
@@ -306,6 +316,20 @@ class PipelineWorker : public Napi::AsyncWorker {
|
|
|
306
316
|
if (image.get_typeof("gainmap-scale-factor") == G_TYPE_INT) {
|
|
307
317
|
gainMapScaleFactor = image.get_int("gainmap-scale-factor");
|
|
308
318
|
}
|
|
319
|
+
if (gainMapFlip) {
|
|
320
|
+
gainMap = gainMap.flip(VIPS_DIRECTION_VERTICAL);
|
|
321
|
+
}
|
|
322
|
+
if (gainMapFlop) {
|
|
323
|
+
gainMap = gainMap.flip(VIPS_DIRECTION_HORIZONTAL);
|
|
324
|
+
}
|
|
325
|
+
if (gainMapRotation != VIPS_ANGLE_D0) {
|
|
326
|
+
gainMap = gainMap.rot(gainMapRotation);
|
|
327
|
+
}
|
|
328
|
+
if (baton->topOffsetPre != -1) {
|
|
329
|
+
gainMap = gainMap.extract_area(
|
|
330
|
+
baton->leftOffsetPre / gainMapScaleFactor, baton->topOffsetPre / gainMapScaleFactor,
|
|
331
|
+
baton->widthPre / gainMapScaleFactor, baton->heightPre / gainMapScaleFactor);
|
|
332
|
+
}
|
|
309
333
|
} else if (baton->withGainMap) {
|
|
310
334
|
image = image.uhdr2scRGB();
|
|
311
335
|
}
|
|
@@ -429,14 +453,14 @@ class PipelineWorker : public Napi::AsyncWorker {
|
|
|
429
453
|
}
|
|
430
454
|
image = image.rot(autoRotation);
|
|
431
455
|
if (baton->keepGainMap) {
|
|
432
|
-
gainMap = gainMap.rot(autoRotation);
|
|
456
|
+
gainMap = sharp::StaySequential(gainMap).rot(autoRotation);
|
|
433
457
|
}
|
|
434
458
|
}
|
|
435
459
|
// Mirror vertically (up-down) about the x-axis
|
|
436
460
|
if (baton->flip) {
|
|
437
461
|
image = image.flip(VIPS_DIRECTION_VERTICAL);
|
|
438
462
|
if (baton->keepGainMap) {
|
|
439
|
-
gainMap = gainMap.flip(VIPS_DIRECTION_VERTICAL);
|
|
463
|
+
gainMap = sharp::StaySequential(gainMap).flip(VIPS_DIRECTION_VERTICAL);
|
|
440
464
|
}
|
|
441
465
|
}
|
|
442
466
|
// Mirror horizontally (left-right) about the y-axis
|
|
@@ -453,7 +477,7 @@ class PipelineWorker : public Napi::AsyncWorker {
|
|
|
453
477
|
}
|
|
454
478
|
image = image.rot(rotation);
|
|
455
479
|
if (baton->keepGainMap) {
|
|
456
|
-
gainMap = gainMap.rot(rotation);
|
|
480
|
+
gainMap = sharp::StaySequential(gainMap).rot(rotation);
|
|
457
481
|
}
|
|
458
482
|
}
|
|
459
483
|
|
|
@@ -557,6 +581,7 @@ class PipelineWorker : public Napi::AsyncWorker {
|
|
|
557
581
|
// Rotate post-extract non-90 angle
|
|
558
582
|
if (!baton->rotateBefore && baton->rotationAngle != 0.0) {
|
|
559
583
|
MultiPageUnsupported(nPages, "Rotate");
|
|
584
|
+
KeepGainMapUnsupported(baton->keepGainMap, "Rotate");
|
|
560
585
|
image = sharp::StaySequential(image);
|
|
561
586
|
std::vector<double> background;
|
|
562
587
|
std::tie(image, background) = sharp::ApplyAlpha(image, baton->rotationBackground, shouldPremultiplyAlpha);
|
package/src/utilities.cc
CHANGED
|
@@ -133,7 +133,7 @@ Napi::Value format(const Napi::CallbackInfo& info) {
|
|
|
133
133
|
input.Set("file", hasInputFile);
|
|
134
134
|
input.Set("buffer", hasInputBuffer);
|
|
135
135
|
input.Set("stream", hasInputBuffer);
|
|
136
|
-
if (
|
|
136
|
+
if (oc) {
|
|
137
137
|
const VipsForeignClass *fc = VIPS_FOREIGN_CLASS(oc);
|
|
138
138
|
if (fc->suffs) {
|
|
139
139
|
Napi::Array fileSuffix = Napi::Array::New(env);
|