22 int main(
int ,
char ** argv)
31 if(getenv(
"SRCDIR") != 0)
32 srcdir = getenv(
"SRCDIR");
35 string font =
"Helvetica";
43 cout <<
"Read images ..." << endl;
45 Image model( srcdir +
"model.miff" );
46 model.
label(
"Magick++" );
50 Image smile( srcdir +
"smile.miff" );
51 smile.
label(
"Smile" );
57 cout <<
"Creating thumbnails..." << endl;
62 null.
read(
"NULL:black" );
63 list<Image> images( 7, null );
65 Image example = model;
73 cout <<
" add noise ..." << endl;
74 example.
label(
"Add Noise" );
76 images.push_back( example );
78 cout <<
" add noise (blue) ..." << endl;
79 example.
label(
"Add Noise\n(Blue Channel)" );
81 images.push_back( example );
83 cout <<
" annotate ..." << endl;
85 example.
label(
"Annotate" );
91 example.
annotate(
"Magick++",
"+0+20", NorthGravity );
92 images.push_back( example );
94 cout <<
" blur ..." << endl;
96 example.
label(
"Blur" );
97 example.
blur( 0, 1.5 );
98 images.push_back( example );
100 cout <<
" blur red channel ..." << endl;
102 example.
label(
"Blur Channel\n(Red Channel)" );
104 images.push_back( example );
106 cout <<
" border ..." << endl;
108 example.
label(
"Border" );
111 images.push_back( example );
113 cout <<
" channel ..." << endl;
115 example.
label(
"Channel\n(Red Channel)" );
117 images.push_back( example );
119 cout <<
" charcoal ..." << endl;
121 example.
label(
"Charcoal" );
123 images.push_back( example );
125 cout <<
" composite ..." << endl;
127 example.
label(
"Composite" );
128 example.
composite( smile,
"+35+65", OverCompositeOp);
129 images.push_back( example );
131 cout <<
" contrast ..." << endl;
133 example.
label(
"Contrast" );
135 images.push_back( example );
137 cout <<
" convolve ..." << endl;
139 example.
label(
"Convolve" );
142 const double kernel[] = { 1, 1, 1, 1, 4, 1, 1, 1, 1 };
145 images.push_back( example );
147 cout <<
" crop ..." << endl;
149 example.
label(
"Crop" );
150 example.
crop(
"80x80+25+50" );
151 images.push_back( example );
153 cout <<
" despeckle ..." << endl;
155 example.
label(
"Despeckle" );
157 images.push_back( example );
159 cout <<
" draw ..." << endl;
161 example.
label(
"Draw" );
166 images.push_back( example );
168 cout <<
" edge ..." << endl;
170 example.
label(
"Detect Edges" );
172 images.push_back( example );
174 cout <<
" emboss ..." << endl;
176 example.
label(
"Emboss" );
178 images.push_back( example );
180 cout <<
" equalize ..." << endl;
182 example.
label(
"Equalize" );
184 images.push_back( example );
186 cout <<
" explode ..." << endl;
188 example.
label(
"Explode" );
191 images.push_back( example );
193 cout <<
" flip ..." << endl;
195 example.
label(
"Flip" );
197 images.push_back( example );
199 cout <<
" flop ..." << endl;
201 example.
label(
"Flop" );
203 images.push_back( example );
205 cout <<
" frame ..." << endl;
207 example.
label(
"Frame" );
209 images.push_back( example );
211 cout <<
" gamma ..." << endl;
213 example.
label(
"Gamma" );
214 example.
gamma( 1.6 );
215 images.push_back( example );
217 cout <<
" gaussian blur ..." << endl;
219 example.
label(
"Gaussian Blur" );
221 images.push_back( example );
223 cout <<
" gaussian blur channel ..." << endl;
225 example.
label(
"Gaussian Blur\n(Green Channel)" );
227 images.push_back( example );
229 cout <<
" gradient ..." << endl;
231 gradient.
size(
"130x194" );
232 gradient.
read(
"gradient:#20a0ff-#ffff00" );
233 gradient.
label(
"Gradient" );
234 images.push_back( gradient );
236 cout <<
" grayscale ..." << endl;
238 example.
label(
"Grayscale" );
241 images.push_back( example );
243 cout <<
" implode ..." << endl;
245 example.
label(
"Implode" );
247 images.push_back( example );
249 cout <<
" level ..." << endl;
251 example.
label(
"Level" );
252 example.
level( 0.20*QuantumRange, 0.90*QuantumRange, 1.20 );
253 images.push_back( example );
255 cout <<
" level red channel ..." << endl;
257 example.
label(
"Level Channel\n(Red Channel)" );
258 example.
levelChannel( RedChannel, 0.20*QuantumRange, 0.90*QuantumRange, 1.20 );
259 images.push_back( example );
261 cout <<
" median filter ..." << endl;
263 example.
label(
"Median Filter" );
265 images.push_back( example );
267 cout <<
" modulate ..." << endl;
269 example.
label(
"Modulate" );
271 images.push_back( example );
273 cout <<
" monochrome ..." << endl;
275 example.
label(
"Monochrome" );
280 images.push_back( example );
282 cout <<
" motion blur ..." << endl;
284 example.
label(
"Motion Blur" );
286 images.push_back( example );
288 cout <<
" negate ..." << endl;
290 example.
label(
"Negate" );
292 images.push_back( example );
294 cout <<
" normalize ..." << endl;
296 example.
label(
"Normalize" );
298 images.push_back( example );
300 cout <<
" oil paint ..." << endl;
302 example.
label(
"Oil Paint" );
304 images.push_back( example );
306 cout <<
" ordered dither 2x2 ..." << endl;
308 example.
label(
"Ordered Dither\n(2x2)" );
310 images.push_back( example );
312 cout <<
" ordered dither 3x3..." << endl;
314 example.
label(
"Ordered Dither\n(3x3)" );
316 images.push_back( example );
318 cout <<
" ordered dither 4x4..." << endl;
320 example.
label(
"Ordered Dither\n(4x4)" );
322 images.push_back( example );
324 cout <<
" ordered dither red 4x4..." << endl;
326 example.
label(
"Ordered Dither\n(Red 4x4)" );
328 images.push_back( example );
330 cout <<
" plasma ..." << endl;
332 plasma.
size(
"130x194" );
333 plasma.
read(
"plasma:fractal" );
334 plasma.
label(
"Plasma" );
335 images.push_back( plasma );
337 cout <<
" quantize ..." << endl;
339 example.
label(
"Quantize" );
341 images.push_back( example );
343 cout <<
" quantum operator ..." << endl;
345 example.
label(
"Quantum Operator\nRed * 0.4" );
347 images.push_back( example );
349 cout <<
" raise ..." << endl;
351 example.
label(
"Raise" );
353 images.push_back( example );
355 cout <<
" reduce noise ..." << endl;
357 example.
label(
"Reduce Noise" );
359 images.push_back( example );
361 cout <<
" resize ..." << endl;
363 example.
label(
"Resize" );
364 example.
zoom(
"50%" );
365 images.push_back( example );
367 cout <<
" roll ..." << endl;
369 example.
label(
"Roll" );
370 example.
roll(
"+20+10" );
371 images.push_back( example );
373 cout <<
" rotate ..." << endl;
375 example.
label(
"Rotate" );
378 images.push_back( example );
380 cout <<
" scale ..." << endl;
382 example.
label(
"Scale" );
383 example.
scale(
"60%" );
384 images.push_back( example );
386 cout <<
" segment ..." << endl;
388 example.
label(
"Segment" );
390 images.push_back( example );
392 cout <<
" shade ..." << endl;
394 example.
label(
"Shade" );
395 example.
shade( 30, 30,
false );
396 images.push_back( example );
398 cout <<
" sharpen ..." << endl;
400 example.
label(
"Sharpen");
402 images.push_back( example );
404 cout <<
" shave ..." << endl;
406 example.
label(
"Shave");
408 images.push_back( example );
410 cout <<
" shear ..." << endl;
412 example.
label(
"Shear" );
413 example.
shear( 45, 45 );
415 images.push_back( example );
417 cout <<
" spread ..." << endl;
419 example.
label(
"Spread" );
421 images.push_back( example );
423 cout <<
" solarize ..." << endl;
425 example.
label(
"Solarize" );
427 images.push_back( example );
429 cout <<
" swirl ..." << endl;
432 example.
label(
"Swirl" );
434 images.push_back( example );
436 cout <<
" threshold ..." << endl;
438 example.
label(
"Threshold" );
440 images.push_back( example );
442 cout <<
" threshold random ..." << endl;
444 example.
label(
"Random\nThreshold" );
446 (
size_t) (0.85*QuantumRange)) );
447 images.push_back( example );
449 cout <<
" unsharp mask ..." << endl;
451 example.
label(
"Unsharp Mask" );
454 images.push_back( example );
456 cout <<
" wave ..." << endl;
458 example.
label(
"Wave" );
459 example.
matte(
true );
461 example.
wave( 25, 150 );
462 images.push_back( example );
467 cout <<
"Montage images..." << endl;
469 for_each( images.begin(), images.end(),
fontImage( font ) );
473 montageOpts.
geometry(
"130x194+10+5>" );
474 montageOpts.gravity( CenterGravity );
475 montageOpts.borderColor(
"green" );
476 montageOpts.borderWidth( 1 );
477 montageOpts.tile(
"7x4" );
478 montageOpts.compose( OverCompositeOp );
479 montageOpts.backgroundColor(
"#ffffff" );
480 montageOpts.font( font );
481 montageOpts.pointSize( 18 );
482 montageOpts.fillColor(
"#600" );
483 montageOpts.strokeColor(
Color() );
484 montageOpts.compose(OverCompositeOp);
485 montageOpts.fileName(
"Magick++ Demo" );
486 montageImages( &montage, images.begin(), images.end(), montageOpts );
489 Image& montage_image = montage.front();
492 cout <<
"Adding logo image ..." << endl;
493 Image logo(
"logo:" );
498 montage_image.
composite( logo, placement, OverCompositeOp );
501 for_each( montage.begin(), montage.end(),
depthImage(8) );
502 for_each( montage.begin(), montage.end(),
matteImage(
false ) );
505 cout <<
"Writing image \"demo_out.miff\" ..." << endl;
506 writeImages(montage.begin(),montage.end(),
"demo_out_%d.miff");
513 catch( exception &error_ )
515 cout <<
"Caught exception: " << error_.what() << endl;
void swirl(const double degrees_)
class MagickPPExport Color
void modulate(const double brightness_, const double saturation_, const double hue_)
void annotate(const std::string &text_, const Geometry &location_)
void levelChannel(const ChannelType channel, const double black_point, const double white_point, const double mid_point=1.0)
void addNoise(const NoiseType noiseType_)
void charcoal(const double radius_=0.0, const double sigma_=1.0)
void blur(const double radius_=0.0, const double sigma_=1.0)
void medianFilter(const double radius_=0.0)
void composite(const Image &compositeImage_, const Geometry &offset_, const CompositeOperator compose_=InCompositeOp)
void unsharpmask(const double radius_, const double sigma_, const double amount_, const double threshold_)
void negate(const bool grayscale_=false)
void raise(const Geometry &geometry_=raiseGeometryDefault, const bool raisedFlag_=false)
void crop(const Geometry &geometry_)
void shade(const double azimuth_=30, const double elevation_=30, const bool colorShading_=false)
void zoom(const Geometry &geometry_)
void randomThresholdChannel(const Geometry &thresholds_, const ChannelType channel_)
void strokeWidth(const double strokeWidth_)
void blurChannel(const ChannelType channel_, const double radius_=0.0, const double sigma_=1.0)
void strokeColor(const Color &strokeColor_)
void level(const double black_point, const double white_point, const double mid_point=1.0)
void motionBlur(const double radius_, const double sigma_, const double angle_)
void emboss(const double radius_=0.0, const double sigma_=1.0)
void segment(const double clusterThreshold_=1.0, const double smoothingThreshold_=1.5)
void quantumOperator(const ChannelType channel_, const MagickEvaluateOperator operator_, double rvalue_)
void sharpen(const double radius_=0.0, const double sigma_=1.0)
void montageImages(Container *montageImages_, InputIterator first_, InputIterator last_, const Montage &options_)
void solarize(const double factor_=50.0)
size_t columns(void) const
void geometry(const Geometry &geometry_)
void quantize(const bool measureError_=false)
void read(const Blob &blob_)
void frame(const Geometry &geometry_=frameGeometryDefault)
void shave(const Geometry &geometry_)
void borderColor(const Color &color_)
void font(const std::string &font_)
void fontPointsize(const double pointSize_)
class MagickPPExport Geometry
void writeImages(InputIterator first_, InputIterator last_, const std::string &imageSpec_, bool adjoin_=true)
void spread(const size_t amount_=3)
void edge(const double radius_=0.0)
void fillColor(const Color &fillColor_)
void scale(const Geometry &geometry_)
void size(const Geometry &geometry_)
void draw(const Drawable &drawable_)
void label(const std::string &label_)
void contrast(const size_t sharpen_)
void implode(const double factor_)
void gaussianBlur(const double width_, const double sigma_)
void density(const Geometry &geomery_)
void wave(const double amplitude_=25.0, const double wavelength_=150.0)
void threshold(const double threshold_)
void convolve(const size_t order_, const double *kernel_)
void roll(const Geometry &roll_)
void randomThreshold(const Geometry &thresholds_)
void border(const Geometry &geometry_=borderGeometryDefault)
void gaussianBlurChannel(const ChannelType channel_, const double width_, const double sigma_)
void quantizeColors(const size_t colors_)
void channel(const ChannelType channel_)
MagickPPExport void InitializeMagick(const char *path_)
int main(int, char **argv)
void backgroundColor(const Color &color_)
void quantizeDither(const bool ditherFlag_)
void oilPaint(const double radius_=3.0)
void addNoiseChannel(const ChannelType channel_, const NoiseType noiseType_)
void quantizeColorSpace(const ColorspaceType colorSpace_)
void matte(const bool matteFlag_)
void shear(const double xShearAngle_, const double yShearAngle_)
void transparent(const Color &color_)
void rotate(const double degrees_)