sharp 0.28.2 → 0.29.2
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 +2 -2
- package/binding.gyp +12 -9
- package/install/can-compile.js +11 -0
- package/install/dll-copy.js +6 -6
- package/install/libvips.js +4 -9
- package/lib/channel.js +13 -7
- package/lib/colour.js +42 -1
- package/lib/composite.js +2 -0
- package/lib/constructor.js +21 -31
- package/lib/input.js +45 -3
- package/lib/is.js +19 -5
- package/lib/libvips.js +4 -19
- package/lib/operation.js +74 -7
- package/lib/output.js +145 -16
- package/lib/sharp.js +31 -0
- package/lib/utility.js +3 -2
- package/package.json +19 -15
- package/src/common.cc +67 -11
- package/src/common.h +25 -5
- package/src/libvips/cplusplus/VConnection.cpp +0 -26
- package/src/libvips/cplusplus/VImage.cpp +54 -16
- package/src/libvips/cplusplus/VInterpolate.cpp +0 -13
- package/src/libvips/cplusplus/vips-operators.cpp +185 -1
- package/src/metadata.cc +14 -0
- package/src/metadata.h +1 -0
- package/src/operations.cc +36 -3
- package/src/operations.h +18 -2
- package/src/pipeline.cc +104 -34
- package/src/pipeline.h +29 -3
- package/src/utilities.cc +1 -1
package/src/common.cc
CHANGED
|
@@ -92,6 +92,9 @@ namespace sharp {
|
|
|
92
92
|
}
|
|
93
93
|
// Raw pixel input
|
|
94
94
|
if (HasAttr(input, "rawChannels")) {
|
|
95
|
+
descriptor->rawDepth = static_cast<VipsBandFormat>(
|
|
96
|
+
vips_enum_from_nick(nullptr, VIPS_TYPE_BAND_FORMAT,
|
|
97
|
+
AttrAsStr(input, "rawDepth").data()));
|
|
95
98
|
descriptor->rawChannels = AttrAsUint32(input, "rawChannels");
|
|
96
99
|
descriptor->rawWidth = AttrAsUint32(input, "rawWidth");
|
|
97
100
|
descriptor->rawHeight = AttrAsUint32(input, "rawHeight");
|
|
@@ -154,6 +157,10 @@ namespace sharp {
|
|
|
154
157
|
bool IsGif(std::string const &str) {
|
|
155
158
|
return EndsWith(str, ".gif") || EndsWith(str, ".GIF");
|
|
156
159
|
}
|
|
160
|
+
bool IsJp2(std::string const &str) {
|
|
161
|
+
return EndsWith(str, ".jp2") || EndsWith(str, ".jpx") || EndsWith(str, ".j2k") || EndsWith(str, ".j2c")
|
|
162
|
+
|| EndsWith(str, ".JP2") || EndsWith(str, ".JPX") || EndsWith(str, ".J2K") || EndsWith(str, ".J2C");
|
|
163
|
+
}
|
|
157
164
|
bool IsTiff(std::string const &str) {
|
|
158
165
|
return EndsWith(str, ".tif") || EndsWith(str, ".tiff") || EndsWith(str, ".TIF") || EndsWith(str, ".TIFF");
|
|
159
166
|
}
|
|
@@ -187,6 +194,7 @@ namespace sharp {
|
|
|
187
194
|
case ImageType::WEBP: id = "webp"; break;
|
|
188
195
|
case ImageType::TIFF: id = "tiff"; break;
|
|
189
196
|
case ImageType::GIF: id = "gif"; break;
|
|
197
|
+
case ImageType::JP2: id = "jp2"; break;
|
|
190
198
|
case ImageType::SVG: id = "svg"; break;
|
|
191
199
|
case ImageType::HEIF: id = "heif"; break;
|
|
192
200
|
case ImageType::PDF: id = "pdf"; break;
|
|
@@ -223,6 +231,8 @@ namespace sharp {
|
|
|
223
231
|
{ "VipsForeignLoadGifBuffer", ImageType::GIF },
|
|
224
232
|
{ "VipsForeignLoadNsgifFile", ImageType::GIF },
|
|
225
233
|
{ "VipsForeignLoadNsgifBuffer", ImageType::GIF },
|
|
234
|
+
{ "VipsForeignLoadJp2kBuffer", ImageType::JP2 },
|
|
235
|
+
{ "VipsForeignLoadJp2kFile", ImageType::JP2 },
|
|
226
236
|
{ "VipsForeignLoadSvgFile", ImageType::SVG },
|
|
227
237
|
{ "VipsForeignLoadSvgBuffer", ImageType::SVG },
|
|
228
238
|
{ "VipsForeignLoadHeifFile", ImageType::HEIF },
|
|
@@ -231,6 +241,8 @@ namespace sharp {
|
|
|
231
241
|
{ "VipsForeignLoadPdfBuffer", ImageType::PDF },
|
|
232
242
|
{ "VipsForeignLoadMagickFile", ImageType::MAGICK },
|
|
233
243
|
{ "VipsForeignLoadMagickBuffer", ImageType::MAGICK },
|
|
244
|
+
{ "VipsForeignLoadMagick7File", ImageType::MAGICK },
|
|
245
|
+
{ "VipsForeignLoadMagick7Buffer", ImageType::MAGICK },
|
|
234
246
|
{ "VipsForeignLoadOpenslide", ImageType::OPENSLIDE },
|
|
235
247
|
{ "VipsForeignLoadPpmFile", ImageType::PPM },
|
|
236
248
|
{ "VipsForeignLoadFits", ImageType::FITS },
|
|
@@ -282,6 +294,7 @@ namespace sharp {
|
|
|
282
294
|
imageType == ImageType::WEBP ||
|
|
283
295
|
imageType == ImageType::MAGICK ||
|
|
284
296
|
imageType == ImageType::GIF ||
|
|
297
|
+
imageType == ImageType::JP2 ||
|
|
285
298
|
imageType == ImageType::TIFF ||
|
|
286
299
|
imageType == ImageType::HEIF ||
|
|
287
300
|
imageType == ImageType::PDF;
|
|
@@ -297,7 +310,7 @@ namespace sharp {
|
|
|
297
310
|
if (descriptor->rawChannels > 0) {
|
|
298
311
|
// Raw, uncompressed pixel data
|
|
299
312
|
image = VImage::new_from_memory(descriptor->buffer, descriptor->bufferLength,
|
|
300
|
-
descriptor->rawWidth, descriptor->rawHeight, descriptor->rawChannels,
|
|
313
|
+
descriptor->rawWidth, descriptor->rawHeight, descriptor->rawChannels, descriptor->rawDepth);
|
|
301
314
|
if (descriptor->rawChannels < 3) {
|
|
302
315
|
image.get_image()->Type = VIPS_INTERPRETATION_B_W;
|
|
303
316
|
} else {
|
|
@@ -505,6 +518,17 @@ namespace sharp {
|
|
|
505
518
|
return copy;
|
|
506
519
|
}
|
|
507
520
|
|
|
521
|
+
/*
|
|
522
|
+
Remove animation properties from image.
|
|
523
|
+
*/
|
|
524
|
+
VImage RemoveAnimationProperties(VImage image) {
|
|
525
|
+
VImage copy = image.copy();
|
|
526
|
+
copy.remove(VIPS_META_PAGE_HEIGHT);
|
|
527
|
+
copy.remove("delay");
|
|
528
|
+
copy.remove("loop");
|
|
529
|
+
return copy;
|
|
530
|
+
}
|
|
531
|
+
|
|
508
532
|
/*
|
|
509
533
|
Does this image have a non-default density?
|
|
510
534
|
*/
|
|
@@ -586,6 +610,33 @@ namespace sharp {
|
|
|
586
610
|
return warning;
|
|
587
611
|
}
|
|
588
612
|
|
|
613
|
+
/*
|
|
614
|
+
Attach an event listener for progress updates, used to detect timeout
|
|
615
|
+
*/
|
|
616
|
+
void SetTimeout(VImage image, int const seconds) {
|
|
617
|
+
if (seconds > 0) {
|
|
618
|
+
VipsImage *im = image.get_image();
|
|
619
|
+
if (im->progress_signal == NULL) {
|
|
620
|
+
int *timeout = VIPS_NEW(im, int);
|
|
621
|
+
*timeout = seconds;
|
|
622
|
+
g_signal_connect(im, "eval", G_CALLBACK(VipsProgressCallBack), timeout);
|
|
623
|
+
vips_image_set_progress(im, TRUE);
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
/*
|
|
629
|
+
Event listener for progress updates, used to detect timeout
|
|
630
|
+
*/
|
|
631
|
+
void VipsProgressCallBack(VipsImage *im, VipsProgress *progress, int *timeout) {
|
|
632
|
+
// printf("VipsProgressCallBack progress=%d run=%d timeout=%d\n", progress->percent, progress->run, *timeout);
|
|
633
|
+
if (*timeout > 0 && progress->run >= *timeout) {
|
|
634
|
+
vips_image_set_kill(im, TRUE);
|
|
635
|
+
vips_error("timeout", "%d%% complete", progress->percent);
|
|
636
|
+
*timeout = 0;
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
|
|
589
640
|
/*
|
|
590
641
|
Calculate the (left, top) coordinates of the output image
|
|
591
642
|
within the input image, applying the given gravity during an embed.
|
|
@@ -754,23 +805,27 @@ namespace sharp {
|
|
|
754
805
|
/*
|
|
755
806
|
Convert RGBA value to another colourspace
|
|
756
807
|
*/
|
|
757
|
-
std::vector<double> GetRgbaAsColourspace(std::vector<double> const rgba,
|
|
808
|
+
std::vector<double> GetRgbaAsColourspace(std::vector<double> const rgba,
|
|
809
|
+
VipsInterpretation const interpretation, bool premultiply) {
|
|
758
810
|
int const bands = static_cast<int>(rgba.size());
|
|
759
|
-
if (bands < 3
|
|
811
|
+
if (bands < 3) {
|
|
760
812
|
return rgba;
|
|
761
|
-
} else {
|
|
762
|
-
VImage pixel = VImage::new_matrix(1, 1);
|
|
763
|
-
pixel.set("bands", bands);
|
|
764
|
-
pixel = pixel.new_from_image(rgba);
|
|
765
|
-
pixel = pixel.colourspace(interpretation, VImage::option()->set("source_space", VIPS_INTERPRETATION_sRGB));
|
|
766
|
-
return pixel(0, 0);
|
|
767
813
|
}
|
|
814
|
+
VImage pixel = VImage::new_matrix(1, 1);
|
|
815
|
+
pixel.set("bands", bands);
|
|
816
|
+
pixel = pixel
|
|
817
|
+
.new_from_image(rgba)
|
|
818
|
+
.colourspace(interpretation, VImage::option()->set("source_space", VIPS_INTERPRETATION_sRGB));
|
|
819
|
+
if (premultiply) {
|
|
820
|
+
pixel = pixel.premultiply();
|
|
821
|
+
}
|
|
822
|
+
return pixel(0, 0);
|
|
768
823
|
}
|
|
769
824
|
|
|
770
825
|
/*
|
|
771
826
|
Apply the alpha channel to a given colour
|
|
772
827
|
*/
|
|
773
|
-
std::tuple<VImage, std::vector<double>> ApplyAlpha(VImage image, std::vector<double> colour) {
|
|
828
|
+
std::tuple<VImage, std::vector<double>> ApplyAlpha(VImage image, std::vector<double> colour, bool premultiply) {
|
|
774
829
|
// Scale up 8-bit values to match 16-bit input image
|
|
775
830
|
double const multiplier = sharp::Is16Bit(image.interpretation()) ? 256.0 : 1.0;
|
|
776
831
|
// Create alphaColour colour
|
|
@@ -794,7 +849,7 @@ namespace sharp {
|
|
|
794
849
|
alphaColour.push_back(colour[3] * multiplier);
|
|
795
850
|
}
|
|
796
851
|
// Ensure alphaColour colour uses correct colourspace
|
|
797
|
-
alphaColour = sharp::GetRgbaAsColourspace(alphaColour, image.interpretation());
|
|
852
|
+
alphaColour = sharp::GetRgbaAsColourspace(alphaColour, image.interpretation(), premultiply);
|
|
798
853
|
// Add non-transparent alpha channel, if required
|
|
799
854
|
if (colour[3] < 255.0 && !HasAlpha(image)) {
|
|
800
855
|
image = image.bandjoin(
|
|
@@ -824,4 +879,5 @@ namespace sharp {
|
|
|
824
879
|
}
|
|
825
880
|
return image;
|
|
826
881
|
}
|
|
882
|
+
|
|
827
883
|
} // namespace sharp
|
package/src/common.h
CHANGED
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
// Verify platform and compiler compatibility
|
|
26
26
|
|
|
27
27
|
#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.
|
|
28
|
+
(VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION < 11) || \
|
|
29
|
+
(VIPS_MAJOR_VERSION == 8 && VIPS_MINOR_VERSION == 11 && VIPS_MICRO_VERSION < 3)
|
|
30
|
+
#error "libvips version 8.11.3+ is required - please see https://sharp.pixelplumbing.com/install"
|
|
31
31
|
#endif
|
|
32
32
|
|
|
33
33
|
#if ((!defined(__clang__)) && defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6)))
|
|
@@ -54,6 +54,7 @@ namespace sharp {
|
|
|
54
54
|
size_t bufferLength;
|
|
55
55
|
bool isBuffer;
|
|
56
56
|
double density;
|
|
57
|
+
VipsBandFormat rawDepth;
|
|
57
58
|
int rawChannels;
|
|
58
59
|
int rawWidth;
|
|
59
60
|
int rawHeight;
|
|
@@ -78,6 +79,7 @@ namespace sharp {
|
|
|
78
79
|
bufferLength(0),
|
|
79
80
|
isBuffer(FALSE),
|
|
80
81
|
density(72.0),
|
|
82
|
+
rawDepth(VIPS_FORMAT_UCHAR),
|
|
81
83
|
rawChannels(0),
|
|
82
84
|
rawWidth(0),
|
|
83
85
|
rawHeight(0),
|
|
@@ -114,6 +116,7 @@ namespace sharp {
|
|
|
114
116
|
JPEG,
|
|
115
117
|
PNG,
|
|
116
118
|
WEBP,
|
|
119
|
+
JP2,
|
|
117
120
|
TIFF,
|
|
118
121
|
GIF,
|
|
119
122
|
SVG,
|
|
@@ -140,6 +143,7 @@ namespace sharp {
|
|
|
140
143
|
bool IsJpeg(std::string const &str);
|
|
141
144
|
bool IsPng(std::string const &str);
|
|
142
145
|
bool IsWebp(std::string const &str);
|
|
146
|
+
bool IsJp2(std::string const &str);
|
|
143
147
|
bool IsGif(std::string const &str);
|
|
144
148
|
bool IsTiff(std::string const &str);
|
|
145
149
|
bool IsHeic(std::string const &str);
|
|
@@ -206,6 +210,11 @@ namespace sharp {
|
|
|
206
210
|
*/
|
|
207
211
|
VImage SetAnimationProperties(VImage image, int pageHeight, std::vector<int> delay, int loop);
|
|
208
212
|
|
|
213
|
+
/*
|
|
214
|
+
Remove animation properties from image.
|
|
215
|
+
*/
|
|
216
|
+
VImage RemoveAnimationProperties(VImage image);
|
|
217
|
+
|
|
209
218
|
/*
|
|
210
219
|
Does this image have a non-default density?
|
|
211
220
|
*/
|
|
@@ -241,6 +250,16 @@ namespace sharp {
|
|
|
241
250
|
*/
|
|
242
251
|
std::string VipsWarningPop();
|
|
243
252
|
|
|
253
|
+
/*
|
|
254
|
+
Attach an event listener for progress updates, used to detect timeout
|
|
255
|
+
*/
|
|
256
|
+
void SetTimeout(VImage image, int const timeoutSeconds);
|
|
257
|
+
|
|
258
|
+
/*
|
|
259
|
+
Event listener for progress updates, used to detect timeout
|
|
260
|
+
*/
|
|
261
|
+
void VipsProgressCallBack(VipsImage *image, VipsProgress *progress, int *timeoutSeconds);
|
|
262
|
+
|
|
244
263
|
/*
|
|
245
264
|
Calculate the (left, top) coordinates of the output image
|
|
246
265
|
within the input image, applying the given gravity during an embed.
|
|
@@ -286,12 +305,13 @@ namespace sharp {
|
|
|
286
305
|
/*
|
|
287
306
|
Convert RGBA value to another colourspace
|
|
288
307
|
*/
|
|
289
|
-
std::vector<double> GetRgbaAsColourspace(std::vector<double> const rgba,
|
|
308
|
+
std::vector<double> GetRgbaAsColourspace(std::vector<double> const rgba,
|
|
309
|
+
VipsInterpretation const interpretation, bool premultiply);
|
|
290
310
|
|
|
291
311
|
/*
|
|
292
312
|
Apply the alpha channel to a given colour
|
|
293
313
|
*/
|
|
294
|
-
std::tuple<VImage, std::vector<double>> ApplyAlpha(VImage image, std::vector<double> colour);
|
|
314
|
+
std::tuple<VImage, std::vector<double>> ApplyAlpha(VImage image, std::vector<double> colour, bool premultiply);
|
|
295
315
|
|
|
296
316
|
/*
|
|
297
317
|
Removes alpha channel, if any.
|
|
@@ -110,19 +110,6 @@ VSource::new_from_options( const char *options )
|
|
|
110
110
|
return( out );
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
VOption *
|
|
114
|
-
VOption::set( const char *name, const VSource value )
|
|
115
|
-
{
|
|
116
|
-
Pair *pair = new Pair( name );
|
|
117
|
-
|
|
118
|
-
pair->input = true;
|
|
119
|
-
g_value_init( &pair->value, VIPS_TYPE_SOURCE );
|
|
120
|
-
g_value_set_object( &pair->value, value.get_source() );
|
|
121
|
-
options.push_back( pair );
|
|
122
|
-
|
|
123
|
-
return( this );
|
|
124
|
-
}
|
|
125
|
-
|
|
126
113
|
VTarget
|
|
127
114
|
VTarget::new_to_descriptor( int descriptor )
|
|
128
115
|
{
|
|
@@ -162,17 +149,4 @@ VTarget::new_to_memory()
|
|
|
162
149
|
return( out );
|
|
163
150
|
}
|
|
164
151
|
|
|
165
|
-
VOption *
|
|
166
|
-
VOption::set( const char *name, const VTarget value )
|
|
167
|
-
{
|
|
168
|
-
Pair *pair = new Pair( name );
|
|
169
|
-
|
|
170
|
-
pair->input = true;
|
|
171
|
-
g_value_init( &pair->value, VIPS_TYPE_TARGET );
|
|
172
|
-
g_value_set_object( &pair->value, value.get_target() );
|
|
173
|
-
options.push_back( pair );
|
|
174
|
-
|
|
175
|
-
return( this );
|
|
176
|
-
}
|
|
177
|
-
|
|
178
152
|
VIPS_NAMESPACE_END
|
|
@@ -51,6 +51,12 @@
|
|
|
51
51
|
|
|
52
52
|
VIPS_NAMESPACE_START
|
|
53
53
|
|
|
54
|
+
/**
|
|
55
|
+
* \namespace vips
|
|
56
|
+
*
|
|
57
|
+
* General docs for the vips namespace.
|
|
58
|
+
*/
|
|
59
|
+
|
|
54
60
|
std::vector<double>
|
|
55
61
|
to_vectorv( int n, ... )
|
|
56
62
|
{
|
|
@@ -140,6 +146,20 @@ VOption::set( const char *name, int value )
|
|
|
140
146
|
return( this );
|
|
141
147
|
}
|
|
142
148
|
|
|
149
|
+
// input guint64
|
|
150
|
+
VOption *
|
|
151
|
+
VOption::set( const char *name, guint64 value )
|
|
152
|
+
{
|
|
153
|
+
Pair *pair = new Pair( name );
|
|
154
|
+
|
|
155
|
+
pair->input = true;
|
|
156
|
+
g_value_init( &pair->value, G_TYPE_UINT64 );
|
|
157
|
+
g_value_set_uint64( &pair->value, value );
|
|
158
|
+
options.push_back( pair );
|
|
159
|
+
|
|
160
|
+
return( this );
|
|
161
|
+
}
|
|
162
|
+
|
|
143
163
|
// input double
|
|
144
164
|
VOption *
|
|
145
165
|
VOption::set( const char *name, double value )
|
|
@@ -167,35 +187,37 @@ VOption::set( const char *name, const char *value )
|
|
|
167
187
|
return( this );
|
|
168
188
|
}
|
|
169
189
|
|
|
170
|
-
// input image
|
|
190
|
+
// input vips object (image, source, target, etc. etc.)
|
|
171
191
|
VOption *
|
|
172
|
-
VOption::set( const char *name, const
|
|
192
|
+
VOption::set( const char *name, const VObject value )
|
|
173
193
|
{
|
|
174
194
|
Pair *pair = new Pair( name );
|
|
195
|
+
VipsObject *object = value.get_object();
|
|
196
|
+
GType type = G_OBJECT_TYPE( object );
|
|
175
197
|
|
|
176
198
|
pair->input = true;
|
|
177
|
-
g_value_init( &pair->value,
|
|
178
|
-
g_value_set_object( &pair->value,
|
|
199
|
+
g_value_init( &pair->value, type );
|
|
200
|
+
g_value_set_object( &pair->value, object );
|
|
179
201
|
options.push_back( pair );
|
|
180
202
|
|
|
181
203
|
return( this );
|
|
182
204
|
}
|
|
183
205
|
|
|
184
|
-
// input
|
|
206
|
+
// input int array
|
|
185
207
|
VOption *
|
|
186
|
-
VOption::set( const char *name, std::vector<
|
|
208
|
+
VOption::set( const char *name, std::vector<int> value )
|
|
187
209
|
{
|
|
188
210
|
Pair *pair = new Pair( name );
|
|
189
211
|
|
|
190
|
-
|
|
212
|
+
int *array;
|
|
191
213
|
unsigned int i;
|
|
192
214
|
|
|
193
215
|
pair->input = true;
|
|
194
216
|
|
|
195
|
-
g_value_init( &pair->value,
|
|
196
|
-
|
|
217
|
+
g_value_init( &pair->value, VIPS_TYPE_ARRAY_INT );
|
|
218
|
+
vips_value_set_array_int( &pair->value, NULL,
|
|
197
219
|
static_cast< int >( value.size() ) );
|
|
198
|
-
array =
|
|
220
|
+
array = vips_value_get_array_int( &pair->value, NULL );
|
|
199
221
|
|
|
200
222
|
for( i = 0; i < value.size(); i++ )
|
|
201
223
|
array[i] = value[i];
|
|
@@ -205,21 +227,21 @@ VOption::set( const char *name, std::vector<double> value )
|
|
|
205
227
|
return( this );
|
|
206
228
|
}
|
|
207
229
|
|
|
208
|
-
// input
|
|
230
|
+
// input double array
|
|
209
231
|
VOption *
|
|
210
|
-
VOption::set( const char *name, std::vector<
|
|
232
|
+
VOption::set( const char *name, std::vector<double> value )
|
|
211
233
|
{
|
|
212
234
|
Pair *pair = new Pair( name );
|
|
213
235
|
|
|
214
|
-
|
|
236
|
+
double *array;
|
|
215
237
|
unsigned int i;
|
|
216
238
|
|
|
217
239
|
pair->input = true;
|
|
218
240
|
|
|
219
|
-
g_value_init( &pair->value,
|
|
220
|
-
|
|
241
|
+
g_value_init( &pair->value, VIPS_TYPE_ARRAY_DOUBLE );
|
|
242
|
+
vips_value_set_array_double( &pair->value, NULL,
|
|
221
243
|
static_cast< int >( value.size() ) );
|
|
222
|
-
array =
|
|
244
|
+
array = vips_value_get_array_double( &pair->value, NULL );
|
|
223
245
|
|
|
224
246
|
for( i = 0; i < value.size(); i++ )
|
|
225
247
|
array[i] = value[i];
|
|
@@ -619,6 +641,22 @@ VImage::new_from_source( VSource source, const char *option_string,
|
|
|
619
641
|
return( out );
|
|
620
642
|
}
|
|
621
643
|
|
|
644
|
+
VImage
|
|
645
|
+
VImage::new_from_memory_steal( void *data, size_t size,
|
|
646
|
+
int width, int height, int bands, VipsBandFormat format )
|
|
647
|
+
{
|
|
648
|
+
VipsImage *image;
|
|
649
|
+
|
|
650
|
+
if( !(image = vips_image_new_from_memory( data, size,
|
|
651
|
+
width, height, bands, format )) )
|
|
652
|
+
throw( VError() );
|
|
653
|
+
|
|
654
|
+
g_signal_connect( image, "postclose",
|
|
655
|
+
G_CALLBACK( vips_image_free_buffer ), data);
|
|
656
|
+
|
|
657
|
+
return( VImage( image ) );
|
|
658
|
+
}
|
|
659
|
+
|
|
622
660
|
VImage
|
|
623
661
|
VImage::new_matrix( int width, int height )
|
|
624
662
|
{
|
|
@@ -60,17 +60,4 @@ VInterpolate::new_from_name( const char *name, VOption *options )
|
|
|
60
60
|
return( out );
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
VOption *
|
|
64
|
-
VOption::set( const char *name, const VInterpolate value )
|
|
65
|
-
{
|
|
66
|
-
Pair *pair = new Pair( name );
|
|
67
|
-
|
|
68
|
-
pair->input = true;
|
|
69
|
-
g_value_init( &pair->value, VIPS_TYPE_INTERPOLATE );
|
|
70
|
-
g_value_set_object( &pair->value, value.get_interpolate() );
|
|
71
|
-
options.push_back( pair );
|
|
72
|
-
|
|
73
|
-
return( this );
|
|
74
|
-
}
|
|
75
|
-
|
|
76
63
|
VIPS_NAMESPACE_END
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// bodies for vips operations
|
|
2
|
-
//
|
|
2
|
+
// Wed May 12 11:30:00 AM CEST 2021
|
|
3
3
|
// this file is generated automatically, do not edit!
|
|
4
4
|
|
|
5
5
|
VImage VImage::CMC2LCh( VOption *options ) const
|
|
@@ -1065,6 +1065,18 @@ VImage VImage::fitsload( const char *filename, VOption *options )
|
|
|
1065
1065
|
return( out );
|
|
1066
1066
|
}
|
|
1067
1067
|
|
|
1068
|
+
VImage VImage::fitsload_source( VSource source, VOption *options )
|
|
1069
|
+
{
|
|
1070
|
+
VImage out;
|
|
1071
|
+
|
|
1072
|
+
call( "fitsload_source",
|
|
1073
|
+
(options ? options : VImage::option())->
|
|
1074
|
+
set( "out", &out )->
|
|
1075
|
+
set( "source", source ) );
|
|
1076
|
+
|
|
1077
|
+
return( out );
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1068
1080
|
void VImage::fitssave( const char *filename, VOption *options ) const
|
|
1069
1081
|
{
|
|
1070
1082
|
call( "fitssave",
|
|
@@ -1656,6 +1668,70 @@ VImage VImage::join( VImage in2, VipsDirection direction, VOption *options ) con
|
|
|
1656
1668
|
return( out );
|
|
1657
1669
|
}
|
|
1658
1670
|
|
|
1671
|
+
VImage VImage::jp2kload( const char *filename, VOption *options )
|
|
1672
|
+
{
|
|
1673
|
+
VImage out;
|
|
1674
|
+
|
|
1675
|
+
call( "jp2kload",
|
|
1676
|
+
(options ? options : VImage::option())->
|
|
1677
|
+
set( "out", &out )->
|
|
1678
|
+
set( "filename", filename ) );
|
|
1679
|
+
|
|
1680
|
+
return( out );
|
|
1681
|
+
}
|
|
1682
|
+
|
|
1683
|
+
VImage VImage::jp2kload_buffer( VipsBlob *buffer, VOption *options )
|
|
1684
|
+
{
|
|
1685
|
+
VImage out;
|
|
1686
|
+
|
|
1687
|
+
call( "jp2kload_buffer",
|
|
1688
|
+
(options ? options : VImage::option())->
|
|
1689
|
+
set( "out", &out )->
|
|
1690
|
+
set( "buffer", buffer ) );
|
|
1691
|
+
|
|
1692
|
+
return( out );
|
|
1693
|
+
}
|
|
1694
|
+
|
|
1695
|
+
VImage VImage::jp2kload_source( VSource source, VOption *options )
|
|
1696
|
+
{
|
|
1697
|
+
VImage out;
|
|
1698
|
+
|
|
1699
|
+
call( "jp2kload_source",
|
|
1700
|
+
(options ? options : VImage::option())->
|
|
1701
|
+
set( "out", &out )->
|
|
1702
|
+
set( "source", source ) );
|
|
1703
|
+
|
|
1704
|
+
return( out );
|
|
1705
|
+
}
|
|
1706
|
+
|
|
1707
|
+
void VImage::jp2ksave( const char *filename, VOption *options ) const
|
|
1708
|
+
{
|
|
1709
|
+
call( "jp2ksave",
|
|
1710
|
+
(options ? options : VImage::option())->
|
|
1711
|
+
set( "in", *this )->
|
|
1712
|
+
set( "filename", filename ) );
|
|
1713
|
+
}
|
|
1714
|
+
|
|
1715
|
+
VipsBlob *VImage::jp2ksave_buffer( VOption *options ) const
|
|
1716
|
+
{
|
|
1717
|
+
VipsBlob *buffer;
|
|
1718
|
+
|
|
1719
|
+
call( "jp2ksave_buffer",
|
|
1720
|
+
(options ? options : VImage::option())->
|
|
1721
|
+
set( "in", *this )->
|
|
1722
|
+
set( "buffer", &buffer ) );
|
|
1723
|
+
|
|
1724
|
+
return( buffer );
|
|
1725
|
+
}
|
|
1726
|
+
|
|
1727
|
+
void VImage::jp2ksave_target( VTarget target, VOption *options ) const
|
|
1728
|
+
{
|
|
1729
|
+
call( "jp2ksave_target",
|
|
1730
|
+
(options ? options : VImage::option())->
|
|
1731
|
+
set( "in", *this )->
|
|
1732
|
+
set( "target", target ) );
|
|
1733
|
+
}
|
|
1734
|
+
|
|
1659
1735
|
VImage VImage::jpegload( const char *filename, VOption *options )
|
|
1660
1736
|
{
|
|
1661
1737
|
VImage out;
|
|
@@ -1727,6 +1803,70 @@ void VImage::jpegsave_target( VTarget target, VOption *options ) const
|
|
|
1727
1803
|
set( "target", target ) );
|
|
1728
1804
|
}
|
|
1729
1805
|
|
|
1806
|
+
VImage VImage::jxlload( const char *filename, VOption *options )
|
|
1807
|
+
{
|
|
1808
|
+
VImage out;
|
|
1809
|
+
|
|
1810
|
+
call( "jxlload",
|
|
1811
|
+
(options ? options : VImage::option())->
|
|
1812
|
+
set( "out", &out )->
|
|
1813
|
+
set( "filename", filename ) );
|
|
1814
|
+
|
|
1815
|
+
return( out );
|
|
1816
|
+
}
|
|
1817
|
+
|
|
1818
|
+
VImage VImage::jxlload_buffer( VipsBlob *buffer, VOption *options )
|
|
1819
|
+
{
|
|
1820
|
+
VImage out;
|
|
1821
|
+
|
|
1822
|
+
call( "jxlload_buffer",
|
|
1823
|
+
(options ? options : VImage::option())->
|
|
1824
|
+
set( "out", &out )->
|
|
1825
|
+
set( "buffer", buffer ) );
|
|
1826
|
+
|
|
1827
|
+
return( out );
|
|
1828
|
+
}
|
|
1829
|
+
|
|
1830
|
+
VImage VImage::jxlload_source( VSource source, VOption *options )
|
|
1831
|
+
{
|
|
1832
|
+
VImage out;
|
|
1833
|
+
|
|
1834
|
+
call( "jxlload_source",
|
|
1835
|
+
(options ? options : VImage::option())->
|
|
1836
|
+
set( "out", &out )->
|
|
1837
|
+
set( "source", source ) );
|
|
1838
|
+
|
|
1839
|
+
return( out );
|
|
1840
|
+
}
|
|
1841
|
+
|
|
1842
|
+
void VImage::jxlsave( const char *filename, VOption *options ) const
|
|
1843
|
+
{
|
|
1844
|
+
call( "jxlsave",
|
|
1845
|
+
(options ? options : VImage::option())->
|
|
1846
|
+
set( "in", *this )->
|
|
1847
|
+
set( "filename", filename ) );
|
|
1848
|
+
}
|
|
1849
|
+
|
|
1850
|
+
VipsBlob *VImage::jxlsave_buffer( VOption *options ) const
|
|
1851
|
+
{
|
|
1852
|
+
VipsBlob *buffer;
|
|
1853
|
+
|
|
1854
|
+
call( "jxlsave_buffer",
|
|
1855
|
+
(options ? options : VImage::option())->
|
|
1856
|
+
set( "in", *this )->
|
|
1857
|
+
set( "buffer", &buffer ) );
|
|
1858
|
+
|
|
1859
|
+
return( buffer );
|
|
1860
|
+
}
|
|
1861
|
+
|
|
1862
|
+
void VImage::jxlsave_target( VTarget target, VOption *options ) const
|
|
1863
|
+
{
|
|
1864
|
+
call( "jxlsave_target",
|
|
1865
|
+
(options ? options : VImage::option())->
|
|
1866
|
+
set( "in", *this )->
|
|
1867
|
+
set( "target", target ) );
|
|
1868
|
+
}
|
|
1869
|
+
|
|
1730
1870
|
VImage VImage::labelregions( VOption *options ) const
|
|
1731
1871
|
{
|
|
1732
1872
|
VImage mask;
|
|
@@ -2284,6 +2424,18 @@ VImage VImage::niftiload( const char *filename, VOption *options )
|
|
|
2284
2424
|
return( out );
|
|
2285
2425
|
}
|
|
2286
2426
|
|
|
2427
|
+
VImage VImage::niftiload_source( VSource source, VOption *options )
|
|
2428
|
+
{
|
|
2429
|
+
VImage out;
|
|
2430
|
+
|
|
2431
|
+
call( "niftiload_source",
|
|
2432
|
+
(options ? options : VImage::option())->
|
|
2433
|
+
set( "out", &out )->
|
|
2434
|
+
set( "source", source ) );
|
|
2435
|
+
|
|
2436
|
+
return( out );
|
|
2437
|
+
}
|
|
2438
|
+
|
|
2287
2439
|
void VImage::niftisave( const char *filename, VOption *options ) const
|
|
2288
2440
|
{
|
|
2289
2441
|
call( "niftisave",
|
|
@@ -2316,6 +2468,18 @@ VImage VImage::openslideload( const char *filename, VOption *options )
|
|
|
2316
2468
|
return( out );
|
|
2317
2469
|
}
|
|
2318
2470
|
|
|
2471
|
+
VImage VImage::openslideload_source( VSource source, VOption *options )
|
|
2472
|
+
{
|
|
2473
|
+
VImage out;
|
|
2474
|
+
|
|
2475
|
+
call( "openslideload_source",
|
|
2476
|
+
(options ? options : VImage::option())->
|
|
2477
|
+
set( "out", &out )->
|
|
2478
|
+
set( "source", source ) );
|
|
2479
|
+
|
|
2480
|
+
return( out );
|
|
2481
|
+
}
|
|
2482
|
+
|
|
2319
2483
|
VImage VImage::pdfload( const char *filename, VOption *options )
|
|
2320
2484
|
{
|
|
2321
2485
|
VImage out;
|
|
@@ -3388,6 +3552,18 @@ VImage VImage::vipsload( const char *filename, VOption *options )
|
|
|
3388
3552
|
return( out );
|
|
3389
3553
|
}
|
|
3390
3554
|
|
|
3555
|
+
VImage VImage::vipsload_source( VSource source, VOption *options )
|
|
3556
|
+
{
|
|
3557
|
+
VImage out;
|
|
3558
|
+
|
|
3559
|
+
call( "vipsload_source",
|
|
3560
|
+
(options ? options : VImage::option())->
|
|
3561
|
+
set( "out", &out )->
|
|
3562
|
+
set( "source", source ) );
|
|
3563
|
+
|
|
3564
|
+
return( out );
|
|
3565
|
+
}
|
|
3566
|
+
|
|
3391
3567
|
void VImage::vipssave( const char *filename, VOption *options ) const
|
|
3392
3568
|
{
|
|
3393
3569
|
call( "vipssave",
|
|
@@ -3396,6 +3572,14 @@ void VImage::vipssave( const char *filename, VOption *options ) const
|
|
|
3396
3572
|
set( "filename", filename ) );
|
|
3397
3573
|
}
|
|
3398
3574
|
|
|
3575
|
+
void VImage::vipssave_target( VTarget target, VOption *options ) const
|
|
3576
|
+
{
|
|
3577
|
+
call( "vipssave_target",
|
|
3578
|
+
(options ? options : VImage::option())->
|
|
3579
|
+
set( "in", *this )->
|
|
3580
|
+
set( "target", target ) );
|
|
3581
|
+
}
|
|
3582
|
+
|
|
3399
3583
|
VImage VImage::webpload( const char *filename, VOption *options )
|
|
3400
3584
|
{
|
|
3401
3585
|
VImage out;
|