forked from libvips/libvips
-
Notifications
You must be signed in to change notification settings - Fork 5
/
VImage8.h
5955 lines (5416 loc) · 172 KB
/
VImage8.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// VIPS image wrapper
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef VIPS_VIMAGE_H
#define VIPS_VIMAGE_H
#include <list>
#include <complex>
#include <vector>
#include <cstring>
#include <vips/vips.h>
VIPS_NAMESPACE_START
/* Small utility things.
*/
VIPS_CPLUSPLUS_API std::vector<double> to_vectorv( int n, ... );
VIPS_CPLUSPLUS_API std::vector<double> to_vector( double value );
VIPS_CPLUSPLUS_API std::vector<double> to_vector( int n, double array[] );
VIPS_CPLUSPLUS_API std::vector<double> negate( std::vector<double> value );
VIPS_CPLUSPLUS_API std::vector<double> invert( std::vector<double> value );
/**
* Whether or not VObject should take over the reference that you pass in. See
* VObject().
*/
enum VSteal {
NOSTEAL = 0,
STEAL = 1
};
/**
* A smart VipsObject pointer. It calls g_object_ref()/_unref() for you
* automatically.
*
* VObjects can be null (have no value set). See is_null().
*/
class VObject
{
private:
// can be NULL, see eg. VObject()
VipsObject *vobject;
public:
/**
* Wrap a VObject around the underlying VipsObject pointer.
*
* If steal is STEAL, then the new VObject takes over the reference
* that you pass in.
*/
VObject( VipsObject *new_vobject, VSteal steal = STEAL ) :
vobject( new_vobject )
{
// we allow NULL init, eg. "VImage a;"
g_assert( !new_vobject ||
VIPS_IS_OBJECT( new_vobject ) );
#ifdef VIPS_DEBUG_VERBOSE
printf( "VObject constructor, obj = %p, steal = %d\n",
new_vobject, steal );
if( new_vobject ) {
printf( " obj " );
vips_object_print_name( VIPS_OBJECT( new_vobject ) );
printf( "\n" );
}
#endif /*VIPS_DEBUG_VERBOSE*/
if( !steal && vobject ) {
#ifdef VIPS_DEBUG_VERBOSE
printf( " reffing object\n" );
#endif /*VIPS_DEBUG_VERBOSE*/
g_object_ref( vobject );
}
}
VObject() :
vobject( 0 )
{
}
VObject( const VObject &a ) :
vobject( a.vobject )
{
g_assert( !vobject ||
VIPS_IS_OBJECT( vobject ) );
#ifdef VIPS_DEBUG_VERBOSE
printf( "VObject copy constructor, obj = %p\n",
vobject );
printf( " reffing object\n" );
#endif /*VIPS_DEBUG_VERBOSE*/
if( vobject )
g_object_ref( vobject );
}
// assignment ... we must delete the old ref
VObject &operator=( const VObject &a )
{
#ifdef VIPS_DEBUG_VERBOSE
printf( "VObject assignment\n" );
printf( " reffing %p\n", a.vobject );
printf( " unreffing %p\n", vobject );
#endif /*VIPS_DEBUG_VERBOSE*/
g_assert( !vobject ||
VIPS_IS_OBJECT( vobject ) );
g_assert( !a.vobject ||
VIPS_IS_OBJECT( a.vobject ) );
// delete the old ref at the end ... otherwise "a = a;" could
// unref before reffing again
if( a.vobject )
g_object_ref( a.vobject );
if( vobject )
g_object_unref( vobject );
vobject = a.vobject;
return( *this );
}
// this mustn't be virtual: we want this class to only be a pointer,
// no vtable allowed
~VObject()
{
#ifdef VIPS_DEBUG_VERBOSE
printf( "VObject destructor\n" );
printf( " unreffing %p\n", vobject );
#endif /*VIPS_DEBUG_VERBOSE*/
g_assert( !vobject ||
VIPS_IS_OBJECT( vobject ) );
if( vobject )
g_object_unref( vobject );
}
/**
* Return the underlying VipsObject pointer. This does not make a new
* reference -- you'll need to g_object_ref() the result if you want
* to keep it.
*/
VipsObject *
get_object() const
{
g_assert( !vobject ||
VIPS_IS_OBJECT( vobject ) );
return( vobject );
}
/**
* TRUE if this is a null VObject.
*/
bool is_null() const
{
return vobject == 0;
}
};
class VIPS_CPLUSPLUS_API VImage;
class VIPS_CPLUSPLUS_API VInterpolate;
class VIPS_CPLUSPLUS_API VSource;
class VIPS_CPLUSPLUS_API VTarget;
class VIPS_CPLUSPLUS_API VOption;
/**
* A list of name-value pairs. Pass these to libvips operations to set
* options. For example:
*
* VImage out = in.embed( 10, 10, 1000, 1000, VImage::option()
* ->set( "extend", "background" )
* ->set( "background", 128 ) );
*
* The `set` member functions will take copies (or hold references to)
* compound objects, so you can free them immediately afterwards if necessary.
*
* You can get values back from operations by using the * form of the set
* member functions. For example:
*
* VImage in = VImage::new_from_file( argv[1] );
* int x, y;
* double value = in.max( VImage::option()
* set( "x", &x )
* set( "y", &y ) );
*
*/
class VOption {
private:
struct Pair {
const char *name;
// the thing we pass to and from our caller
GValue value;
// an input or output parameter ... we guess the direction
// from the arg to set()
bool input;
// the pointer we write output values to
union {
bool *vbool;
int *vint;
double *vdouble;
VImage *vimage;
std::vector<double> *vvector;
VipsBlob **vblob;
};
Pair( const char *name ) :
name( name ), input( false ), vimage( 0 )
{
// argh = {0} won't work wil vanilla C++
memset( &value, 0, sizeof( GValue ) );
}
~Pair()
{
g_value_unset( &value );
}
};
std::list<Pair *> options;
public:
VOption()
{
}
virtual ~VOption();
/**
* Set an input boolean option.
*/
VOption *
set( const char *name, bool value );
/**
* Set an input int option. This is used for enums as well, or you can
* use the string version.
*/
VOption *
set( const char *name, int value );
/**
* Set an input unsigned 64-bit integer option.
*/
VOption *
set( const char *name, guint64 value );
/**
* Set an input double option.
*/
VOption *
set( const char *name, double value );
/**
* Set an input string option.
*
* A copy is taken of the object.
*/
VOption *
set( const char *name, const char *value );
/**
* Set a libvips object as an option. These can be images, sources,
* targets, etc.
*
* A copy is taken of the object.
*/
VOption *
set( const char *name, const VObject value );
/**
* Set an array of integers as an input option.
*
* A copy is taken of the object.
*/
VOption *
set( const char *name, std::vector<int> value );
/**
* Set an array of doubles as an input option.
*
* A copy is taken of the object.
*/
VOption *
set( const char *name, std::vector<double> value );
/**
* Set an array of images as an input option.
*
* A copy is taken of the object.
*/
VOption *
set( const char *name, std::vector<VImage> value );
/**
* Set a binary object an input option. Use vips_blob_new() to make
* blobs.
*
* A copy is taken of the object.
*/
VOption *
set( const char *name, VipsBlob *value );
/**
* Set an option which will return a bool value.
*/
VOption *
set( const char *name, bool *value );
/**
* Set an option which will return an integer value.
*/
VOption *
set( const char *name, int *value );
/**
* Set an option which will return a double value.
*/
VOption *
set( const char *name, double *value );
/**
* Set an option which will return a reference to an image.
*/
VOption *
set( const char *name, VImage *value );
/**
* Set an option which will return an array of doubles.
*/
VOption *
set( const char *name, std::vector<double> *value );
/**
* Set an option which will return a binary object, such as an ICC
* profile.
*/
VOption *
set( const char *name, VipsBlob **blob );
/**
* Walk the set of options, setting options on the operation. This is
* used internally by VImage::call().
*/
void
set_operation( VipsOperation *operation );
/**
* Walk the set of options, fetching any output values. This is used
* internally by VImage::call().
*/
void
get_operation( VipsOperation *operation );
};
/**
* An image object.
*
* Image processing operations on images are member functions of VImage. For
* example:
*
* VImage in = VImage::new_from_file( argv[1], VImage::option()
* ->set( "access", "sequential" ) );
* VImage out = in.embed( 10, 10, 1000, 1000, VImage::option()
* ->set( "extend", "copy" ) );
* out.write_to_file( argv[2] );
*
* VImage objects are smart pointers over the underlying VipsImage objects.
* They manage the complications of GLib's ref and unref system for you.
*/
class VImage : public VObject
{
public:
using VObject::is_null;
/**
* Wrap a VImage around an underlying VipsImage object.
*
* If steal is STEAL, then the VImage will take ownership of the
* reference to the VipsImage.
*/
VImage( VipsImage *image, VSteal steal = STEAL ) :
VObject( (VipsObject *) image, steal )
{
}
/**
* An empty (NULL) VImage, eg. "VImage a;"
*/
VImage() :
VObject( 0 )
{
}
/**
* Return the underlying VipsImage reference that this VImage holds.
* This does not make a new reference -- you'll need to g_object_ref()
* the pointer if you need it to last.
*/
VipsImage *
get_image() const
{
return( (VipsImage *) VObject::get_object() );
}
/**
* Return the width of the image in pixels.
*/
int
width() const
{
return( vips_image_get_width( get_image() ) );
}
/**
* Return the height of the image in pixels.
*/
int
height() const
{
return( vips_image_get_height( get_image() ) );
}
/**
* Return the number of image bands.
*/
int
bands() const
{
return( vips_image_get_bands( get_image() ) );
}
/**
* Return the image format, for example VIPS_FORMAT_UCHAR.
*/
VipsBandFormat
format() const
{
return( vips_image_get_format( get_image() ) );
}
/**
* Return the image coding, for example VIPS_CODING_NONE.
*/
VipsCoding
coding() const
{
return( vips_image_get_coding( get_image() ) );
}
/**
* Return the image interpretation, for example
* VIPS_INTERPRETATION_sRGB.
*/
VipsInterpretation
interpretation() const
{
return( vips_image_get_interpretation( get_image() ) );
}
/**
* Try to guess the image interpretation from other fields. This is
* handy if the interpretation has not been set correctly.
*/
VipsInterpretation
guess_interpretation() const
{
return( vips_image_guess_interpretation( get_image() ) );
}
/**
* The horizontal resolution in pixels per millimeter.
*/
double
xres() const
{
return( vips_image_get_xres( get_image() ) );
}
/**
* The vertical resolution in pixels per millimeter.
*/
double
yres() const
{
return( vips_image_get_yres( get_image() ) );
}
/**
* The horizontal offset of the origin in pixels.
*/
int
xoffset() const
{
return( vips_image_get_xoffset( get_image() ) );
}
/**
* The vertical offset of the origin in pixels.
*/
int
yoffset() const
{
return( vips_image_get_yoffset( get_image() ) );
}
/**
* TRUE if the image has an alpha channel.
*/
bool
has_alpha() const
{
return( vips_image_hasalpha( get_image() ) );
}
/**
* The name of the file this image originally came from, or NULL if
* it's not a file image.
*/
const char *
filename() const
{
return( vips_image_get_filename( get_image() ) );
}
/**
* Arrange for the underlying object to be entirely in memory, then
* return a pointer to the first pixel.
*
* This can take a long time and need a very large amount of RAM.
*/
const void *
data() const
{
return( vips_image_get_data( get_image() ) );
}
/**
* Set the value of an int metadata item on an image.
*/
void
set( const char *field, int value )
{
vips_image_set_int( this->get_image(), field, value );
}
/**
* Set the value of an int array metadata item on an image.
*
* A copy of the array is taken.
*/
void
set( const char *field, int *value, int n )
{
vips_image_set_array_int( this->get_image(), field, value, n );
}
/**
* Set the value of an int array metadata item on an image.
*
* A copy of the array is taken.
*/
void
set( const char *field, std::vector<int> value )
{
vips_image_set_array_int( this->get_image(), field, &value[0],
static_cast<int>( value.size() ) );
}
/**
* Set the value of an double array metadata item on an image.
*
* A copy of the array is taken.
*/
void
set( const char *field, double *value, int n )
{
vips_image_set_array_double( this->get_image(), field, value, n );
}
/**
* Set the value of an double array metadata item on an image.
*
* A copy of the array is taken.
*/
void
set( const char *field, std::vector<double> value )
{
vips_image_set_array_double( this->get_image(), field, &value[0],
static_cast<int>( value.size() ) );
}
/**
* Set the value of a double metadata item on an image.
*/
void
set( const char *field, double value )
{
vips_image_set_double( this->get_image(), field, value );
}
/**
* Set the value of a string metadata item on an image.
*
* A copy of the string is taken.
*/
void
set( const char *field, const char *value )
{
vips_image_set_string( this->get_image(), field, value );
}
/**
* Set the value of a binary object metadata item on an image, such as
* an ICC profile.
*
* When libvips no longer needs the value, it will be disposed with
* the free function. This can be NULL.
*/
void
set( const char *field,
VipsCallbackFn free_fn, void *data, size_t length )
{
vips_image_set_blob( this->get_image(), field,
free_fn, data, length );
}
/**
* Return the GType of a metadata item, or 0 if the named item does not
* exist.
*/
GType
get_typeof( const char *field ) const
{
return( vips_image_get_typeof( this->get_image(), field ) );
}
/**
* Get the value of a metadata item as an int.
*
* If the item is not of this type, an exception is thrown.
*/
int
get_int( const char *field ) const
{
int value;
if( vips_image_get_int( this->get_image(), field, &value ) )
throw( VError() );
return( value );
}
/**
* Get the value of a metadata item as an array of ints. Do not free
* the result.
*
* If the item is not of this type, an exception is thrown.
*/
void
get_array_int( const char *field, int **out, int *n ) const
{
if( vips_image_get_array_int( this->get_image(),
field, out, n ) )
throw( VError() );
}
/**
* Get the value of a metadata item as an array of ints.
*
* If the item is not of this type, an exception is thrown.
*/
std::vector<int>
get_array_int( const char *field ) const
{
int length;
int *array;
if( vips_image_get_array_int( this->get_image(),
field, &array, &length ) )
throw( VError() );
std::vector<int> vector( array, array + length );
return( vector );
}
/**
* Get the value of a metadata item as an array of doubles. Do not free
* the result.
*
* If the item is not of this type, an exception is thrown.
*/
void
get_array_double( const char *field, double **out, int *n ) const
{
if( vips_image_get_array_double( this->get_image(),
field, out, n ) )
throw( VError() );
}
/**
* Get the value of a metadata item as an array of doubles.
*
* If the item is not of this type, an exception is thrown.
*/
std::vector<double>
get_array_double( const char *field ) const
{
int length;
double *array;
if( vips_image_get_array_double( this->get_image(),
field, &array, &length ) )
throw( VError() );
std::vector<double> vector( array, array + length );
return( vector );
}
/**
* Get the value of a metadata item as a double.
*
* If the item is not of this type, an exception is thrown.
*/
double
get_double( const char *field ) const
{
double value;
if( vips_image_get_double( this->get_image(), field, &value ) )
throw( VError() );
return( value );
}
/**
* Get the value of a metadata item as a string. You must not free the
* result.
*
* If the item is not of this type, an exception is thrown.
*/
const char *
get_string( const char *field ) const
{
const char *value;
if( vips_image_get_string( this->get_image(), field, &value ) )
throw( VError() );
return( value );
}
/**
* Get the value of a metadata item as a binary object. You must not
* free the result.
*
* If the item is not of this type, an exception is thrown.
*/
const void *
get_blob( const char *field, size_t *length ) const
{
const void *value;
if( vips_image_get_blob( this->get_image(), field,
&value, length ) )
throw( VError() );
return( value );
}
/**
* Remove a metadata item. This does nothing if the item does not
* exist.
*/
bool
remove( const char *name ) const
{
return( vips_image_remove( get_image(), name ) );
}
/**
* Make a new VOption. Can save some typing.
*/
static VOption *
option()
{
return( new VOption() );
}
/**
* Call any libvips operation, with a set of string-encoded options as
* well as VOption.
*/
static void
call_option_string( const char *operation_name,
const char *option_string, VOption *options = 0 );
/**
* Call any libvips operation.
*/
static void
call( const char *operation_name, VOption *options = 0 );
/**
* Make a new image which, when written to, will create a large memory
* object. See VImage::write().
*/
static VImage
new_memory()
{
return( VImage( vips_image_new_memory() ) );
}
/**
* Make a new VImage which, when written to, will craete a temporary
* file on disc. See VImage::write().
*/
static VImage
new_temp_file( const char *file_format = ".v" )
{
VipsImage *image;
if( !(image = vips_image_new_temp_file( file_format )) )
throw( VError() );
return( VImage( image ) );
}
/**
* Create a new VImage object from a file on disc.
*
* The available options depends on the image format. See for example
* VImage::jpegload().
*/
static VImage
new_from_file( const char *name, VOption *options = 0 );
/**
* Create a new VImage object from an area of memory containing an
* image encoded in some format such as JPEG.
*
* The available options depends on the image format. See for example
* VImage::jpegload().
*/
static VImage
new_from_buffer( const void *buf, size_t len,
const char *option_string, VOption *options = 0 );
/**
* Create a new VImage object from an area of memory containing an
* image encoded in some format such as JPEG.
*
* The available options depends on the image format. See for example
* VImage::jpegload().
*/
static VImage
new_from_buffer( const std::string &buf,
const char *option_string, VOption *options = 0 );
/**
* Create a new VImage object from a generic source object.
*
* The available options depends on the image format. See for example
* VImage::jpegload().
*/
static VImage
new_from_source( VSource source,
const char *option_string, VOption *options = 0 );
/**
* Create a new VImage object from an area of memory containing a
* C-style array.
*/
static VImage
new_from_memory( void *data, size_t size,
int width, int height, int bands, VipsBandFormat format )
{
VipsImage *image;
if( !(image = vips_image_new_from_memory( data, size,
width, height, bands, format )) )
throw( VError() );
return( VImage( image ) );
}
/**
* Create a new VImage object from an area of memory containing a
* C-style array.
*
* The VImage steals ownership of @data and will free() it when it
* goes out of scope.
*/
static VImage
new_from_memory_steal( void *data, size_t size,
int width, int height, int bands, VipsBandFormat format );
/**
* Create a matrix image of a specified size. All elements will be
* zero.
*/
static VImage
new_matrix( int width, int height );
/**
* Create a matrix image of a specified size, initialized from the
* array.
*/
static VImage
new_matrix( int width, int height, double *array, int size )
{
VipsImage *image;
if( !(image = vips_image_new_matrix_from_array( width, height,
array, size )) )
throw( VError() );
return( VImage( image ) );
}
/**
* Create a matrix image of a specified size, initialized from the
* function parameters.
*/
static VImage
new_matrixv( int width, int height, ... );
/**
* Make a new image of the same size and type as self, but with each
* pixel initialized with the constant.
*/
VImage
new_from_image( std::vector<double> pixel ) const
{
VipsImage *image;
if( !(image = vips_image_new_from_image( this->get_image(),
&pixel[0], static_cast<int>( pixel.size() ) )) )
throw( VError() );
return( VImage( image ) );
}
/**
* Make a new image of the same size and type as self, but with each
* pixel initialized with the constant.
*/
VImage
new_from_image( double pixel ) const
{
return( new_from_image( to_vectorv( 1, pixel ) ) );
}
/**
* Make a new image by rendering self to a large memory area,
* wrapping a VImage around it, and copying all metadata over from
* self.
*/
VImage
copy_memory() const
{
VipsImage *image;
if( !(image = vips_image_copy_memory( this->get_image() )) )
throw( VError() );