00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050 #include "wand/studio.h"
00051 #include "wand/MagickWand.h"
00052 #include "wand/mogrify-private.h"
00053
00054
00055
00056
00057 #define ThrowFileException(exception,severity,tag,context) \
00058 { \
00059 (void) ThrowMagickException(exception,GetMagickModule(),severity, \
00060 tag == (const char *) NULL ? "unknown" : tag,"`%s': %s",context, \
00061 strerror(errno)); \
00062 }
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098 static MagickBooleanType ConcatenateImages(int argc,char **argv,
00099 ExceptionInfo *exception)
00100 {
00101 FILE
00102 *input,
00103 *output;
00104
00105 int
00106 c;
00107
00108 register long
00109 i;
00110
00111
00112
00113
00114 output=OpenMagickStream(argv[argc-1],"wb");
00115 if (output == (FILE *) NULL)
00116 {
00117 ThrowFileException(exception,FileOpenError,"UnableToOpenFile",
00118 argv[argc-1]);
00119 return(MagickFalse);
00120 }
00121 for (i=2; i < (long) (argc-1); i++)
00122 {
00123 input=OpenMagickStream(argv[i],"rb");
00124 if (input == (FILE *) NULL)
00125 ThrowFileException(exception,FileOpenError,"UnableToOpenFile",argv[i]);
00126 for (c=fgetc(input); c != EOF; c=fgetc(input))
00127 (void) fputc((char) c,output);
00128 (void) fclose(input);
00129 (void) remove(argv[i]);
00130 }
00131 (void) fclose(output);
00132 return(MagickTrue);
00133 }
00134
00135 static void ConvertUsage(void)
00136 {
00137 static const char
00138 *miscellaneous[]=
00139 {
00140 "-debug events display copious debugging information",
00141 "-help print program options",
00142 "-list type print a list of supported option arguments",
00143 "-log format format of debugging information",
00144 "-version print version information",
00145 (char *) NULL
00146 },
00147 *operators[]=
00148 {
00149 "-adaptive-blur geometry",
00150 " adaptively blur pixels; decrease effect near edges",
00151 "-adaptive-resize geometry",
00152 " adaptively resize image using 'mesh' interpolation",
00153 "-adaptive-sharpen geometry",
00154 " adaptively sharpen pixels; increase effect near edges",
00155 "-alpha option activate, deactivate, reset, or set the alpha channel",
00156 "-annotate geometry text",
00157 " annotate the image with text",
00158 "-auto-orient automatically orient image",
00159 "-bench iterations measure performance",
00160 "-black-threshold value",
00161 " force all pixels below the threshold into black",
00162 "-blur geometry reduce image noise and reduce detail levels",
00163 "-border geometry surround image with a border of color",
00164 "-bordercolor color border color",
00165 "-charcoal radius simulate a charcoal drawing",
00166 "-chop geometry remove pixels from the image interior",
00167 "-clip clip along the first path from the 8BIM profile",
00168 "-clip-mask filename associate a clip mask with the image",
00169 "-clip-path id clip along a named path from the 8BIM profile",
00170 "-colorize value colorize the image with the fill color",
00171 "-contrast enhance or reduce the image contrast",
00172 "-contrast-stretch geometry",
00173 " improve contrast by `stretching' the intensity range",
00174 "-convolve coefficients",
00175 " apply a convolution kernel to the image",
00176 "-cycle amount cycle the image colormap",
00177 "-decipher filename convert cipher pixels to plain pixels",
00178 "-deskew threshold straighten an image",
00179 "-despeckle reduce the speckles within an image",
00180 "-distort method args",
00181 " distort images according to given method ad args",
00182 "-draw string annotate the image with a graphic primitive",
00183 "-edge radius apply a filter to detect edges in the image",
00184 "-encipher filename convert plain pixels to cipher pixels",
00185 "-emboss radius emboss an image",
00186 "-enhance apply a digital filter to enhance a noisy image",
00187 "-equalize perform histogram equalization to an image",
00188 "-evaluate operator value",
00189 " evaluate an arithmetic, relational, or logical",
00190 " expression",
00191 "-extent geometry set the image size",
00192 "-extract geometry extract area from image",
00193 "-flip flip image vertically",
00194 "-floodfill geometry color",
00195 " floodfill the image with color",
00196 "-flop flop image horizontally",
00197 "-frame geometry surround image with an ornamental border",
00198 "-gamma value level of gamma correction",
00199 "-gaussian-blur geometry",
00200 " reduce image noise and reduce detail levels",
00201 "-geometry geometry perferred size or location of the image",
00202 "-identify identify the format and characteristics of the image",
00203 "-implode amount implode image pixels about the center",
00204 "-lat geometry local adaptive thresholding",
00205 "-layers method optimize, merge, or compare image layers",
00206 "-level value adjust the level of image contrast",
00207 "-level-colors color,color",
00208 " level image using given colors",
00209 "-linear-stretch geometry",
00210 " improve contrast by `stretching with saturation'",
00211 "-liquid-rescale geometry",
00212 " rescale image with seam-carving",
00213 "-median radius apply a median filter to the image",
00214 "-modulate value vary the brightness, saturation, and hue",
00215 "-monochrome transform image to black and white",
00216 "-motion-blur geometry",
00217 " simulate motion blur",
00218 "-negate replace every pixel with its complementary color ",
00219 "-noise radius add or reduce noise in an image",
00220 "-normalize transform image to span the full range of colors",
00221 "-opaque color change this color to the fill color",
00222 "-ordered-dither NxN",
00223 " add a noise pattern to the image with specific",
00224 " amplitudes",
00225 "-paint radius simulate an oil painting",
00226 "-polaroid angle simulate a Polaroid picture",
00227 "-posterize levels reduce the image to a limited number of color levels",
00228 "-print string interpret string and print to console",
00229 "-profile filename add, delete, or apply an image profile",
00230 "-quantize colorspace reduce colors in this colorspace",
00231 "-radial-blur angle radial blur the image",
00232 "-raise value lighten/darken image edges to create a 3-D effect",
00233 "-random-threshold low,high",
00234 " random threshold the image",
00235 "-recolor matrix translate, scale, shear, or rotate image colors",
00236 "-region geometry apply options to a portion of the image",
00237 "-render render vector graphics",
00238 "-repage geometry size and location of an image canvas",
00239 "-resample geometry change the resolution of an image",
00240 "-resize geometry resize the image",
00241 "-roll geometry roll an image vertically or horizontally",
00242 "-rotate degrees apply Paeth rotation to the image",
00243 "-sample geometry scale image with pixel sampling",
00244 "-scale geometry scale the image",
00245 "-segment values segment an image",
00246 "-sepia-tone threshold",
00247 " simulate a sepia-toned photo",
00248 "-set property value set an image property",
00249 "-shade degrees shade the image using a distant light source",
00250 "-shadow geometry simulate an image shadow",
00251 "-sharpen geometry sharpen the image",
00252 "-shave geometry shave pixels from the image edges",
00253 "-shear geometry slide one edge of the image along the X or Y axis",
00254 "-sigmoidal-contrast geometry",
00255 " increase the contrast without saturating highlights or shadows",
00256 "-sketch geometry simulate a pencil sketch",
00257 "-solarize threshold negate all pixels above the threshold level",
00258 "-sparse-color method args",
00259 " fill in a image based on a few color points",
00260 "-splice geometry splice the background color into the image",
00261 "-spread radius displace image pixels by a random amount",
00262 "-strip strip image of all profiles and comments",
00263 "-swirl degrees swirl image pixels about the center",
00264 "-threshold value threshold the image",
00265 "-thumbnail geometry create a thumbnail of the image",
00266 "-tile filename tile image when filling a graphic primitive",
00267 "-tint value tint the image with the fill color",
00268 "-transform affine transform image",
00269 "-transparent color make this color transparent within the image",
00270 "-transpose flip image vertically and rotate 90 degrees",
00271 "-transverse flop image horizontally and rotate 270 degrees",
00272 "-trim trim image edges",
00273 "-type type image type",
00274 "-unique-colors discard all but one of any pixel color",
00275 "-unsharp geometry sharpen the image",
00276 "-vignette geometry soften the edges of the image in vignette style",
00277 "-wave geometry alter an image along a sine wave",
00278 "-white-threshold value",
00279 " force all pixels above the threshold into white",
00280 (char *) NULL
00281 },
00282 *sequence_operators[]=
00283 {
00284 "-append append an image sequence",
00285 "-average average an image sequence",
00286 "-clut apply a color lookup table to the image",
00287 "-coalesce merge a sequence of images",
00288 "-combine combine a sequence of images",
00289 "-composite composite image",
00290 "-crop geometry cut out a rectangular region of the image",
00291 "-deconstruct break down an image sequence into constituent parts",
00292 "-flatten flatten a sequence of images",
00293 "-fx expression apply mathematical expression to an image channel(s)",
00294 "-morph value morph an image sequence",
00295 "-mosaic create a mosaic from an image sequence",
00296 "-process arguments process the image with a custom image filter",
00297 "-reverse reverse image sequence",
00298 "-separate separate an image channel into a grayscale image",
00299 "-write filename write images to this file",
00300 (char *) NULL
00301 },
00302 *settings[]=
00303 {
00304 "-adjoin join images into a single multi-image file",
00305 "-affine matrix affine transform matrix",
00306 "-alpha option activate, deactivate, reset, or set the alpha channel",
00307 "-antialias remove pixel-aliasing",
00308 "-authenticate password",
00309 " decipher image with this password",
00310 "-attenuate value lessen (or intensify) when adding noise to an image",
00311 "-background color background color",
00312 "-bias value add bias when convolving an image",
00313 "-black-point-compensation",
00314 " use black point compensation",
00315 "-blue-primary point chromaticity blue primary point",
00316 "-bordercolor color border color",
00317 "-caption string assign a caption to an image",
00318 "-channel type apply option to select image channels",
00319 "-colors value preferred number of colors in the image",
00320 "-colorspace type alternate image colorspace",
00321 "-comment string annotate image with comment",
00322 "-compose operator set image composite operator",
00323 "-compress type type of pixel compression when writing the image",
00324 "-define format:option",
00325 " define one or more image format options",
00326 "-delay value display the next image after pausing",
00327 "-density geometry horizontal and vertical density of the image",
00328 "-depth value image depth",
00329 "-display server get image or font from this X server",
00330 "-dispose method layer disposal method",
00331 "-dither method apply error diffusion to image",
00332 "-encoding type text encoding type",
00333 "-endian type endianness (MSB or LSB) of the image",
00334 "-family name render text with this font family",
00335 "-fill color color to use when filling a graphic primitive",
00336 "-filter type use this filter when resizing an image",
00337 "-font name render text with this font",
00338 "-format \"string\" output formatted image characteristics",
00339 "-fuzz distance colors within this distance are considered equal",
00340 "-gravity type horizontal and vertical text placement",
00341 "-green-primary point chromaticity green primary point",
00342 "-intent type type of rendering intent when managing the image color",
00343 "-interlace type type of image interlacing scheme",
00344 "-interpolate method pixel color interpolation method",
00345 "-label string assign a label to an image",
00346 "-limit type value pixel cache resource limit",
00347 "-loop iterations add Netscape loop extension to your GIF animation",
00348 "-mask filename associate a mask with the image",
00349 "-mattecolor color frame color",
00350 "-monitor monitor progress",
00351 "-orient type image orientation",
00352 "-page geometry size and location of an image canvas (setting)",
00353 "-ping efficiently determine image attributes",
00354 "-pointsize value font point size",
00355 "-preview type image preview type",
00356 "-quality value JPEG/MIFF/PNG compression level",
00357 "-quiet suppress all warning messages",
00358 "-red-primary point chromaticity red primary point",
00359 "-regard-warnings pay attention to warning messages",
00360 "-remap filename transform image colors to match this set of colors",
00361 "-respect-parenthesis settings remain in effect until parenthesis boundary",
00362 "-sampling-factor geometry",
00363 " horizontal and vertical sampling factor",
00364 "-scene value image scene number",
00365 "-seed value seed a new sequence of pseudo-random numbers",
00366 "-size geometry width and height of image",
00367 "-stretch type render text with this font stretch",
00368 "-stroke color graphic primitive stroke color",
00369 "-strokewidth value graphic primitive stroke width",
00370 "-style type render text with this font style",
00371 "-taint image as ineligible for bi-modal delegate",
00372 "-texture filename name of texture to tile onto the image background",
00373 "-tile-offset geometry",
00374 " tile offset",
00375 "-treedepth value color tree depth",
00376 "-transparent-color color",
00377 " transparent color",
00378 "-undercolor color annotation bounding box color",
00379 "-units type the units of image resolution",
00380 "-verbose print detailed information about the image",
00381 "-view FlashPix viewing transforms",
00382 "-virtual-pixel method",
00383 " virtual pixel access method",
00384 "-weight type render text with this font weight",
00385 "-white-point point chromaticity white point",
00386 (char *) NULL
00387 },
00388 *stack_operators[]=
00389 {
00390 "-clone index clone an image",
00391 "-delete index delete the image from the image sequence",
00392 "-insert index insert last image into the image sequence",
00393 "-swap indexes swap two images in the image sequence",
00394 (char *) NULL
00395 };
00396
00397 const char
00398 **p;
00399
00400 (void) printf("Version: %s\n",GetMagickVersion((unsigned long *) NULL));
00401 (void) printf("Copyright: %s\n\n",GetMagickCopyright());
00402 (void) printf("Usage: %s [options ...] file [ [options ...] "
00403 "file ...] [options ...] file\n",GetClientName());
00404 (void) printf("\nImage Settings:\n");
00405 for (p=settings; *p != (char *) NULL; p++)
00406 (void) printf(" %s\n",*p);
00407 (void) printf("\nImage Operators:\n");
00408 for (p=operators; *p != (char *) NULL; p++)
00409 (void) printf(" %s\n",*p);
00410 (void) printf("\nImage Sequence Operators:\n");
00411 for (p=sequence_operators; *p != (char *) NULL; p++)
00412 (void) printf(" %s\n",*p);
00413 (void) printf("\nImage Stack Operators:\n");
00414 for (p=stack_operators; *p != (char *) NULL; p++)
00415 (void) printf(" %s\n",*p);
00416 (void) printf("\nMiscellaneous Options:\n");
00417 for (p=miscellaneous; *p != (char *) NULL; p++)
00418 (void) printf(" %s\n",*p);
00419 (void) printf(
00420 "\nBy default, the image format of `file' is determined by its magic\n");
00421 (void) printf(
00422 "number. To specify a particular image format, precede the filename\n");
00423 (void) printf(
00424 "with an image format name and a colon (i.e. ps:image) or specify the\n");
00425 (void) printf(
00426 "image type as the filename suffix (i.e. image.ps). Specify 'file' as\n");
00427 (void) printf("'-' for standard input or output.\n");
00428 exit(0);
00429 }
00430
00431 WandExport MagickBooleanType ConvertImageCommand(ImageInfo *image_info,
00432 int argc,char **argv,char **metadata,ExceptionInfo *exception)
00433 {
00434 #define NotInitialized (unsigned int) (~0)
00435 #define DestroyConvert() \
00436 { \
00437 DestroyImageStack(); \
00438 for (i=0; i < (long) argc; i++) \
00439 argv[i]=DestroyString(argv[i]); \
00440 argv=(char **) RelinquishMagickMemory(argv); \
00441 }
00442 #define ThrowConvertException(asperity,tag,option) \
00443 { \
00444 (void) ThrowMagickException(exception,GetMagickModule(),asperity,tag,"`%s'", \
00445 option); \
00446 DestroyConvert(); \
00447 return(MagickFalse); \
00448 }
00449 #define ThrowConvertInvalidArgumentException(option,argument) \
00450 { \
00451 (void) ThrowMagickException(exception,GetMagickModule(),OptionError, \
00452 "InvalidArgument","`%s': %s",argument,option); \
00453 DestroyConvert(); \
00454 return(MagickFalse); \
00455 }
00456
00457 char
00458 *filename,
00459 *option;
00460
00461 const char
00462 *format;
00463
00464 Image
00465 *image;
00466
00467 ImageStack
00468 image_stack[MaxImageStackDepth+1];
00469
00470 long
00471 j,
00472 k;
00473
00474 MagickBooleanType
00475 fire,
00476 pend;
00477
00478 MagickStatusType
00479 status;
00480
00481 register long
00482 i;
00483
00484
00485
00486
00487 assert(image_info != (ImageInfo *) NULL);
00488 assert(image_info->signature == MagickSignature);
00489 if (image_info->debug != MagickFalse)
00490 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
00491 assert(exception != (ExceptionInfo *) NULL);
00492 if (argc == 2)
00493 {
00494 option=argv[1];
00495 if ((LocaleCompare("version",option+1) == 0) ||
00496 (LocaleCompare("-version",option+1) == 0))
00497 {
00498 (void) fprintf(stdout,"Version: %s\n",
00499 GetMagickVersion((unsigned long *) NULL));
00500 (void) fprintf(stdout,"Copyright: %s\n\n",GetMagickCopyright());
00501 return(MagickTrue);
00502 }
00503 }
00504 if (argc < 3)
00505 ConvertUsage();
00506 filename=(char *) NULL;
00507 format="%w,%h,%m";
00508 j=1;
00509 k=0;
00510 NewImageStack();
00511 option=(char *) NULL;
00512 pend=MagickFalse;
00513 status=MagickTrue;
00514
00515
00516
00517 ReadCommandlLine(argc,&argv);
00518 status=ExpandFilenames(&argc,&argv);
00519 if (status == MagickFalse)
00520 ThrowConvertException(ResourceLimitError,"MemoryAllocationFailed",
00521 strerror(errno));
00522 if ((argc > 2) && (LocaleCompare("-concatenate",argv[1]) == 0))
00523 return(ConcatenateImages(argc,argv,exception));
00524 for (i=1; i < (long) (argc-1); i++)
00525 {
00526 option=argv[i];
00527 if (LocaleCompare(option,"(") == 0)
00528 {
00529 FireImageStack(MagickTrue,MagickTrue,pend);
00530 if (k == MaxImageStackDepth)
00531 ThrowConvertException(OptionError,"ParenthesisNestedTooDeeply",
00532 option);
00533 PushImageStack();
00534 continue;
00535 }
00536 if (LocaleCompare(option,")") == 0)
00537 {
00538 FireImageStack(MagickTrue,MagickTrue,MagickTrue);
00539 if (k == 0)
00540 ThrowConvertException(OptionError,"UnableToParseExpression",option);
00541 PopImageStack();
00542 continue;
00543 }
00544 if (IsMagickOption(option) == MagickFalse)
00545 {
00546 Image
00547 *images;
00548
00549
00550
00551
00552 FireImageStack(MagickTrue,MagickTrue,pend);
00553 filename=argv[i];
00554 if ((LocaleCompare(filename,"--") == 0) && (i < (argc-1)))
00555 filename=argv[++i];
00556 (void) CopyMagickString(image_info->filename,filename,MaxTextExtent);
00557 if (image_info->ping != MagickFalse)
00558 images=PingImages(image_info,exception);
00559 else
00560 images=ReadImages(image_info,exception);
00561 status&=(images != (Image *) NULL) &&
00562 (exception->severity < ErrorException);
00563 if (images == (Image *) NULL)
00564 continue;
00565 AppendImageStack(images);
00566 continue;
00567 }
00568 pend=image != (Image *) NULL ? MagickTrue : MagickFalse;
00569 switch (*(option+1))
00570 {
00571 case 'a':
00572 {
00573 if (LocaleCompare("adaptive-blur",option+1) == 0)
00574 {
00575 i++;
00576 if (i == (long) (argc-1))
00577 ThrowConvertException(OptionError,"MissingArgument",option);
00578 if (IsGeometry(argv[i]) == MagickFalse)
00579 ThrowConvertInvalidArgumentException(option,argv[i]);
00580 break;
00581 }
00582 if (LocaleCompare("adaptive-resize",option+1) == 0)
00583 {
00584 i++;
00585 if (i == (long) (argc-1))
00586 ThrowConvertException(OptionError,"MissingArgument",option);
00587 if (IsGeometry(argv[i]) == MagickFalse)
00588 ThrowConvertInvalidArgumentException(option,argv[i]);
00589 break;
00590 }
00591 if (LocaleCompare("adaptive-sharpen",option+1) == 0)
00592 {
00593 i++;
00594 if (i == (long) (argc-1))
00595 ThrowConvertException(OptionError,"MissingArgument",option);
00596 if (IsGeometry(argv[i]) == MagickFalse)
00597 ThrowConvertInvalidArgumentException(option,argv[i]);
00598 break;
00599 }
00600 if (LocaleCompare("adjoin",option+1) == 0)
00601 break;
00602 if (LocaleCompare("affine",option+1) == 0)
00603 {
00604 if (*option == '+')
00605 break;
00606 i++;
00607 if (i == (long) (argc-1))
00608 ThrowConvertException(OptionError,"MissingArgument",option);
00609 if (IsGeometry(argv[i]) == MagickFalse)
00610 ThrowConvertInvalidArgumentException(option,argv[i]);
00611 break;
00612 }
00613 if (LocaleCompare("alpha",option+1) == 0)
00614 {
00615 long
00616 type;
00617
00618 if (*option == '+')
00619 break;
00620 i++;
00621 if (i == (long) argc)
00622 ThrowConvertException(OptionError,"MissingArgument",option);
00623 type=ParseMagickOption(MagickAlphaOptions,MagickFalse,argv[i]);
00624 if (type < 0)
00625 ThrowConvertException(OptionError,"UnrecognizedAlphaChannelType",
00626 argv[i]);
00627 break;
00628 }
00629 if (LocaleCompare("annotate",option+1) == 0)
00630 {
00631 if (*option == '+')
00632 break;
00633 i++;
00634 if (i == (long) (argc-1))
00635 ThrowConvertException(OptionError,"MissingArgument",option);
00636 if (IsGeometry(argv[i]) == MagickFalse)
00637 ThrowConvertInvalidArgumentException(option,argv[i]);
00638 if (i == (long) (argc-1))
00639 ThrowConvertException(OptionError,"MissingArgument",option);
00640 i++;
00641 break;
00642 }
00643 if (LocaleCompare("antialias",option+1) == 0)
00644 break;
00645 if (LocaleCompare("append",option+1) == 0)
00646 break;
00647 if (LocaleCompare("authenticate",option+1) == 0)
00648 {
00649 if (*option == '+')
00650 break;
00651 i++;
00652 if (i == (long) (argc-1))
00653 ThrowConvertException(OptionError,"MissingArgument",option);
00654 break;
00655 }
00656 if (LocaleCompare("auto-orient",option+1) == 0)
00657 break;
00658 if (LocaleCompare("average",option+1) == 0)
00659 break;
00660 ThrowConvertException(OptionError,"UnrecognizedOption",option)
00661 }
00662 case 'b':
00663 {
00664 if (LocaleCompare("background",option+1) == 0)
00665 {
00666 if (*option == '+')
00667 break;
00668 i++;
00669 if (i == (long) (argc-1))
00670 ThrowConvertException(OptionError,"MissingArgument",option);
00671 break;
00672 }
00673 if (LocaleCompare("bench",option+1) == 0)
00674 {
00675 if (*option == '+')
00676 break;
00677 i++;
00678 if (i == (long) (argc-1))
00679 ThrowConvertException(OptionError,"MissingArgument",option);
00680 if (IsGeometry(argv[i]) == MagickFalse)
00681 ThrowConvertInvalidArgumentException(option,argv[i]);
00682 break;
00683 }
00684 if (LocaleCompare("bias",option+1) == 0)
00685 {
00686 if (*option == '+')
00687 break;
00688 i++;
00689 if (i == (long) (argc-1))
00690 ThrowConvertException(OptionError,"MissingArgument",option);
00691 if (IsGeometry(argv[i]) == MagickFalse)
00692 ThrowConvertInvalidArgumentException(option,argv[i]);
00693 break;
00694 }
00695 if (LocaleCompare("black-point-compensation",option+1) == 0)
00696 break;
00697 if (LocaleCompare("black-threshold",option+1) == 0)
00698 {
00699 if (*option == '+')
00700 break;
00701 i++;
00702 if (i == (long) (argc-1))
00703 ThrowConvertException(OptionError,"MissingArgument",option);
00704 if (IsGeometry(argv[i]) == MagickFalse)
00705 ThrowConvertInvalidArgumentException(option,argv[i]);
00706 break;
00707 }
00708 if (LocaleCompare("blue-primary",option+1) == 0)
00709 {
00710 if (*option == '+')
00711 break;
00712 i++;
00713 if (i == (long) (argc-1))
00714 ThrowConvertException(OptionError,"MissingArgument",option);
00715 if (IsGeometry(argv[i]) == MagickFalse)
00716 ThrowConvertInvalidArgumentException(option,argv[i]);
00717 break;
00718 }
00719 if (LocaleCompare("blur",option+1) == 0)
00720 {
00721 if (*option == '+')
00722 break;
00723 i++;
00724 if (i == (long) (argc-1))
00725 ThrowConvertException(OptionError,"MissingArgument",option);
00726 if (IsGeometry(argv[i]) == MagickFalse)
00727 ThrowConvertInvalidArgumentException(option,argv[i]);
00728 break;
00729 }
00730 if (LocaleCompare("border",option+1) == 0)
00731 {
00732 if (*option == '+')
00733 break;
00734 i++;
00735 if (i == (long) (argc-1))
00736 ThrowConvertException(OptionError,"MissingArgument",option);
00737 if (IsGeometry(argv[i]) == MagickFalse)
00738 ThrowConvertInvalidArgumentException(option,argv[i]);
00739 break;
00740 }
00741 if (LocaleCompare("bordercolor",option+1) == 0)
00742 {
00743 if (*option == '+')
00744 break;
00745 i++;
00746 if (i == (long) (argc-1))
00747 ThrowConvertException(OptionError,"MissingArgument",option);
00748 break;
00749 }
00750 if (LocaleCompare("box",option+1) == 0)
00751 {
00752 if (*option == '+')
00753 break;
00754 i++;
00755 if (i == (long) (argc-1))
00756 ThrowConvertException(OptionError,"MissingArgument",option);
00757 break;
00758 }
00759 ThrowConvertException(OptionError,"UnrecognizedOption",option)
00760 }
00761 case 'c':
00762 {
00763 if (LocaleCompare("cache",option+1) == 0)
00764 {
00765 if (*option == '+')
00766 break;
00767 i++;
00768 if (i == (long) (argc-1))
00769 ThrowConvertException(OptionError,"MissingArgument",option);
00770 if (IsGeometry(argv[i]) == MagickFalse)
00771 ThrowConvertInvalidArgumentException(option,argv[i]);
00772 break;
00773 }
00774 if (LocaleCompare("caption",option+1) == 0)
00775 {
00776 if (*option == '+')
00777 break;
00778 i++;
00779 if (i == (long) argc)
00780 ThrowConvertException(OptionError,"MissingArgument",option);
00781 break;
00782 }
00783 if (LocaleCompare("channel",option+1) == 0)
00784 {
00785 long
00786 channel;
00787
00788 if (*option == '+')
00789 break;
00790 i++;
00791 if (i == (long) (argc-1))
00792 ThrowConvertException(OptionError,"MissingArgument",option);
00793 channel=ParseChannelOption(argv[i]);
00794 if (channel < 0)
00795 ThrowConvertException(OptionError,"UnrecognizedChannelType",
00796 argv[i]);
00797 break;
00798 }
00799 if (LocaleCompare("charcoal",option+1) == 0)
00800 {
00801 if (*option == '+')
00802 break;
00803 i++;
00804 if (i == (long) (argc-1))
00805 ThrowConvertException(OptionError,"MissingArgument",option);
00806 if (IsGeometry(argv[i]) == MagickFalse)
00807 ThrowConvertInvalidArgumentException(option,argv[i]);
00808 break;
00809 }
00810 if (LocaleCompare("chop",option+1) == 0)
00811 {
00812 if (*option == '+')
00813 break;
00814 i++;
00815 if (i == (long) (argc-1))
00816 ThrowConvertException(OptionError,"MissingArgument",option);
00817 if (IsGeometry(argv[i]) == MagickFalse)
00818 ThrowConvertInvalidArgumentException(option,argv[i]);
00819 break;
00820 }
00821 if (LocaleCompare("clip",option+1) == 0)
00822 break;
00823 if (LocaleCompare("clip-mask",option+1) == 0)
00824 {
00825 if (*option == '+')
00826 break;
00827 i++;
00828 if (i == (long) (argc-1))
00829 ThrowConvertException(OptionError,"MissingArgument",option);
00830 break;
00831 }
00832 if (LocaleCompare("clip-path",option+1) == 0)
00833 {
00834 i++;
00835 if (i == (long) (argc-1))
00836 ThrowConvertException(OptionError,"MissingArgument",option);
00837 break;
00838 }
00839 if (LocaleCompare("clone",option+1) == 0)
00840 {
00841 Image
00842 *clone_images;
00843
00844 clone_images=image;
00845 if (k != 0)
00846 clone_images=image_stack[k-1].image;
00847 if (clone_images == (Image *) NULL)
00848 ThrowConvertException(ImageError,"ImageSequenceRequired",option);
00849 if (*option == '+')
00850 clone_images=CloneImages(clone_images,"-1",exception);
00851 else
00852 {
00853 i++;
00854 if (i == (long) (argc-1))
00855 ThrowConvertException(OptionError,"MissingArgument",option);
00856 if (IsSceneGeometry(argv[i],MagickFalse) == MagickFalse)
00857 ThrowConvertInvalidArgumentException(option,argv[i]);
00858 clone_images=CloneImages(clone_images,argv[i],exception);
00859 }
00860 if (clone_images == (Image *) NULL)
00861 ThrowConvertException(OptionError,"NoSuchImage",option);
00862 FireImageStack(MagickTrue,MagickTrue,MagickTrue);
00863 AppendImageStack(clone_images);
00864 break;
00865 }
00866 if (LocaleCompare("clut",option+1) == 0)
00867 break;
00868 if (LocaleCompare("coalesce",option+1) == 0)
00869 break;
00870 if (LocaleCompare("colorize",option+1) == 0)
00871 {
00872 if (*option == '+')
00873 break;
00874 i++;
00875 if (i == (long) (argc-1))
00876 ThrowConvertException(OptionError,"MissingArgument",option);
00877 if (IsGeometry(argv[i]) == MagickFalse)
00878 ThrowConvertInvalidArgumentException(option,argv[i]);
00879 break;
00880 }
00881 if (LocaleCompare("colors",option+1) == 0)
00882 {
00883 if (*option == '+')
00884 break;
00885 i++;
00886 if ((i == (long) (argc-1)) ||
00887 (IsGeometry(argv[i]) == MagickFalse))
00888 ThrowConvertException(OptionError,"MissingArgument",option);
00889 break;
00890 }
00891 if (LocaleCompare("colorspace",option+1) == 0)
00892 {
00893 long
00894 colorspace;
00895
00896 if (*option == '+')
00897 break;
00898 i++;
00899 if (i == (long) (argc-1))
00900 ThrowConvertException(OptionError,"MissingArgument",option);
00901 colorspace=ParseMagickOption(MagickColorspaceOptions,
00902 MagickFalse,argv[i]);
00903 if (colorspace < 0)
00904 ThrowConvertException(OptionError,"UnrecognizedColorspace",
00905 argv[i]);
00906 break;
00907 }
00908 if (LocaleCompare("combine",option+1) == 0)
00909 break;
00910 if (LocaleCompare("comment",option+1) == 0)
00911 {
00912 if (*option == '+')
00913 break;
00914 i++;
00915 if (i == (long) argc)
00916 ThrowConvertException(OptionError,"MissingArgument",option);
00917 break;
00918 }
00919 if (LocaleCompare("compose",option+1) == 0)
00920 {
00921 long
00922 compose;
00923
00924 if (*option == '+')
00925 break;
00926 i++;
00927 if (i == (long) argc)
00928 ThrowConvertException(OptionError,"MissingArgument",option);
00929 compose=ParseMagickOption(MagickComposeOptions,MagickFalse,
00930 argv[i]);
00931 if (compose < 0)
00932 ThrowConvertException(OptionError,"UnrecognizedComposeOperator",
00933 argv[i]);
00934 break;
00935 }
00936 if (LocaleCompare("composite",option+1) == 0)
00937 break;
00938 if (LocaleCompare("compress",option+1) == 0)
00939 {
00940 long
00941 compress;
00942
00943 if (*option == '+')
00944 break;
00945 i++;
00946 if (i == (long) (argc-1))
00947 ThrowConvertException(OptionError,"MissingArgument",option);
00948 compress=ParseMagickOption(MagickCompressOptions,MagickFalse,
00949 argv[i]);
00950 if (compress < 0)
00951 ThrowConvertException(OptionError,"UnrecognizedImageCompression",
00952 argv[i]);
00953 break;
00954 }
00955 if (LocaleCompare("contrast",option+1) == 0)
00956 break;
00957 if (LocaleCompare("contrast-stretch",option+1) == 0)
00958 {
00959 i++;
00960 if (i == (long) (argc-1))
00961 ThrowConvertException(OptionError,"MissingArgument",option);
00962 if (IsGeometry(argv[i]) == MagickFalse)
00963 ThrowConvertInvalidArgumentException(option,argv[i]);
00964 break;
00965 }
00966 if (LocaleCompare("convolve",option+1) == 0)
00967 {
00968 if (*option == '+')
00969 break;
00970 i++;
00971 if (i == (long) (argc-1))
00972 ThrowConvertException(OptionError,"MissingArgument",option);
00973 if (IsGeometry(argv[i]) == MagickFalse)
00974 ThrowConvertInvalidArgumentException(option,argv[i]);
00975 break;
00976 }
00977 if (LocaleCompare("crop",option+1) == 0)
00978 {
00979 if (*option == '+')
00980 break;
00981 i++;
00982 if (i == (long) (argc-1))
00983 ThrowConvertException(OptionError,"MissingArgument",option);
00984 if (IsGeometry(argv[i]) == MagickFalse)
00985 ThrowConvertInvalidArgumentException(option,argv[i]);
00986 break;
00987 }
00988 if (LocaleCompare("cycle",option+1) == 0)
00989 {
00990 if (*option == '+')
00991 break;
00992 i++;
00993 if (i == (long) (argc-1))
00994 ThrowConvertException(OptionError,"MissingArgument",option);
00995 if (IsGeometry(argv[i]) == MagickFalse)
00996 ThrowConvertInvalidArgumentException(option,argv[i]);
00997 break;
00998 }
00999 ThrowConvertException(OptionError,"UnrecognizedOption",option)
01000 }
01001 case 'd':
01002 {
01003 if (LocaleCompare("decipher",option+1) == 0)
01004 {
01005 if (*option == '+')
01006 break;
01007 i++;
01008 if (i == (long) (argc-1))
01009 ThrowConvertException(OptionError,"MissingArgument",option);
01010 break;
01011 }
01012 if (LocaleCompare("deconstruct",option+1) == 0)
01013 break;
01014 if (LocaleCompare("debug",option+1) == 0)
01015 {
01016 long
01017 event;
01018
01019 if (*option == '+')
01020 break;
01021 i++;
01022 if (i == (long) argc)
01023 ThrowConvertException(OptionError,"MissingArgument",option);
01024 event=ParseMagickOption(MagickLogEventOptions,MagickFalse,argv[i]);
01025 if (event < 0)
01026 ThrowConvertException(OptionError,"UnrecognizedEventType",
01027 argv[i]);
01028 (void) SetLogEventMask(argv[i]);
01029 break;
01030 }
01031 if (LocaleCompare("define",option+1) == 0)
01032 {
01033 i++;
01034 if (i == (long) argc)
01035 ThrowConvertException(OptionError,"MissingArgument",option);
01036 if (*option == '+')
01037 {
01038 const char
01039 *define;
01040
01041 define=GetImageOption(image_info,argv[i]);
01042 if (define == (const char *) NULL)
01043 ThrowConvertException(OptionError,"NoSuchOption",argv[i]);
01044 break;
01045 }
01046 break;
01047 }
01048 if (LocaleCompare("delay",option+1) == 0)
01049 {
01050 if (*option == '+')
01051 break;
01052 i++;
01053 if (i == (long) argc)
01054 ThrowConvertException(OptionError,"MissingArgument",option);
01055 if (IsGeometry(argv[i]) == MagickFalse)
01056 ThrowConvertInvalidArgumentException(option,argv[i]);
01057 break;
01058 }
01059 if (LocaleCompare("density",option+1) == 0)
01060 {
01061 if (*option == '+')
01062 break;
01063 i++;
01064 if (i == (long) (argc-1))
01065 ThrowConvertException(OptionError,"MissingArgument",option);
01066 if (IsGeometry(argv[i]) == MagickFalse)
01067 ThrowConvertInvalidArgumentException(option,argv[i]);
01068 break;
01069 }
01070 if (LocaleCompare("depth",option+1) == 0)
01071 {
01072 if (*option == '+')
01073 break;
01074 i++;
01075 if (i == (long) (argc-1))
01076 ThrowConvertException(OptionError,"MissingArgument",option);
01077 if (IsGeometry(argv[i]) == MagickFalse)
01078 ThrowConvertInvalidArgumentException(option,argv[i]);
01079 break;
01080 }
01081 if (LocaleCompare("delete",option+1) == 0)
01082 {
01083 if (*option == '+')
01084 break;
01085 i++;
01086 if (i == (long) (argc-1))
01087 ThrowConvertException(OptionError,"MissingArgument",option);
01088 if (IsSceneGeometry(argv[i],MagickFalse) == MagickFalse)
01089 ThrowConvertInvalidArgumentException(option,argv[i]);
01090 break;
01091 }
01092 if (LocaleCompare("deskew",option+1) == 0)
01093 {
01094 if (*option == '+')
01095 break;
01096 i++;
01097 if (i == (long) (argc-1))
01098 ThrowConvertException(OptionError,"MissingArgument",option);
01099 if (IsGeometry(argv[i]) == MagickFalse)
01100 ThrowConvertInvalidArgumentException(option,argv[i]);
01101 break;
01102 }
01103 if (LocaleCompare("despeckle",option+1) == 0)
01104 break;
01105 if (LocaleCompare("display",option+1) == 0)
01106 {
01107 if (*option == '+')
01108 break;
01109 i++;
01110 if (i == (long) (argc-1))
01111 ThrowConvertException(OptionError,"MissingArgument",option);
01112 break;
01113 }
01114 if (LocaleCompare("dispose",option+1) == 0)
01115 {
01116 long
01117 dispose;
01118
01119 if (*option == '+')
01120 break;
01121 i++;
01122 if (i == (long) argc)
01123 ThrowConvertException(OptionError,"MissingArgument",option);
01124 dispose=ParseMagickOption(MagickDisposeOptions,MagickFalse,argv[i]);
01125 if (dispose < 0)
01126 ThrowConvertException(OptionError,"UnrecognizedDisposeMethod",
01127 argv[i]);
01128 break;
01129 }
01130 if (LocaleCompare("distort",option+1) == 0)
01131 {
01132 char
01133 *p;
01134
01135 long
01136 op;
01137
01138 i++;
01139 if (i == (long) argc)
01140 ThrowConvertException(OptionError,"MissingArgument",option);
01141 op=ParseMagickOption(MagickDistortOptions,MagickFalse,argv[i]);
01142 if (op < 0)
01143 ThrowConvertException(OptionError,"UnrecognizedDistortMethod",
01144 argv[i]);
01145 i++;
01146 if (i == (long) (argc-1))
01147 ThrowConvertException(OptionError,"MissingArgument",option);
01148 (void) strtod(argv[i],&p);
01149 if (p == argv[i])
01150 ThrowConvertInvalidArgumentException(option,argv[i]);
01151 break;
01152 }
01153 if (LocaleCompare("dither",option+1) == 0)
01154 {
01155 long
01156 method;
01157
01158 if (*option == '+')
01159 break;
01160 i++;
01161 if (i == (long) argc)
01162 ThrowConvertException(OptionError,"MissingArgument",option);
01163 method=ParseMagickOption(MagickDitherOptions,MagickFalse,argv[i]);
01164 if (method < 0)
01165 ThrowConvertException(OptionError,"UnrecognizedDitherMethod",
01166 argv[i]);
01167 break;
01168 }
01169 if (LocaleCompare("draw",option+1) == 0)
01170 {
01171 if (*option == '+')
01172 break;
01173 i++;
01174 if (i == (long) (argc-1))
01175 ThrowConvertException(OptionError,"MissingArgument",option);
01176 break;
01177 }
01178 ThrowConvertException(OptionError,"UnrecognizedOption",option)
01179 }
01180 case 'e':
01181 {
01182 if (LocaleCompare("edge",option+1) == 0)
01183 {
01184 if (*option == '+')
01185 break;
01186 i++;
01187 if (i == (long) (argc-1))
01188 ThrowConvertException(OptionError,"MissingArgument",option);
01189 if (IsGeometry(argv[i]) == MagickFalse)
01190 ThrowConvertInvalidArgumentException(option,argv[i]);
01191 break;
01192 }
01193 if (LocaleCompare("emboss",option+1) == 0)
01194 {
01195 if (*option == '+')
01196 break;
01197 i++;
01198 if (i == (long) (argc-1))
01199 ThrowConvertException(OptionError,"MissingArgument",option);
01200 if (IsGeometry(argv[i]) == MagickFalse)
01201 ThrowConvertInvalidArgumentException(option,argv[i]);
01202 break;
01203 }
01204 if (LocaleCompare("encipher",option+1) == 0)
01205 {
01206 if (*option == '+')
01207 break;
01208 i++;
01209 if (i == (long) (argc-1))
01210 ThrowConvertException(OptionError,"MissingArgument",option);
01211 break;
01212 }
01213 if (LocaleCompare("encoding",option+1) == 0)
01214 {
01215 if (*option == '+')
01216 break;
01217 i++;
01218 if (i == (long) (argc-1))
01219 ThrowConvertException(OptionError,"MissingArgument",option);
01220 break;
01221 }
01222 if (LocaleCompare("endian",option+1) == 0)
01223 {
01224 long
01225 endian;
01226
01227 if (*option == '+')
01228 break;
01229 i++;
01230 if (i == (long) (argc-1))
01231 ThrowConvertException(OptionError,"MissingArgument",option);
01232 endian=ParseMagickOption(MagickEndianOptions,MagickFalse,
01233 argv[i]);
01234 if (endian < 0)
01235 ThrowConvertException(OptionError,"UnrecognizedEndianType",
01236 argv[i]);
01237 break;
01238 }
01239 if (LocaleCompare("enhance",option+1) == 0)
01240 break;
01241 if (LocaleCompare("equalize",option+1) == 0)
01242 break;
01243 if (LocaleCompare("evaluate",option+1) == 0)
01244 {
01245 long
01246 op;
01247
01248 if (*option == '+')
01249 break;
01250 i++;
01251 if (i == (long) argc)
01252 ThrowConvertException(OptionError,"MissingArgument",option);
01253 op=ParseMagickOption(MagickEvaluateOptions,MagickFalse,argv[i]);
01254 if (op < 0)
01255 ThrowConvertException(OptionError,"UnrecognizedEvaluateOperator",
01256 argv[i]);
01257 i++;
01258 if (i == (long) (argc-1))