File: STL.tex

package info (click to toggle)
imagemagick 6:6.0.6.2-2.9
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 33,284 kB
  • ctags: 14,844
  • sloc: ansic: 190,790; cpp: 17,203; sh: 8,740; perl: 4,190; makefile: 1,740; tcl: 459
file content (1353 lines) | stat: -rw-r--r-- 73,441 bytes parent folder | download
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
\section{Magick++ STL Support}
\scriptsize{
\begin{verbatim}

Magick++ provides a set of Standard Template Libary (STL) algorithms for
operating across ranges of image frames in a container. It also provides a
set of STL unary function objects to apply an operation on image frames in a
container via an algorithm which uses unary function objects. A good example
of a standard algorithm which is useful for processing containers of image
frames is the STL for_each algorithm which invokes a unary function object
on a range of container elements.

Magick++ uses a limited set of template argument types. The current template
argument types are:

     Container

          A container having the properties of a Back Insertion
          Sequence. Sequences support forward iterators and Back
          Insertion Sequences support the additional abilty to
          append an element via push_back(). Common compatable
          container types are the STL <vector> and <list> template
          containers. This template argument is usually used to
          represent an output container in which one or more image
          frames may be appended. Containers like STL <vector>
          which have a given default capacity may need to have
          their capacity adjusted via reserve() to a larger
          capacity in order to support the expected final size .
          Since Magick++ images are very small, it is likely that
          the default capacity of STL <vector> is sufficient for
          most situations.

     InputIterator

          An input iterator used to express a position in a
          container. These template arguments are typically used
          to represent a range of elements with first_
          representing the first element to be processed and last_
          representing the element to stop at. When processing the
          entire contents of a container, it is handy to know that
          STL containers usually provide the begin() and end()
          methods to return input interators which correspond with
          the first and last elements, respectively.

The following is an example of how frames from a GIF animation
"test_image_anim.gif" may be appended horizontally with the resulting image
written to the file "appended_image.miff":

#include <list>
#include <Magick++.h>
using namespace std;
using namespace Magick;

int main(int /*argc*/,char **/*argv*/)
{
   list<Image> imageList;
   readImages( &imageList, "test_image_anim.gif" );

   Image appended;
   appendImages( &appended, imageList.begin(), imageList.end() );
   appended.write( "appended_image.miff" );
   return 0;
}

The available Magick++ specific STL algorithms for operating on sequences of
image frames are shown in the following table:

                 Magick++ STL Algorithms For Image Sequences

 Algorithm         Signature                Description

                                            Animate a sequence of image
                                            frames. Image frames are
                                            displayed in succession,
 animateImages     InputIterator first_,    creating an animated effect.
                   InputIterator last_      The animation options are taken
                                            from the first image frame.
                                            This feature is only supported
                                            under X11 at the moment.

                                            Append a sequence of image
                                            frames, writing the result to
                                            appendedImage_. All the input
                                            image frames must have the same
                   Image *appendedImage_,   width or height. Image frames
                                            of the same width are stacked
 appendImages      InputIterator first_,    top-to-bottom. Image frames of
                   InputIterator last_,
                   bool stack_ = false      the same height are stacked
                                            left-to-right. If the stack_
                                            parameter is false, rectangular
                                            image frames are stacked
                                            left-to-right otherwise
                                            top-to-bottom.

                                            Average a sequence of image
                   Image *averagedImage_,   frames, writing the result to
 averageImages     InputIterator first_,    averagedImage_. All the input
                   InputIterator last_      image frames must be the same
                                            size in pixels.

                                            Merge a sequence of images.
                                            This is useful for GIF
 coalesceImages    InputIterator first_,    animation sequences that have
                   InputIterator last_      page offsets and disposal
                                            methods. The input images are
                                            modified in-place.

                                            Break down an image sequence
                                            into constituent parts.  This
                   Container                is useful for creating GIF or
                                            MNG animation sequences. The
 deconstructImages *deconstructedImages_,   input sequence is specified by
                   InputIterator first_,
                   InputIterator last_      first_ and last_, and the
                                            deconstruted images are
                                            returned via
                                            deconstructedImages_.

                                            Display a sequence of image
                                            frames. Through use of a pop-up
                                            menu, image frames may be
                                            selected in succession. This
                                            feature is fully supported
                                            under X11 but may have only
                                            limited support in other
 displayImages     InputIterator first_,    environments.
                   InputIterator last_
                                            Caution: if an image format is
                                            is not compatable with the
                                            display visual (e.g. JPEG on a
                                            colormapped display) then the
                                            original image will be altered.
                                            Use a copy of the original if
                                            this is a problem.

                                            Merge a sequence of image
                                            frames which represent image
                                            layers into a single composited
                   Image *flattendImage_,   representation. The
 flattenImages     InputIterator first_,    flattendImage_ parameter points
                   InputIterator last_      to an existing Image to update
                                            with the flattened image. This
                                            function is useful for
                                            combining Photoshop layers into
                                            a single image.

                                            Replace the colors of a
                   InputIterator first_,    sequence of images with the
                   InputIterator last_,     closest color from a reference
 mapImages         const Image& mapImage_,  image. Set dither_ to true to
                   bool dither_,  bool      enable dithering.  Set
                   measureError_ = false    measureError_ to true in order
                                            to evaluate quantization error.

                                            Create a composite image by
                                            combining several separate
                                            image frames. Multiple frames
                                            may be generated in the output
                   Container                container montageImages_
                   *montageImages_,         depending on the tile setting
                                            and the number of image frames
 montageImages     InputIterator first_,    montaged. Montage options are
                   InputIterator last_,
                   const Montage            provided via the parameter
                   &montageOpts_            montageOpts_. Options set in
                                            the first image frame
                                            (backgroundColor,borderColor,
                                            matteColor, penColor,font, and
                                            fontPointsize) are also used as
                                            options by montageImages().

                                            Morph a seqence of image
                                            frames. This algorithm  expands
                   Container                the number of image frames
                   *morphedImages_,         (output to the container
 morphImages       InputIterator first_,    morphedImages_) by adding the
                   InputIterator last_,     number of intervening frames
                   unsigned int frames_     specified by frames_ such that
                                            the original frames morph
                                            (blend) into each other when
                                            played as an animation.

                                            Inlay a number of images to
                                            form a single coherent picture.
                   Image *mosaicImage_,     The mosicImage_ argument is
 mosaicImages      InputIterator first_,    updated with a mosaic
                   InputIterator last_      constructed from the image
                                            sequence represented by first_
                                            through last_.

                                            Read a sequence of image frames
                   Container *sequence_,    into existing container
 readImages        const std::string        (appending to container
                   &imageSpec_              sequence_) with image names
                                            specified in the string
                                            imageSpec_.

                                            Read a sequence of image frames
                   Container *sequence_,    into existing container
                   const Blob &blob_        (appending to container
                                            sequence_) from Blob blob_.

                                            Write images in container to
                                            file specified by string
                                            imageSpec_. Set adjoin_ to
                                            false to write a set of image
                                            frames via a wildcard
                                            imageSpec_ (e.g.
                   InputIterator first_,    image%02d.miff).
                   InputIterator last_,     The wildcard must be one of
 writeImages       const std::string        %0Nd, %0No, or %0Nx.
                   &imageSpec_, bool        Caution: if an image format is
                   adjoin_ = true           selected which is capable of
                                            supporting fewer colors than
                                            the original image or
                                            quantization has been
                                            requested, the original image
                                            will be quantized to fewer
                                            colors. Use a copy of the
                                            original if this is a problem.

                                            Write images in container to
                                            in-memory BLOB specified by
                                            Blob blob_. Set adjoin_ to
                                            false to write a set of image
                                            frames via a wildcard
                                            imageSpec_ (e.g.
                   InputIterator first_,    image%02d.miff).
                   InputIterator last_,     Caution: if an image format is
                   Blob *blob_, bool        selected which is capable of
                   adjoin_ = true           supporting fewer colors than
                                            the original image or
                                            quantization has been
                                            requested, the original image
                                            will be quantized to fewer
                                            colors. Use a copy of the
                                            original if this is a problem.


                   InputIterator first_,    Quantize colors in images using
                                            current quantization settings.
 quantizeImages    InputIterator last_,     Set measureError_ to true in
                   bool measureError_ =
                   false                    order to measure quantization
                                            error.




Magick++ Unary Function Objects

Magick++ unary function objects inherit from the STL unary_function template
class . The STL unary_function template class is of the form

     unary_function<Arg, Result>

and expects that derived classes implement a method of the form:

     Result operator()( Arg argument_ );

which is invoked by algorithms using the function object. In the case of
unary function objects defined by Magick++, the invoked function looks like:

     void operator()( Image &image_);

with a typical implementation looking similar to:

     void operator()( Image &image_ )
       {
         image_.contrast( _sharpen );
       }

where contrast is an Image method and _sharpen is an argument stored within
the function object by its contructor. Since constructors may be
polymorphic, a given function object may have several constructors and
selects the appropriate Image method based on the arguments supplied.

In essence, unary function objects (as provided by Magick++) simply provide
the means to construct an object which caches arguments for later use by an
algorithm designed for use with unary function objects. There is a unary
function object corresponding each algorithm provided by the Image class and
there is a contructor available compatable with each synonymous method in
the Image class.

The unary function objects that Magick++ provides to support manipulating
images are shown in the following table:

           Magick++ Unary Function Objects For Image Manipulation

  Function Object    Constructor Signatures(s)          Description


 addNoiseImage     NoiseType noiseType_         Add noise to image with
                                                specified noise type.

                                                Annotate with text using
                                                specified text, bounding
                                                area, placement gravity,
 annotateImage     const std::string &text_,    and rotation. If
                   const Geometry &location_
                                                boundingArea_ is invalid,
                                                then bounding area is
                                                entire image.

                                                Annotate using specified
                   std::string text_, const     text, bounding area, and
                   Geometry &boundingArea_,     placement gravity. If
                   GravityType gravity_         boundingArea_ is invalid,
                                                then bounding area is
                                                entire image.

                                                Annotate with text using
                   const std::string &text_,    specified text, bounding
                                                area, placement gravity,
                   const Geometry               and rotation. If
                   &boundingArea_, GravityType
                   gravity_, double degrees_,   boundingArea_ is invalid,
                                                then bounding area is
                                                entire image.

                                                Annotate with text
                   const std::string &text_,    (bounding area is entire
                   GravityType gravity_         image) and placement
                                                gravity.

                                                Blur image. The radius_
                                                parameter specifies the
                                                radius of the Gaussian, in
 blurImage         const double radius_ = 1,    pixels, not counting the
                   const double sigma_ = 0.5    center pixel.  The sigma_
                                                parameter specifies the
                                                standard deviation of the
                                                Laplacian, in pixels.

                                                Border image (add border to
 borderImage       const Geometry &geometry_ =  image).  The color of the
                   "6x6+0+0"                    border is specified by the
                                                borderColor attribute.

                                                Charcoal effect image
                                                (looks like charcoal
                                                sketch). The radius_
                                                parameter specifies the
 charcoalImage     const double radius_ = 1,    radius of the Gaussian, in
                   const double sigma_ = 0.5    pixels, not counting the
                                                center pixel.  The sigma_
                                                parameter specifies the
                                                standard deviation of the
                                                Laplacian, in pixels.

                                                Chop image (remove vertical
 chopImage         const Geometry &geometry_    or horizontal subregion of
                                                image)

                   const unsigned int
                   opacityRed_, const unsigned  Colorize image with pen
 colorizeImage     int opacityGreen_, const     color, using specified
                   unsigned int opacityBlue_,   percent opacity for red,
                   const Color &penColor_       green, and blue quantums.

                                                Colorize image with pen
                   const unsigned int opacity_, color, using specified
                   const Color &penColor_
                                                percent opacity.

                                                Comment image (add comment
                                                string to image).  By
                                                default, each image is
                                                commented with its file
                                                name. Use  this  method to
 commentImage      const std::string &comment_  assign a specific comment
                                                to the image.  Optionally
                                                you can include the image
                                                filename, type, width,
                                                height, or other  image
                                                attributes by embedding
                                                special format characters.

                   const Image
                   &compositeImage_, int        Compose an image onto
 compositeImage    xOffset_, int yOffset_,      another at specified offset
                   CompositeOperator compose_ = and using specified
                   InCompositeOp                algorithm

                   const Image
                   &compositeImage_, const
                   Geometry &offset_,
                   CompositeOperator compose_ =
                   InCompositeOp

                                                Condense image
 condenseImage     void                         (Re-run-length encode image
                                                in memory).

                                                Contrast image (enhance
 contrastImage     unsigned int sharpen_        intensity differences in
                                                image)


 cropImage         const Geometry &geometry_    Crop image (subregion of
                                                original image)

 cycleColormap-
 Image             int amount_                  Cycle image colormap


 despeckleImage    void                         Despeckle image (reduce
                                                speckle noise)


 drawImage         const Drawable &drawable_    Draw shape or text on
                                                image.

                                                Draw shapes or text on
                                                image using a set of
                                                Drawable objects contained
                                                in an STL list. Use of this
                   const std::list<Drawable>    method improves drawing
                   &drawable_
                                                performance and allows
                                                batching draw objects
                                                together in a list for
                                                repeated use.

                                                Edge image (hilight edges
                                                in image).  The radius is
 edgeImage         unsigned int radius_ = 0.0   the radius of the pixel
                                                neighborhood.. Specify a
                                                radius of zero for
                                                automatic radius selection.

                                                Emboss image (hilight edges
                                                with 3D effect). The
                                                radius_ parameter specifies
                                                the radius of the Gaussian,
 embossImage       const double radius_ = 1,    in pixels, not counting the
                   const double sigma_ = 0.5
                                                center pixel.  The sigma_
                                                parameter specifies the
                                                standard deviation of the
                                                Laplacian, in pixels.


 enhanceImage      void                         Enhance image (minimize
                                                noise)


 equalizeImage     void                         Equalize image (histogram
                                                equalization)

                                                Flip image (reflect each
 flipImage         void                         scanline in the vertical
                                                direction)

                                                Flood-fill color across
                                                pixels that match the color
 floodFill-        unsigned int x_, unsigned    of the target pixel and are
 ColorImage        int y_, const Color          neighbors of the target
                   &fillColor_                  pixel. Uses current fuzz
                                                setting when determining
                                                color match.


                   const Geometry &point_,
                   const Color &fillColor_

                                                Flood-fill color across
                                                pixels starting at
                   unsigned int x_, unsigned    target-pixel and stopping
                   int y_, const Color          at pixels matching
                   &fillColor_, const Color     specified border color.
                   &borderColor_                Uses current fuzz setting
                                                when determining color
                                                match.

                   const Geometry &point_,
                   const Color &fillColor_,
                   const Color &borderColor_

                                                Flood-fill texture across
                                                pixels that match the color
 floodFill-        unsigned int x_, unsigned    of the target pixel and are
 TextureImage      int y_,  const Image         neighbors of the target
                   &texture_                    pixel. Uses current fuzz
                                                setting when determining
                                                color match.


                   const Geometry &point_,
                   const Image &texture_

                                                Flood-fill texture across
                                                pixels starting at
                   unsigned int x_, unsigned    target-pixel and stopping
                   int y_, const Image          at pixels matching
                   &texture_, const Color       specified border color.
                   &borderColor_                Uses current fuzz setting
                                                when determining color
                                                match.

                   const Geometry &point_,
                   const Image &texture_, const
                   Color &borderColor_

                                                Flop image (reflect each
 flopImage         void                         scanline in the horizontal
                                                direction)


 frameImage        const Geometry &geometry_ =  Add decorative frame around
                   "25x25+6+6"                  image

                   unsigned int width_,
                   unsigned int height_, int
                   x_, int y_, int innerBevel_
                   = 0, int outerBevel_ = 0

                                                Gamma correct image
 gammaImage        double gamma_                (uniform red, green, and
                                                blue correction).

                   double gammaRed_, double
                   gammaGreen_, double          Gamma correct red, green,
                   gammaBlue_                   and blue channels of image.

                                                Gaussian blur image. The
                                                number of neighbor pixels
                                                to be included in the
                                                convolution mask is
                                                specified by 'width_'.  For
 gaussianBlurImage double width_, double sigma_ example, a width of one
                                                gives a (standard) 3x3
                                                convolution mask. The
                                                standard deviation of the
                                                Gaussian bell curve is
                                                specified by 'sigma_'.


 implodeImage      double factor_               Implode image (special
                                                effect)

                                                Assign a label to an image.
                                                Use this option to  assign
                                                a  specific label to the
                                                image. Optionally you can
                                                include the image filename,
                                                type, width, height, or
                                                scene number in the label
                                                by embedding  special
 labelImage        const string &label_         format characters. If the
                                                first character of string
                                                is @, the image label is
                                                read from a file titled by
                                                the remaining characters in
                                                the string. When converting
                                                to Postscript, use this
                                                option to specify a header
                                                string to print above the
                                                image.

                                                Extract layer from image.
                                                Use this option to extract
                                                a particular layer from
 layerImage        LayerType layer_             the image.  MatteLayer,
                                                for  example, is useful for
                                                extracting the opacity
                                                values from an image.


 magnifyImage      void                         Magnify image by integral
                                                size

                                                Remap image colors with
                                                closest color from
                                                reference image. Set
                                                dither_ to true in to apply
                                                Floyd/Steinberg error
                                                diffusion to the image. By
 mapImage          const Image &mapImage_ ,     default, color reduction
                   bool dither_ = false         chooses an optimal  set  of
                                                colors that best represent
                                                the original image.
                                                Alternatively, you can
                                                choose  a  particular  set
                                                of colors  from  an image
                                                file with this option.


 matteFloodfill-   const Color &target_,        Floodfill designated area
 Image             unsigned int matte_, int x_, with a matte value
                   int y_, PaintMethod method_

                                                Filter image by replacing
 medianFilterImage const double radius_ = 0.0   each pixel component with
                                                the median color in a
                                                circular neighborhood


 minifyImage       void                         Reduce image by integral
                                                size

                                                Modulate percent hue,
 modulateImage     double brightness_, double   saturation, and brightness
                   saturation_, double hue_
                                                of an image

                                                Negate colors in image.
                                                Replace every pixel with
                                                its complementary color
 negateImage       bool grayscale_ = false      (white becomes black,
                                                yellow becomes blue,
                                                etc.).  Set grayscale to
                                                only negate grayscale
                                                values in image.

                                                Normalize image (increase
                                                contrast by normalizing the
 normalizeImage    void                         pixel values to span the
                                                full range of color
                                                values).


 oilPaintImage     unsigned int radius_ = 3     Oilpaint image (image looks
                                                like oil painting)

                                                Set or attenuate the
                                                opacity channel in the
                                                image. If the image pixels
                                                are opaque then they are
                                                set to the specified
                                                opacity value, otherwise
                                                they are blended with the
                                                supplied opacity value.
 opacityImage      unsigned int opacity_        The value of opacity_
                                                ranges from 0 (completely
                                                opaque) to MaxRGB. The
                                                defines OpaqueOpacity and
                                                TransparentOpacity are
                                                available to specify
                                                completely opaque or
                                                completely transparent,
                                                respectively.

                                                Change color of pixels
 opaqueImage       const Color &opaqueColor_,   matching opaqueColor_ to
                   const Color &penColor_
                                                specified penColor_.

                                                Quantize image (reduce
                                                number of colors). Set
 quantizeImage     bool measureError_ = false   measureError_ to true in
                                                order to calculate error
                                                attributes.


                   const Geometry &geometry_ =  Raise image (lighten or
 raiseImage        "6x6+0+0",  bool raisedFlag_ darken the edges of an
                   =  false                     image to give a 3-D raised
                                                or lowered effect)


 reduceNoise-                                   Reduce noise in image using
 Image             void                         a noise peak elimination
                                                filter.

                   unsigned int order_

                                                Roll image (rolls image
                                                vertically and
 rollImage         int columns_, int rows_      horizontally) by specified
                                                number of columnms and
                                                rows)

                                                Rotate image
 rotateImage       double degrees_              counter-clockwise by
                                                specified number of degrees


 sampleImage       const Geometry &geometry_    Resize image by using pixel
                                                sampling algorithm


 scaleImage        const Geometry &geometry_    Resize image by using
                                                simple ratio algorithm

                                                Segment (coalesce similar
                                                image components) by
                                                analyzing the histograms of
                                                the color components and
                                                identifying units that are
                                                homogeneous with the fuzzy
                                                c-means technique. Also
                                                uses quantizeColorSpace and
                                                verbose image attributes.
                   double clusterThreshold_ =   Specify clusterThreshold_,
 segmentImage      1.0,                         as the number  of  pixels
                   double smoothingThreshold_ = each cluster  must exceed
                   1.5                          the cluster threshold to be
                                                considered valid.
                                                SmoothingThreshold_
                                                eliminates noise in the
                                                second derivative of the
                                                histogram. As the value is
                                                increased, you can  expect
                                                a  smoother second
                                                derivative.  The default is
                                                1.5.

                                                Shade image using distant
                                                light source. Specify
                                                azimuth_ and elevation_ as
                                                the  position  of  the
                   double azimuth_ = 30, double light source. By default,
 shadeImage        elevation_ = 30,             the shading results as a
                   bool colorShading_ = false   grayscale image.. Set
                                                colorShading_ to true to
                                                shade the red, green, and
                                                blue components of the
                                                image.

                                                Sharpen pixels in image.
                                                The radius_ parameter
                                                specifies the radius of the
                                                Gaussian, in pixels, not
 sharpenImage      const double radius_ = 1,    counting the center pixel.
                   const double sigma_ = 0.5
                                                The sigma_ parameter
                                                specifies the standard
                                                deviation of the Laplacian,
                                                in pixels.


 shaveImage        const Geometry &geometry_    Shave pixels from image
                                                edges.

                                                Shear image (create
                                                parallelogram by sliding
                                                image by X or Y axis).
                                                Shearing slides one edge of
                                                an image along the X  or  Y
                                                axis,  creating  a
                                                parallelogram.  An X
                                                direction shear slides an
                                                edge along the X axis,
                                                while  a  Y  direction
                                                shear  slides  an edge
                                                along the Y axis.  The
 shearImage        double xShearAngle_, double  amount of the shear is
                   yShearAngle_                 controlled by a shear
                                                angle.  For X direction
                                                shears,  x  degrees is
                                                measured relative to the Y
                                                axis, and similarly, for Y
                                                direction shears  y
                                                degrees is measured
                                                relative to the X axis.
                                                Empty triangles left over
                                                from shearing the  image
                                                are filled  with  the
                                                color  defined as
                                                borderColor.

                                                Solarize image (similar to
                                                effect seen when exposing a
 solarizeImage     double factor_               photographic film to light
                                                during the development
                                                process)

                                                Spread pixels randomly
 spreadImage       unsigned int amount_ = 3     within image by specified
                                                amount

                                                Add a digital watermark to
 steganoImage      const Image &watermark_      the image (based on second
                                                image)

                                                Create an image which
                                                appears in stereo when
 stereoImage       const Image &rightImage_     viewed with red-blue
                                                glasses (Red image on left,
                                                blue on right)


 swirlImage        double degrees_              Swirl image (image pixels
                                                are rotated by degrees)


 textureImage      const Image &texture_        Layer a texture on image
                                                background

 thresholdImage    double threshold_            Threshold image

                                                Transform image based on
 transformImage    const Geometry               image and crop geometries.
                   &imageGeometry_
                                                Crop geometry is optional.

                   const Geometry
                   &imageGeometry_, const
                   Geometry &cropGeometry_

                                                Add matte image to image,
 transparentImage  const Color &color_          setting pixels matching
                                                color to transparent.

                                                Trim edges that are the
 trimImage         void                         background color from the
                                                image.


 waveImage         double amplitude_ = 25.0,    Alter an image along a sine
                   double wavelength_ = 150.0   wave.


 zoomImage         const Geometry &geometry_    Zoom image to specified
                                                size.


Function objects are available to set attributes on image frames which are
equivalent to methods in the Image object. These function objects allow
setting an option across a range of image frames using for_each().

The following code is an example of how the color 'red' may be set to
transparent in a GIF animation:

list<image> images;
readImages( &images, "animation.gif" );
for_each ( images.begin(), images.end(), transparentImage( "red" )  );
writeImages( images.begin(), images.end(), "animation.gif" );

The available function objects for setting image attributes are

                           Image Image Attributes

 Attribute         Type              Constructor       Description
                                     Signature(s)

                                                       Join images into a
 adjoinImage       bool              bool flag_        single multi-image
                                                       file.

                                                       Control antialiasing
                                                       of rendered
 antiAliasImage    bool              bool flag_        Postscript and
                                                       Postscript or
                                                       TrueType fonts.
                                                       Enabled by default.

                                                       Time in 1/100ths of
                                                       a second (0 to
                                                       65535) which must
                                                       expire before
                                                       displaying the next
 animation-        unsigned int (0   unsigned int      image in an animated
 DelayImage        to 65535)         delay_            sequence. This
                                                       option is useful for
                                                       regulating the
                                                       animation of a
                                                       sequence  of GIF
                                                       images within
                                                       Netscape.

                                                       Number of iterations
 animation-                          unsigned int      to loop an animation
 IterationsImage   unsigned int      iterations_       (e.g. Netscape loop
                                                       extension) for.

 background-                         const Color       Image background
 ColorImage        Color             &color_           color

 background-                         const string      Image to use as
 TextureImage      std::string       &texture_         background texture.

 borderColor-                         const Color
 Image             Color             &color_           Image border color

                                                       Base color that
 boxColorImage     Color             const Color       annotation text is
                                     &boxColor_
                                                       rendered on.


 chroma-                             float x_, float   Chromaticity blue
 BluePrimaryImage  float x & y       y_                primary point (e.g.
                                                       x=0.15, y=0.06)


 chroma-                             float x_, float   Chromaticity green
 GreenPrimaryImage float x & y       y_                primary point (e.g.
                                                       x=0.3, y=0.6)


 chroma-                             float x_, float   Chromaticity red
 RedPrimaryImage   float x & y       y_                primary point (e.g.
                                                       x=0.64, y=0.33)


 chroma-                             float x_, float   Chromaticity white
 WhitePointImage   float x & y       y_                point (e.g.
                                                       x=0.3127, y=0.329)

                                                       Colors within this
                                                       distance are
                                                       considered equal. A
                                                       number of algorithms
                                                       search for a target
 colorFuzzImage    double            double fuzz_      color. By default
                                                       the color must be
                                                       exact. Use this
                                                       option to match
                                                       colors that are
                                                       close to the target
                                                       color in RGB space.

                                     unsigned int
 colorMapImage     Color             index_, const     Color at
                                     Color &color_     color-pallet index.

                                                       The colorspace (e.g.
                                                       CMYK) used to
                                                       represent the image
 colorSpaceImage   ColorspaceType    ColorspaceType    pixel colors. Image
                                     colorSpace_       pixels are always
                                                       stored as RGB(A)
                                                       except for the case
                                                       of CMY(K).

                                                       Image compresion
 compressType-                       CompressionType   type. The default is
 Image             CompressionType   compressType_     the compression type
                                                       of the specified
                                                       image file.

                                                       Vertical and
                                                       horizontal
                                                       resolution in pixels
                                                       of the image. This
                                                       option specifies an
 densityImage      Geometry          const Geometry    image density when
                   (default 72x72)   &density_
                                                       decoding a
                                                       Postscript or
                                                       Portable Document
                                                       page. Often used
                                                       with psPageSize.

                                                       Image depth. Used to
                                                       specify the bit
                                                       depth when reading
                                                       or writing  raw
                                                       images or thwn the
 depthImage        unsigned int (8   unsigned int      output format
                   or 16)            depth_
                                                       supports multiple
                                                       depths. Defaults to
                                                       the quantum depth
                                                       that ImageMagick is
                                                       compiled with.

                                                       Specify (or obtain)
 endianImage       EndianType        EndianType        endian option for
                                     endian_           formats which
                                                       support it.

                                     const
 fileNameImage     std::string       std::string       Image file name.
                                     &fileName_

                                                       Color to use when
 fillColorImage    Color             const Color       filling drawn
                                     &fillColor_
                                                       objects

                                                       Filter to use when
                                                       resizing image. The
                                                       reduction filter
                                                       employed has a
                                                       sigificant effect on
                                                       the time required to
 filterTypeImage   FilterTypes       FilterTypes       resize an image and
                                     filterType_       the resulting
                                                       quality. The default
                                                       filter is Lanczos
                                                       which has been shown
                                                       to produce good
                                                       results when
                                                       reducing images.

                                                       Text rendering font.
                                                       If the font is a
                                                       fully qualified X
                                                       server font name,
                                                       the font is obtained
                                     const             from an X  server.
 fontImage         std::string       std::string       To use a TrueType
                                     &font_            font, precede the
                                                       TrueType filename
                                                       with an @.
                                                       Otherwise, specify
                                                       a  Postscript font
                                                       name (e.g.
                                                       "helvetica").

 fontPointsize-                      unsigned int      Text rendering font
 Image             unsigned int      pointSize_        point size

                   unsigned int
                   { 0 = Disposal
                   not specified,
                   1 = Do not                          GIF disposal method.
                   dispose of                          This option is used
                   graphic,                            to control how
 gifDispose-       3 = Overwrite     unsigned int      successive frames
 MethodImage       graphic with      disposeMethod_    are rendered (how
                   background color,                   the preceding frame
                                                       is disposed of) when
                   4 = Overwrite                       creating a GIF
                   graphic with                        animation.
                   previous graphic.
                   }

                                                       The type of
                                                       interlacing scheme
                                                       (default
                                                       NoInterlace). This
                                                       option is used to
                                                       specify the type of
                                                       interlacing scheme
                                                       for  raw  image
                                                       formats such as RGB
                                                       or YUV. NoInterlace
                                                       means do not
                                                       interlace,
                                                       LineInterlace uses
                                                       scanline
                                                       interlacing, and
 interlace-                          InterlaceType     PlaneInterlace uses
 TypeImage         InterlaceType     interlace_        plane interlacing.
                                                       PartitionInterlace
                                                       is like
                                                       PlaneInterlace
                                                       except the
                                                       different planes
                                                       are saved  to
                                                       individual files
                                                       (e.g.  image.R,
                                                       image.G, and
                                                       image.B). Use
                                                       LineInterlace or
                                                       PlaneInterlace to
                                                       create an interlaced
                                                       GIF or progressive
                                                       JPEG image.

                                                       Set image validity.
 isValidImage      bool              bool isValid_     Valid images become
                                                       empty (inValid) if
                                                       argument is false.

                                     const
 labelImage        std::string       std::string       Image label
                                     &label_

                                                       Line width for
 lineWidthImage    double            double            drawing lines,
                                     lineWidth_        circles, ellipses,
                                                       etc. See Drawable.

                                      const
 magickImage       std::string       std::string       Get image format
                                     &magick_          (e.g. "GIF")

                                                       True if the image
                                                       has transparency. If
                                                       set True, store
 matteImage        bool              bool matteFlag_   matte channel if
                                                       the image has one
                                                       otherwise create an
                                                       opaque one.


 matteColorImage   Color             const Color       Image matte
                                     &matteColor_      (transparent) color

 monochrome-                                           Transform the image
 Image             bool              bool flag_        to black and white

                                                       Preferred size and
                                                       location of an image
                                                       canvas.

                                                       Use this option to
                                                       specify the
                                                       dimensions and
                                                       position of the
                                                       Postscript page in
                                                       dots per inch or a
 pageImage         Geometry          const Geometry    TEXT page in pixels.
                                     &pageSize_
                                                       This option is
                                                       typically used in
                                                       concert with
                                                       density.

                                                       Page may also be
                                                       used to position a
                                                       GIF image (such as
                                                       for a scene in an
                                                       animation)

                                                       Pen color to use
 penColorImage     Color             const Color       when annotating on
                                     &penColor_
                                                       or drawing on image.

                                                       Texture image to
 penTextureImage   Image             const Image &     paint with (similar
                                     penTexture_
                                                       to penColor).

                                     unsigned int x_,
 pixelColorImage   Color             unsigned int y_,  Get/set pixel color
                                     const Color       at location x & y.
                                     &color_

                                                       Postscript page
                                                       size. Use this
                                                       option to specify
                                                       the dimensions  of
                                                       the Postscript page
 psPageSizeImage   Geometry          const Geometry    in dots per inch or
                                     &pageSize_
                                                       a TEXT page in
                                                       pixels. This option
                                                       is typically used in
                                                       concert with
                                                       density.

                                                       JPEG/MIFF/PNG
 qualityImage      unsigned int (0   unsigned int      compression level
                   to 100)           quality_
                                                       (default 75).

                                                       Preferred number of
                                                       colors in the image.
                                                       The actual number of
                                                       colors in the image
                                                       may be less than
 quantize-                           unsigned int      your request, but
 ColorsImage       unsigned int      colors_           never more. Images
                                                       with less unique
                                                       colors than
                                                       specified with this
                                                       option will have any
                                                       duplicate or unused
                                                       colors removed.

                                                       Colorspace to
                                                       quantize colors in
                                                       (default RGB).
                                                       Empirical evidence
                                                       suggests that
                                                       distances in color
                                                       spaces such as YUV
 quantize-                           ColorspaceType    or YIQ correspond to
 ColorSpaceImage   ColorspaceType    colorSpace_       perceptual color
                                                       differences more
                                                       closely than do
                                                       distances in RGB
                                                       space. These color
                                                       spaces may give
                                                       better results when
                                                       color reducing an
                                                       image.

                                                       Apply
                                                       Floyd/Steinberg
                                                       error diffusion to
                                                       the image. The basic
                                                       strategy of
                                                       dithering is to
                                                       trade  intensity
                                                       resolution  for
                                                       spatial  resolution
                                                       by  averaging the
                                                       intensities  of
 quantize-                                             several
 DitherImage       bool              bool flag_        neighboring  pixels.
                                                       Images which
                                                       suffer  from
                                                       severe  contouring
                                                       when  reducing
                                                       colors can be
                                                       improved with this
                                                       option. The
                                                       quantizeColors or
                                                       monochrome option
                                                       must be set for this
                                                       option to take
                                                       effect.

                                                       Depth of the
                                                       quantization color
                                                       classification tree.
                                                       Values of 0 or 1
                                                       allow selection of
 quantize-         unsigned int (0   unsigned int      the optimal tree
 TreeDepthImage    to 8)             treeDepth_        depth for the color
                                                       reduction algorithm.
                                                       Values between 2 and
                                                       8 may be used to
                                                       manually adjust the
                                                       tree depth.

 rendering-                          RenderingIntent   The type of
 IntentImage       RenderingIntent   render_           rendering intent

 resolution-                         ResolutionType    Units of image
 UnitsImage        ResolutionType    units_            resolution


 sceneImage        unsigned int      unsigned int      Image scene number
                                     scene_

                                                       Width and height of
                                                       a raw image (an
                                                       image which does not
                                                       support width and
                                                       height
 sizeImage         Geometry          const Geometry    information).  Size
                                     &geometry_        may also be used to
                                                       affect the image
                                                       size read from a
                                                       multi-resolution
                                                       format (e.g. Photo
                                                       CD, JBIG, or JPEG.

                                                       Color to use when
 strokeColorImage  Color             const Color       drawing object
                                     &strokeColor_
                                                       outlines


 subImageImage     unsigned int      unsigned int      Subimage of an image
                                     subImage_         sequence

                                                       Number of images
 subRangeImage     unsigned int      unsigned int      relative to the base
                                     subRange_
                                                       image

                                     const
 tileNameImage     std::string       std::string       Tile name
                                     &tileName_

 typeImage         ImageType         ImageType type_   Image storage type.

                                                       Print detailed
 verboseImage      bool              bool              information about
                                     verboseFlag_
                                                       the image

                                     const
 viewImage         std::string       std::string       FlashPix viewing
                                     &view_            parameters.


                                     const             X11 display to
 x11DisplayImage   std::string (e.g. std::string       display to, obtain
                   "hostname:0.0")                     fonts from, or to
                                     &display_
                                                       capture image from




Query Image Format Support

Magick++ provides the coderInfoList() function to support obtaining
information about the image formats supported by ImageMagick. Support for
image formats in ImageMagick is provided by modules known as "coders". A
user-provided container is updated based on a boolean truth-table match. The
truth-table supports matching based on whether ImageMagick can read the
format, write the format, or supports multiple frames for the format. A
wildcard specifier is supported for any "don't care" field. The data
obtained via coderInfoList() may be useful for preparing GUI dialog boxes or
for deciding which output format to write based on support within the
ImageMagick build.

The definition of coderInfoList is:

  class CoderInfo
  {
  public:

    enum MatchType {
      AnyMatch,  // match any coder
      TrueMatch, // match coder if true
      FalseMatch // match coder if false
    };

    [ remaining CoderInfo methods ]

   }

  template <class Container >
  void coderInfoList( Container *container_,
                      CoderInfo::MatchType isReadable_   =
CoderInfo::AnyMatch,
                      CoderInfo::MatchType isWritable_   =
CoderInfo::AnyMatch,
                      CoderInfo::MatchType isMultiFrame_ =
CoderInfo::AnyMatch
                      );

The following example shows how to retrieve a list of all of the coders
which support reading images and print the coder attributes (all listed
formats will be readable):

  list<CoderInfo> coderList;
  coderInfoList( &coderList,           // Reference to output list
                 CoderInfo::TrueMatch, // Match readable formats
                 CoderInfo::AnyMatch,  // Don't care about writable formats
                 CoderInfo::AnyMatch); // Don't care about multi-frame
support
  list<CoderInfo>::iterator entry = coderList.begin();
  while( entry != coderList.end() )
  {
    cout << entry->name() << ": (" << entry->description() << ") : ";
    cout << "Readable = ";
    if ( entry->isReadable() )
      cout << "true";
    else
      cout << "false";
    cout << ", ";
    cout << "Writable = ";
    if ( entry->isWritable() )
      cout << "true";
    else
      cout << "false";
    cout << ", ";
    cout << "Multiframe = ";
    if ( entry->isMultiframe() )
      cout << "true";
    else
      cout << "false";
    cout << endl;
   }


\end{verbatim}
}