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/src/common.cc
CHANGED
|
@@ -1,16 +1,5 @@
|
|
|
1
|
-
// Copyright 2013
|
|
2
|
-
//
|
|
3
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
// you may not use this file except in compliance with the License.
|
|
5
|
-
// You may obtain a copy of the License at
|
|
6
|
-
//
|
|
7
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
//
|
|
9
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
// See the License for the specific language governing permissions and
|
|
13
|
-
// limitations under the License.
|
|
1
|
+
// Copyright 2013 Lovell Fuller and others.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
14
3
|
|
|
15
4
|
#include <cstdlib>
|
|
16
5
|
#include <string>
|
|
@@ -79,7 +68,9 @@ namespace sharp {
|
|
|
79
68
|
Napi::Buffer<char> NewOrCopyBuffer(Napi::Env env, char* data, size_t len) {
|
|
80
69
|
try {
|
|
81
70
|
return Napi::Buffer<char>::New(env, data, len, FreeCallback);
|
|
82
|
-
} catch (Napi::Error const &err) {
|
|
71
|
+
} catch (Napi::Error const &err) {
|
|
72
|
+
static_cast<void>(err);
|
|
73
|
+
}
|
|
83
74
|
Napi::Buffer<char> buf = Napi::Buffer<char>::Copy(env, data, len);
|
|
84
75
|
FreeCallback(nullptr, data);
|
|
85
76
|
return buf;
|
|
@@ -101,6 +92,10 @@ namespace sharp {
|
|
|
101
92
|
if (HasAttr(input, "density")) {
|
|
102
93
|
descriptor->density = AttrAsDouble(input, "density");
|
|
103
94
|
}
|
|
95
|
+
// Should we ignore any embedded ICC profile
|
|
96
|
+
if (HasAttr(input, "ignoreIcc")) {
|
|
97
|
+
descriptor->ignoreIcc = AttrAsBool(input, "ignoreIcc");
|
|
98
|
+
}
|
|
104
99
|
// Raw pixel input
|
|
105
100
|
if (HasAttr(input, "rawChannels")) {
|
|
106
101
|
descriptor->rawDepth = AttrAsEnum<VipsBandFormat>(input, "rawDepth", VIPS_TYPE_BAND_FORMAT);
|
|
@@ -167,6 +162,9 @@ namespace sharp {
|
|
|
167
162
|
if (HasAttr(input, "textSpacing")) {
|
|
168
163
|
descriptor->textSpacing = AttrAsUint32(input, "textSpacing");
|
|
169
164
|
}
|
|
165
|
+
if (HasAttr(input, "textWrap")) {
|
|
166
|
+
descriptor->textWrap = AttrAsEnum<VipsTextWrap>(input, "textWrap", VIPS_TYPE_TEXT_WRAP);
|
|
167
|
+
}
|
|
170
168
|
}
|
|
171
169
|
// Limit input images to a given number of pixels, where pixels = width * height
|
|
172
170
|
descriptor->limitInputPixels = static_cast<uint64_t>(AttrAsInt64(input, "limitInputPixels"));
|
|
@@ -228,6 +226,13 @@ namespace sharp {
|
|
|
228
226
|
return EndsWith(str, ".v") || EndsWith(str, ".V") || EndsWith(str, ".vips") || EndsWith(str, ".VIPS");
|
|
229
227
|
}
|
|
230
228
|
|
|
229
|
+
/*
|
|
230
|
+
Trim space from end of string.
|
|
231
|
+
*/
|
|
232
|
+
std::string TrimEnd(std::string const &str) {
|
|
233
|
+
return str.substr(0, str.find_last_not_of(" \n\r\f") + 1);
|
|
234
|
+
}
|
|
235
|
+
|
|
231
236
|
/*
|
|
232
237
|
Provide a string identifier for the given image type.
|
|
233
238
|
*/
|
|
@@ -454,6 +459,7 @@ namespace sharp {
|
|
|
454
459
|
->set("justify", descriptor->textJustify)
|
|
455
460
|
->set("rgba", descriptor->textRgba)
|
|
456
461
|
->set("spacing", descriptor->textSpacing)
|
|
462
|
+
->set("wrap", descriptor->textWrap)
|
|
457
463
|
->set("autofit_dpi", &descriptor->textAutofitDpi);
|
|
458
464
|
if (descriptor->textWidth > 0) {
|
|
459
465
|
textOptions->set("width", descriptor->textWidth);
|
|
@@ -612,6 +618,15 @@ namespace sharp {
|
|
|
612
618
|
return copy;
|
|
613
619
|
}
|
|
614
620
|
|
|
621
|
+
/*
|
|
622
|
+
Remove GIF palette from image.
|
|
623
|
+
*/
|
|
624
|
+
VImage RemoveGifPalette(VImage image) {
|
|
625
|
+
VImage copy = image.copy();
|
|
626
|
+
copy.remove("gif-palette");
|
|
627
|
+
return copy;
|
|
628
|
+
}
|
|
629
|
+
|
|
615
630
|
/*
|
|
616
631
|
Does this image have a non-default density?
|
|
617
632
|
*/
|
package/src/common.h
CHANGED
|
@@ -1,16 +1,5 @@
|
|
|
1
|
-
// Copyright 2013
|
|
2
|
-
//
|
|
3
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
// you may not use this file except in compliance with the License.
|
|
5
|
-
// You may obtain a copy of the License at
|
|
6
|
-
//
|
|
7
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
//
|
|
9
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
// See the License for the specific language governing permissions and
|
|
13
|
-
// limitations under the License.
|
|
1
|
+
// Copyright 2013 Lovell Fuller and others.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
14
3
|
|
|
15
4
|
#ifndef SRC_COMMON_H_
|
|
16
5
|
#define SRC_COMMON_H_
|
|
@@ -25,9 +14,9 @@
|
|
|
25
14
|
// Verify platform and compiler compatibility
|
|
26
15
|
|
|
27
16
|
#if (VIPS_MAJOR_VERSION < 8) || \
|
|
28
|
-
(VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION <
|
|
29
|
-
(VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION ==
|
|
30
|
-
#error "libvips version 8.
|
|
17
|
+
(VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION < 14) || \
|
|
18
|
+
(VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION == 14 && VIPS_MICRO_VERSION < 2)
|
|
19
|
+
#error "libvips version 8.14.2+ is required - please see https://sharp.pixelplumbing.com/install"
|
|
31
20
|
#endif
|
|
32
21
|
|
|
33
22
|
#if ((!defined(__clang__)) && defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6)))
|
|
@@ -55,6 +44,7 @@ namespace sharp {
|
|
|
55
44
|
size_t bufferLength;
|
|
56
45
|
bool isBuffer;
|
|
57
46
|
double density;
|
|
47
|
+
bool ignoreIcc;
|
|
58
48
|
VipsBandFormat rawDepth;
|
|
59
49
|
int rawChannels;
|
|
60
50
|
int rawWidth;
|
|
@@ -81,6 +71,7 @@ namespace sharp {
|
|
|
81
71
|
int textDpi;
|
|
82
72
|
bool textRgba;
|
|
83
73
|
int textSpacing;
|
|
74
|
+
VipsTextWrap textWrap;
|
|
84
75
|
int textAutofitDpi;
|
|
85
76
|
|
|
86
77
|
InputDescriptor():
|
|
@@ -92,6 +83,7 @@ namespace sharp {
|
|
|
92
83
|
bufferLength(0),
|
|
93
84
|
isBuffer(FALSE),
|
|
94
85
|
density(72.0),
|
|
86
|
+
ignoreIcc(FALSE),
|
|
95
87
|
rawDepth(VIPS_FORMAT_UCHAR),
|
|
96
88
|
rawChannels(0),
|
|
97
89
|
rawWidth(0),
|
|
@@ -114,6 +106,7 @@ namespace sharp {
|
|
|
114
106
|
textDpi(72),
|
|
115
107
|
textRgba(FALSE),
|
|
116
108
|
textSpacing(0),
|
|
109
|
+
textWrap(VIPS_TEXT_WRAP_WORD),
|
|
117
110
|
textAutofitDpi(0) {}
|
|
118
111
|
};
|
|
119
112
|
|
|
@@ -189,6 +182,11 @@ namespace sharp {
|
|
|
189
182
|
bool IsDzZip(std::string const &str);
|
|
190
183
|
bool IsV(std::string const &str);
|
|
191
184
|
|
|
185
|
+
/*
|
|
186
|
+
Trim space from end of string.
|
|
187
|
+
*/
|
|
188
|
+
std::string TrimEnd(std::string const &str);
|
|
189
|
+
|
|
192
190
|
/*
|
|
193
191
|
Provide a string identifier for the given image type.
|
|
194
192
|
*/
|
|
@@ -255,6 +253,11 @@ namespace sharp {
|
|
|
255
253
|
*/
|
|
256
254
|
VImage RemoveAnimationProperties(VImage image);
|
|
257
255
|
|
|
256
|
+
/*
|
|
257
|
+
Remove GIF palette from image.
|
|
258
|
+
*/
|
|
259
|
+
VImage RemoveGifPalette(VImage image);
|
|
260
|
+
|
|
258
261
|
/*
|
|
259
262
|
Does this image have a non-default density?
|
|
260
263
|
*/
|
|
@@ -3679,6 +3679,13 @@ VipsBlob *VImage::webpsave_buffer( VOption *options ) const
|
|
|
3679
3679
|
return( buffer );
|
|
3680
3680
|
}
|
|
3681
3681
|
|
|
3682
|
+
void VImage::webpsave_mime( VOption *options ) const
|
|
3683
|
+
{
|
|
3684
|
+
call( "webpsave_mime",
|
|
3685
|
+
(options ? options : VImage::option())->
|
|
3686
|
+
set( "in", *this ) );
|
|
3687
|
+
}
|
|
3688
|
+
|
|
3682
3689
|
void VImage::webpsave_target( VTarget target, VOption *options ) const
|
|
3683
3690
|
{
|
|
3684
3691
|
call( "webpsave_target",
|
package/src/metadata.cc
CHANGED
|
@@ -1,16 +1,5 @@
|
|
|
1
|
-
// Copyright 2013
|
|
2
|
-
//
|
|
3
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
// you may not use this file except in compliance with the License.
|
|
5
|
-
// You may obtain a copy of the License at
|
|
6
|
-
//
|
|
7
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
//
|
|
9
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
// See the License for the specific language governing permissions and
|
|
13
|
-
// limitations under the License.
|
|
1
|
+
// Copyright 2013 Lovell Fuller and others.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
14
3
|
|
|
15
4
|
#include <numeric>
|
|
16
5
|
#include <vector>
|
|
@@ -80,6 +69,9 @@ class MetadataWorker : public Napi::AsyncWorker {
|
|
|
80
69
|
if (image.get_typeof(VIPS_META_RESOLUTION_UNIT) == VIPS_TYPE_REF_STRING) {
|
|
81
70
|
baton->resolutionUnit = image.get_string(VIPS_META_RESOLUTION_UNIT);
|
|
82
71
|
}
|
|
72
|
+
if (image.get_typeof("magick-format") == VIPS_TYPE_REF_STRING) {
|
|
73
|
+
baton->formatMagick = image.get_string("magick-format");
|
|
74
|
+
}
|
|
83
75
|
if (image.get_typeof("openslide.level-count") == VIPS_TYPE_REF_STRING) {
|
|
84
76
|
int const levels = std::stoi(image.get_string("openslide.level-count"));
|
|
85
77
|
for (int l = 0; l < levels; l++) {
|
|
@@ -153,7 +145,7 @@ class MetadataWorker : public Napi::AsyncWorker {
|
|
|
153
145
|
// Handle warnings
|
|
154
146
|
std::string warning = sharp::VipsWarningPop();
|
|
155
147
|
while (!warning.empty()) {
|
|
156
|
-
debuglog.
|
|
148
|
+
debuglog.MakeCallback(Receiver().Value(), { Napi::String::New(env, warning) });
|
|
157
149
|
warning = sharp::VipsWarningPop();
|
|
158
150
|
}
|
|
159
151
|
|
|
@@ -204,6 +196,9 @@ class MetadataWorker : public Napi::AsyncWorker {
|
|
|
204
196
|
if (!baton->resolutionUnit.empty()) {
|
|
205
197
|
info.Set("resolutionUnit", baton->resolutionUnit == "in" ? "inch" : baton->resolutionUnit);
|
|
206
198
|
}
|
|
199
|
+
if (!baton->formatMagick.empty()) {
|
|
200
|
+
info.Set("formatMagick", baton->formatMagick);
|
|
201
|
+
}
|
|
207
202
|
if (!baton->levels.empty()) {
|
|
208
203
|
int i = 0;
|
|
209
204
|
Napi::Array levels = Napi::Array::New(env, static_cast<size_t>(baton->levels.size()));
|
|
@@ -252,7 +247,7 @@ class MetadataWorker : public Napi::AsyncWorker {
|
|
|
252
247
|
}
|
|
253
248
|
Callback().MakeCallback(Receiver().Value(), { env.Null(), info });
|
|
254
249
|
} else {
|
|
255
|
-
Callback().MakeCallback(Receiver().Value(), { Napi::Error::New(env, baton->err).Value() });
|
|
250
|
+
Callback().MakeCallback(Receiver().Value(), { Napi::Error::New(env, sharp::TrimEnd(baton->err)).Value() });
|
|
256
251
|
}
|
|
257
252
|
|
|
258
253
|
delete baton->input;
|
|
@@ -270,7 +265,7 @@ class MetadataWorker : public Napi::AsyncWorker {
|
|
|
270
265
|
Napi::Value metadata(const Napi::CallbackInfo& info) {
|
|
271
266
|
// V8 objects are converted to non-V8 types held in the baton struct
|
|
272
267
|
MetadataBaton *baton = new MetadataBaton;
|
|
273
|
-
Napi::Object options = info[0].As<Napi::Object>();
|
|
268
|
+
Napi::Object options = info[size_t(0)].As<Napi::Object>();
|
|
274
269
|
|
|
275
270
|
// Input
|
|
276
271
|
baton->input = sharp::CreateInputDescriptor(options.Get("input").As<Napi::Object>());
|
|
@@ -279,7 +274,7 @@ Napi::Value metadata(const Napi::CallbackInfo& info) {
|
|
|
279
274
|
Napi::Function debuglog = options.Get("debuglog").As<Napi::Function>();
|
|
280
275
|
|
|
281
276
|
// Join queue for worker thread
|
|
282
|
-
Napi::Function callback = info[1].As<Napi::Function>();
|
|
277
|
+
Napi::Function callback = info[size_t(1)].As<Napi::Function>();
|
|
283
278
|
MetadataWorker *worker = new MetadataWorker(callback, baton, debuglog);
|
|
284
279
|
worker->Receiver().Set("options", options);
|
|
285
280
|
worker->Queue();
|
package/src/metadata.h
CHANGED
|
@@ -1,16 +1,5 @@
|
|
|
1
|
-
// Copyright 2013
|
|
2
|
-
//
|
|
3
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
// you may not use this file except in compliance with the License.
|
|
5
|
-
// You may obtain a copy of the License at
|
|
6
|
-
//
|
|
7
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
//
|
|
9
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
// See the License for the specific language governing permissions and
|
|
13
|
-
// limitations under the License.
|
|
1
|
+
// Copyright 2013 Lovell Fuller and others.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
14
3
|
|
|
15
4
|
#ifndef SRC_METADATA_H_
|
|
16
5
|
#define SRC_METADATA_H_
|
|
@@ -41,6 +30,7 @@ struct MetadataBaton {
|
|
|
41
30
|
int pagePrimary;
|
|
42
31
|
std::string compression;
|
|
43
32
|
std::string resolutionUnit;
|
|
33
|
+
std::string formatMagick;
|
|
44
34
|
std::vector<std::pair<int, int>> levels;
|
|
45
35
|
int subifds;
|
|
46
36
|
std::vector<double> background;
|
package/src/operations.cc
CHANGED
|
@@ -1,23 +1,11 @@
|
|
|
1
|
-
// Copyright 2013
|
|
2
|
-
//
|
|
3
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
// you may not use this file except in compliance with the License.
|
|
5
|
-
// You may obtain a copy of the License at
|
|
6
|
-
//
|
|
7
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
//
|
|
9
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
// See the License for the specific language governing permissions and
|
|
13
|
-
// limitations under the License.
|
|
1
|
+
// Copyright 2013 Lovell Fuller and others.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
14
3
|
|
|
15
4
|
#include <algorithm>
|
|
16
5
|
#include <functional>
|
|
17
6
|
#include <memory>
|
|
18
7
|
#include <tuple>
|
|
19
8
|
#include <vector>
|
|
20
|
-
|
|
21
9
|
#include <vips/vips8>
|
|
22
10
|
|
|
23
11
|
#include "common.h"
|
|
@@ -57,7 +45,7 @@ namespace sharp {
|
|
|
57
45
|
/*
|
|
58
46
|
* Stretch luminance to cover full dynamic range.
|
|
59
47
|
*/
|
|
60
|
-
VImage Normalise(VImage image) {
|
|
48
|
+
VImage Normalise(VImage image, int const lower, int const upper) {
|
|
61
49
|
// Get original colourspace
|
|
62
50
|
VipsInterpretation typeBeforeNormalize = image.interpretation();
|
|
63
51
|
if (typeBeforeNormalize == VIPS_INTERPRETATION_RGB) {
|
|
@@ -67,9 +55,11 @@ namespace sharp {
|
|
|
67
55
|
VImage lab = image.colourspace(VIPS_INTERPRETATION_LAB);
|
|
68
56
|
// Extract luminance
|
|
69
57
|
VImage luminance = lab[0];
|
|
58
|
+
|
|
70
59
|
// Find luminance range
|
|
71
|
-
int const min = luminance.percent(
|
|
72
|
-
int const max = luminance.percent(
|
|
60
|
+
int const min = lower == 0 ? luminance.min() : luminance.percent(lower);
|
|
61
|
+
int const max = upper == 100 ? luminance.max() : luminance.percent(upper);
|
|
62
|
+
|
|
73
63
|
if (std::abs(max - min) > 1) {
|
|
74
64
|
// Extract chroma
|
|
75
65
|
VImage chroma = lab.extract_band(1, VImage::option()->set("n", 2));
|
|
@@ -395,11 +385,11 @@ namespace sharp {
|
|
|
395
385
|
* Split into frames, embed each frame, reassemble, and update pageHeight.
|
|
396
386
|
*/
|
|
397
387
|
VImage EmbedMultiPage(VImage image, int left, int top, int width, int height,
|
|
398
|
-
std::vector<double> background, int nPages, int *pageHeight) {
|
|
388
|
+
VipsExtend extendWith, std::vector<double> background, int nPages, int *pageHeight) {
|
|
399
389
|
if (top == 0 && height == *pageHeight) {
|
|
400
390
|
// Fast path; no need to adjust the height of the multi-page image
|
|
401
391
|
return image.embed(left, 0, width, image.height(), VImage::option()
|
|
402
|
-
->set("extend",
|
|
392
|
+
->set("extend", extendWith)
|
|
403
393
|
->set("background", background));
|
|
404
394
|
} else if (left == 0 && width == image.width()) {
|
|
405
395
|
// Fast path; no need to adjust the width of the multi-page image
|
|
@@ -411,7 +401,7 @@ namespace sharp {
|
|
|
411
401
|
|
|
412
402
|
// Do the embed on the wide image
|
|
413
403
|
image = image.embed(0, top, image.width(), height, VImage::option()
|
|
414
|
-
->set("extend",
|
|
404
|
+
->set("extend", extendWith)
|
|
415
405
|
->set("background", background));
|
|
416
406
|
|
|
417
407
|
// Split the wide image into frames
|
|
@@ -441,7 +431,7 @@ namespace sharp {
|
|
|
441
431
|
// Embed each frame in the target size
|
|
442
432
|
for (int i = 0; i < nPages; i++) {
|
|
443
433
|
pages[i] = pages[i].embed(left, top, width, height, VImage::option()
|
|
444
|
-
->set("extend",
|
|
434
|
+
->set("extend", extendWith)
|
|
445
435
|
->set("background", background));
|
|
446
436
|
}
|
|
447
437
|
|
package/src/operations.h
CHANGED
|
@@ -1,16 +1,5 @@
|
|
|
1
|
-
// Copyright 2013
|
|
2
|
-
//
|
|
3
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
// you may not use this file except in compliance with the License.
|
|
5
|
-
// You may obtain a copy of the License at
|
|
6
|
-
//
|
|
7
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
//
|
|
9
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
// See the License for the specific language governing permissions and
|
|
13
|
-
// limitations under the License.
|
|
1
|
+
// Copyright 2013 Lovell Fuller and others.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
14
3
|
|
|
15
4
|
#ifndef SRC_OPERATIONS_H_
|
|
16
5
|
#define SRC_OPERATIONS_H_
|
|
@@ -33,7 +22,7 @@ namespace sharp {
|
|
|
33
22
|
/*
|
|
34
23
|
* Stretch luminance to cover full dynamic range.
|
|
35
24
|
*/
|
|
36
|
-
VImage Normalise(VImage image);
|
|
25
|
+
VImage Normalise(VImage image, int const lower, int const upper);
|
|
37
26
|
|
|
38
27
|
/*
|
|
39
28
|
* Contrast limiting adapative histogram equalization (CLAHE)
|
|
@@ -124,7 +113,7 @@ namespace sharp {
|
|
|
124
113
|
* Split into frames, embed each frame, reassemble, and update pageHeight.
|
|
125
114
|
*/
|
|
126
115
|
VImage EmbedMultiPage(VImage image, int left, int top, int width, int height,
|
|
127
|
-
std::vector<double> background, int nPages, int *pageHeight);
|
|
116
|
+
VipsExtend extendWith, std::vector<double> background, int nPages, int *pageHeight);
|
|
128
117
|
|
|
129
118
|
} // namespace sharp
|
|
130
119
|
|