sharp 0.30.7 → 0.31.1
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 -2
- package/binding.gyp +4 -3
- package/lib/composite.js +14 -0
- package/lib/constructor.js +41 -4
- package/lib/input.js +92 -0
- package/lib/libvips.js +1 -0
- package/lib/operation.js +57 -12
- package/lib/output.js +89 -25
- package/lib/resize.js +86 -12
- package/lib/utility.js +4 -0
- package/package.json +24 -23
- package/src/common.cc +93 -44
- package/src/common.h +32 -14
- package/src/libvips/cplusplus/VConnection.cpp +0 -1
- package/src/libvips/cplusplus/VError.cpp +0 -1
- package/src/libvips/cplusplus/VImage.cpp +27 -2
- package/src/libvips/cplusplus/VInterpolate.cpp +0 -1
- package/src/libvips/cplusplus/VRegion.cpp +27 -0
- package/src/libvips/cplusplus/vips-operators.cpp +16 -1
- package/src/operations.cc +72 -25
- package/src/operations.h +7 -2
- package/src/pipeline.cc +165 -164
- package/src/pipeline.h +18 -5
- package/src/sharp.cc +0 -1
- package/src/utilities.cc +13 -2
package/src/pipeline.h
CHANGED
|
@@ -67,6 +67,7 @@ struct PipelineBaton {
|
|
|
67
67
|
int width;
|
|
68
68
|
int height;
|
|
69
69
|
int channels;
|
|
70
|
+
VipsKernel kernel;
|
|
70
71
|
sharp::Canvas canvas;
|
|
71
72
|
int position;
|
|
72
73
|
std::vector<double> resizeBackground;
|
|
@@ -75,7 +76,6 @@ struct PipelineBaton {
|
|
|
75
76
|
int cropOffsetTop;
|
|
76
77
|
bool premultiplied;
|
|
77
78
|
bool tileCentre;
|
|
78
|
-
std::string kernel;
|
|
79
79
|
bool fastShrinkOnLoad;
|
|
80
80
|
double tintA;
|
|
81
81
|
double tintB;
|
|
@@ -97,11 +97,12 @@ struct PipelineBaton {
|
|
|
97
97
|
double sharpenY3;
|
|
98
98
|
int threshold;
|
|
99
99
|
bool thresholdGrayscale;
|
|
100
|
+
std::vector<double> trimBackground;
|
|
100
101
|
double trimThreshold;
|
|
101
102
|
int trimOffsetLeft;
|
|
102
103
|
int trimOffsetTop;
|
|
103
|
-
double linearA;
|
|
104
|
-
double linearB;
|
|
104
|
+
std::vector<double> linearA;
|
|
105
|
+
std::vector<double> linearB;
|
|
105
106
|
double gamma;
|
|
106
107
|
double gammaOut;
|
|
107
108
|
bool greyscale;
|
|
@@ -157,9 +158,12 @@ struct PipelineBaton {
|
|
|
157
158
|
bool webpLossless;
|
|
158
159
|
bool webpSmartSubsample;
|
|
159
160
|
int webpEffort;
|
|
161
|
+
bool webpMinSize;
|
|
162
|
+
bool webpMixed;
|
|
160
163
|
int gifBitdepth;
|
|
161
164
|
int gifEffort;
|
|
162
165
|
double gifDither;
|
|
166
|
+
bool gifReoptimise;
|
|
163
167
|
int tiffQuality;
|
|
164
168
|
VipsForeignTiffCompression tiffCompression;
|
|
165
169
|
VipsForeignTiffPredictor tiffPredictor;
|
|
@@ -209,6 +213,7 @@ struct PipelineBaton {
|
|
|
209
213
|
int tileSkipBlanks;
|
|
210
214
|
VipsForeignDzDepth tileDepth;
|
|
211
215
|
std::string tileId;
|
|
216
|
+
std::string tileBasename;
|
|
212
217
|
std::unique_ptr<double[]> recombMatrix;
|
|
213
218
|
|
|
214
219
|
PipelineBaton():
|
|
@@ -217,6 +222,7 @@ struct PipelineBaton {
|
|
|
217
222
|
topOffsetPre(-1),
|
|
218
223
|
topOffsetPost(-1),
|
|
219
224
|
channels(0),
|
|
225
|
+
kernel(VIPS_KERNEL_LANCZOS3),
|
|
220
226
|
canvas(sharp::Canvas::CROP),
|
|
221
227
|
position(0),
|
|
222
228
|
resizeBackground{ 0.0, 0.0, 0.0, 255.0 },
|
|
@@ -244,11 +250,12 @@ struct PipelineBaton {
|
|
|
244
250
|
sharpenY3(20.0),
|
|
245
251
|
threshold(0),
|
|
246
252
|
thresholdGrayscale(true),
|
|
253
|
+
trimBackground{},
|
|
247
254
|
trimThreshold(0.0),
|
|
248
255
|
trimOffsetLeft(0),
|
|
249
256
|
trimOffsetTop(0),
|
|
250
|
-
linearA
|
|
251
|
-
linearB
|
|
257
|
+
linearA{},
|
|
258
|
+
linearB{},
|
|
252
259
|
gamma(0.0),
|
|
253
260
|
greyscale(false),
|
|
254
261
|
normalise(false),
|
|
@@ -302,6 +309,12 @@ struct PipelineBaton {
|
|
|
302
309
|
webpLossless(false),
|
|
303
310
|
webpSmartSubsample(false),
|
|
304
311
|
webpEffort(4),
|
|
312
|
+
webpMinSize(false),
|
|
313
|
+
webpMixed(false),
|
|
314
|
+
gifBitdepth(8),
|
|
315
|
+
gifEffort(7),
|
|
316
|
+
gifDither(1.0),
|
|
317
|
+
gifReoptimise(false),
|
|
305
318
|
tiffQuality(80),
|
|
306
319
|
tiffCompression(VIPS_FOREIGN_TIFF_COMPRESSION_JPEG),
|
|
307
320
|
tiffPredictor(VIPS_FOREIGN_TIFF_PREDICTOR_HORIZONTAL),
|
package/src/sharp.cc
CHANGED
package/src/utilities.cc
CHANGED
|
@@ -118,14 +118,25 @@ Napi::Value format(const Napi::CallbackInfo& info) {
|
|
|
118
118
|
"ppm", "fits", "gif", "svg", "heif", "pdf", "vips", "jp2k"
|
|
119
119
|
}) {
|
|
120
120
|
// Input
|
|
121
|
-
|
|
122
|
-
|
|
121
|
+
const VipsObjectClass *oc = vips_class_find("VipsOperation", (f + "load").c_str());
|
|
122
|
+
Napi::Boolean hasInputFile = Napi::Boolean::New(env, oc);
|
|
123
123
|
Napi::Boolean hasInputBuffer =
|
|
124
124
|
Napi::Boolean::New(env, vips_type_find("VipsOperation", (f + "load_buffer").c_str()));
|
|
125
125
|
Napi::Object input = Napi::Object::New(env);
|
|
126
126
|
input.Set("file", hasInputFile);
|
|
127
127
|
input.Set("buffer", hasInputBuffer);
|
|
128
128
|
input.Set("stream", hasInputBuffer);
|
|
129
|
+
if (hasInputFile) {
|
|
130
|
+
const VipsForeignClass *fc = VIPS_FOREIGN_CLASS(oc);
|
|
131
|
+
if (fc->suffs) {
|
|
132
|
+
Napi::Array fileSuffix = Napi::Array::New(env);
|
|
133
|
+
const char **suffix = fc->suffs;
|
|
134
|
+
for (int i = 0; *suffix; i++, suffix++) {
|
|
135
|
+
fileSuffix.Set(i, Napi::String::New(env, *suffix));
|
|
136
|
+
}
|
|
137
|
+
input.Set("fileSuffix", fileSuffix);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
129
140
|
// Output
|
|
130
141
|
Napi::Boolean hasOutputFile =
|
|
131
142
|
Napi::Boolean::New(env, vips_type_find("VipsOperation", (f + "save").c_str()));
|