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/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(1.0),
251
- linearB(0.0),
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
@@ -22,7 +22,6 @@
22
22
  #include "stats.h"
23
23
 
24
24
  static void* sharp_vips_init(void*) {
25
- g_setenv("VIPS_MIN_STACK_SIZE", "2m", FALSE);
26
25
  vips_init("sharp");
27
26
  return nullptr;
28
27
  }
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
- Napi::Boolean hasInputFile =
122
- Napi::Boolean::New(env, vips_type_find("VipsOperation", (f + "load").c_str()));
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()));