2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6 % CCCC OOO N N V V EEEEE RRRR TTTTT %
7 % C O O NN N V V E R R T %
8 % C O O N N N V V EEE RRRR T %
9 % C O O N NN V V E R R T %
10 % CCCC OOO N N V EEEEE R R T %
13 % Convert an image from one format to another. %
20 % Copyright 1999-2010 ImageMagick Studio LLC, a non-profit organization %
21 % dedicated to making software imaging solutions freely available. %
23 % You may not use this file except in compliance with the License. You may %
24 % obtain a copy of the License at %
26 % http://www.imagemagick.org/script/license.php %
28 % Unless required by applicable law or agreed to in writing, software %
29 % distributed under the License is distributed on an "AS IS" BASIS, %
30 % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %
31 % See the License for the specific language governing permissions and %
32 % limitations under the License. %
34 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
36 % Use the convert program to convert between image formats as well as resize
37 % an image, blur, crop, despeckle, dither, draw on, flip, join, re-sample,
45 #include "wand/studio.h"
46 #include "wand/MagickWand.h"
47 #include "wand/mogrify-private.h"
52 #define ThrowFileException(exception,severity,tag,context) \
54 (void) ThrowMagickException(exception,GetMagickModule(),severity, \
55 tag == (const char *) NULL ? "unknown" : tag,"`%s': %s",context, \
56 GetExceptionMessage(errno)); \
60 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
64 + C o n v e r t I m a g e C o m m a n d %
68 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
70 % ConvertImageCommand() reads one or more images, applies one or more image
71 % processing operations, and writes out the image in the same or differing
74 % The format of the ConvertImageCommand method is:
76 % MagickBooleanType ConvertImageCommand(ImageInfo *image_info,int argc,
77 % char **argv,char **metadata,ExceptionInfo *exception)
79 % A description of each parameter follows:
81 % o image_info: the image info.
83 % o argc: the number of elements in the argument vector.
85 % o argv: A text array containing the command line arguments.
87 % o metadata: any metadata is returned here.
89 % o exception: return any errors or warnings in this structure.
93 static MagickBooleanType ConcatenateImages(int argc,char **argv,
94 ExceptionInfo *exception)
109 output=OpenMagickStream(argv[argc-1],"wb");
110 if (output == (FILE *) NULL)
112 ThrowFileException(exception,FileOpenError,"UnableToOpenFile",
116 for (i=2; i < (long) (argc-1); i++)
118 input=OpenMagickStream(argv[i],"rb");
119 if (input == (FILE *) NULL)
120 ThrowFileException(exception,FileOpenError,"UnableToOpenFile",argv[i]);
121 for (c=fgetc(input); c != EOF; c=fgetc(input))
122 (void) fputc((char) c,output);
123 (void) fclose(input);
124 (void) remove(argv[i]);
126 (void) fclose(output);
130 static MagickBooleanType ConvertUsage(void)
135 "-debug events display copious debugging information",
136 "-help print program options",
137 "-list type print a list of supported option arguments",
138 "-log format format of debugging information",
139 "-version print version information",
144 "-adaptive-blur geometry",
145 " adaptively blur pixels; decrease effect near edges",
146 "-adaptive-resize geometry",
147 " adaptively resize image using 'mesh' interpolation",
148 "-adaptive-sharpen geometry",
149 " adaptively sharpen pixels; increase effect near edges",
150 "-alpha option on, activate, off, deactivate, set, opaque, copy",
151 " transparent, extract, background, or shape",
152 "-annotate geometry text",
153 " annotate the image with text",
154 "-auto-gamma automagically adjust gamma level of image",
155 "-auto-level automagically adjust color levels of image",
156 "-auto-orient automagically orient (rotate) image",
157 "-bench iterations measure performance",
158 "-black-threshold value",
159 " force all pixels below the threshold into black",
160 "-blue-shift factor simulate a scene at nighttime in the moonlight",
161 "-blur geometry reduce image noise and reduce detail levels",
162 "-border geometry surround image with a border of color",
163 "-bordercolor color border color",
164 "-brightness-contrast geometry",
165 " improve brightness / contrast of the image",
166 "-cdl filename color correct with a color decision list",
167 "-charcoal radius simulate a charcoal drawing",
168 "-chop geometry remove pixels from the image interior",
169 "-clamp restrict pixel range from 0 to the quantum depth",
170 "-clip clip along the first path from the 8BIM profile",
171 "-clip-mask filename associate a clip mask with the image",
172 "-clip-path id clip along a named path from the 8BIM profile",
173 "-colorize value colorize the image with the fill color",
174 "-contrast enhance or reduce the image contrast",
175 "-contrast-stretch geometry",
176 " improve contrast by `stretching' the intensity range",
177 "-convolve coefficients",
178 " apply a convolution kernel to the image",
179 "-cycle amount cycle the image colormap",
180 "-decipher filename convert cipher pixels to plain pixels",
181 "-deskew threshold straighten an image",
182 "-despeckle reduce the speckles within an image",
183 "-distort method args",
184 " distort images according to given method ad args",
185 "-draw string annotate the image with a graphic primitive",
186 "-edge radius apply a filter to detect edges in the image",
187 "-encipher filename convert plain pixels to cipher pixels",
188 "-emboss radius emboss an image",
189 "-enhance apply a digital filter to enhance a noisy image",
190 "-equalize perform histogram equalization to an image",
191 "-evaluate operator value",
192 " evaluate an expression over image values",
193 "-extent geometry set the image size",
194 "-extract geometry extract area from image",
195 "-fft implements the discrete Fourier transform (DFT)",
196 "-flip flip image vertically",
197 "-floodfill geometry color",
198 " floodfill the image with color",
199 "-flop flop image horizontally",
200 "-frame geometry surround image with an ornamental border",
201 "-function name parameters",
202 " apply function over image values",
203 "-gamma value level of gamma correction",
204 "-gaussian-blur geometry",
205 " reduce image noise and reduce detail levels",
206 "-geometry geometry preferred size or location of the image",
207 "-identify identify the format and characteristics of the image",
208 "-ift implements the inverse discrete Fourier transform (DFT)",
209 "-implode amount implode image pixels about the center",
210 "-lat geometry local adaptive thresholding",
211 "-layers method optimize, merge, or compare image layers",
212 "-level value adjust the level of image contrast",
213 "-level-colors color,color",
214 " level image with the given colors",
215 "-linear-stretch geometry",
216 " improve contrast by `stretching with saturation'",
217 "-liquid-rescale geometry",
218 " rescale image with seam-carving",
219 "-median radius apply a median filter to the image",
220 "-modulate value vary the brightness, saturation, and hue",
221 "-monochrome transform image to black and white",
222 "-morphology method kernel",
223 " apply a morphology method to the image",
224 "-motion-blur geometry",
225 " simulate motion blur",
226 "-negate replace every pixel with its complementary color ",
227 "-noise radius add or reduce noise in an image",
228 "-normalize transform image to span the full range of colors",
229 "-opaque color change this color to the fill color",
230 "-ordered-dither NxN",
231 " add a noise pattern to the image with specific",
233 "-paint radius simulate an oil painting",
234 "-polaroid angle simulate a Polaroid picture",
235 "-posterize levels reduce the image to a limited number of color levels",
236 "-print string interpret string and print to console",
237 "-profile filename add, delete, or apply an image profile",
238 "-quantize colorspace reduce colors in this colorspace",
239 "-radial-blur angle radial blur the image",
240 "-raise value lighten/darken image edges to create a 3-D effect",
241 "-random-threshold low,high",
242 " random threshold the image",
243 "-recolor matrix translate, scale, shear, or rotate image colors",
244 "-region geometry apply options to a portion of the image",
245 "-render render vector graphics",
246 "-repage geometry size and location of an image canvas",
247 "-resample geometry change the resolution of an image",
248 "-resize geometry resize the image",
249 "-roll geometry roll an image vertically or horizontally",
250 "-rotate degrees apply Paeth rotation to the image",
251 "-sample geometry scale image with pixel sampling",
252 "-scale geometry scale the image",
253 "-segment values segment an image",
254 "-selective-blur geometry",
255 " selectively blur pixels within a contrast threshold",
256 "-sepia-tone threshold",
257 " simulate a sepia-toned photo",
258 "-set property value set an image property",
259 "-shade degrees shade the image using a distant light source",
260 "-shadow geometry simulate an image shadow",
261 "-sharpen geometry sharpen the image",
262 "-shave geometry shave pixels from the image edges",
263 "-shear geometry slide one edge of the image along the X or Y axis",
264 "-sigmoidal-contrast geometry",
265 " increase the contrast without saturating highlights or shadows",
266 "-sketch geometry simulate a pencil sketch",
267 "-solarize threshold negate all pixels above the threshold level",
268 "-sparse-color method args",
269 " fill in a image based on a few color points",
270 "-splice geometry splice the background color into the image",
271 "-spread radius displace image pixels by a random amount",
272 "-strip strip image of all profiles and comments",
273 "-swirl degrees swirl image pixels about the center",
274 "-threshold value threshold the image",
275 "-thumbnail geometry create a thumbnail of the image",
276 "-tile filename tile image when filling a graphic primitive",
277 "-tint value tint the image with the fill color",
278 "-transform affine transform image",
279 "-transparent color make this color transparent within the image",
280 "-transpose flip image vertically and rotate 90 degrees",
281 "-transverse flop image horizontally and rotate 270 degrees",
282 "-trim trim image edges",
283 "-type type image type",
284 "-unique-colors discard all but one of any pixel color",
285 "-unsharp geometry sharpen the image",
286 "-vignette geometry soften the edges of the image in vignette style",
287 "-wave geometry alter an image along a sine wave",
288 "-white-threshold value",
289 " force all pixels above the threshold into white",
292 *sequence_operators[]=
294 "-append append an image sequence",
295 "-average average an image sequence",
296 "-clut apply a color lookup table to the image",
297 "-coalesce merge a sequence of images",
298 "-combine combine a sequence of images",
299 "-composite composite image",
300 "-crop geometry cut out a rectangular region of the image",
301 "-deconstruct break down an image sequence into constituent parts",
302 "-flatten flatten a sequence of images",
303 "-fx expression apply mathematical expression to an image channel(s)",
304 "-hald-clut apply a Hald color lookup table to the image",
305 "-morph value morph an image sequence",
306 "-mosaic create a mosaic from an image sequence",
307 "-process arguments process the image with a custom image filter",
308 "-reverse reverse image sequence",
309 "-separate separate an image channel into a grayscale image",
310 "-write filename write images to this file",
315 "-adjoin join images into a single multi-image file",
316 "-affine matrix affine transform matrix",
317 "-alpha option activate, deactivate, reset, or set the alpha channel",
318 "-antialias remove pixel-aliasing",
319 "-authenticate password",
320 " decipher image with this password",
321 "-attenuate value lessen (or intensify) when adding noise to an image",
322 "-background color background color",
323 "-bias value add bias when convolving an image",
324 "-black-point-compensation",
325 " use black point compensation",
326 "-blue-primary point chromaticity blue primary point",
327 "-bordercolor color border color",
328 "-caption string assign a caption to an image",
329 "-channel type apply option to select image channels",
330 "-colors value preferred number of colors in the image",
331 "-colorspace type alternate image colorspace",
332 "-comment string annotate image with comment",
333 "-compose operator set image composite operator",
334 "-compress type type of pixel compression when writing the image",
335 "-define format:option",
336 " define one or more image format options",
337 "-delay value display the next image after pausing",
338 "-density geometry horizontal and vertical density of the image",
339 "-depth value image depth",
340 "-display server get image or font from this X server",
341 "-dispose method layer disposal method",
342 "-dither method apply error diffusion to image",
343 "-encoding type text encoding type",
344 "-endian type endianness (MSB or LSB) of the image",
345 "-family name render text with this font family",
346 "-fill color color to use when filling a graphic primitive",
347 "-filter type use this filter when resizing an image",
348 "-font name render text with this font",
349 "-format \"string\" output formatted image characteristics",
350 "-fuzz distance colors within this distance are considered equal",
351 "-gravity type horizontal and vertical text placement",
352 "-green-primary point chromaticity green primary point",
353 "-intent type type of rendering intent when managing the image color",
354 "-interlace type type of image interlacing scheme",
355 "-interline-spacing value",
356 " set the space between two text lines",
357 "-interpolate method pixel color interpolation method",
358 "-interword-spacing value",
359 " set the space between two words",
360 "-kerning value set the space between two letters",
361 "-label string assign a label to an image",
362 "-limit type value pixel cache resource limit",
363 "-loop iterations add Netscape loop extension to your GIF animation",
364 "-mask filename associate a mask with the image",
365 "-mattecolor color frame color",
366 "-monitor monitor progress",
367 "-orient type image orientation",
368 "-page geometry size and location of an image canvas (setting)",
369 "-ping efficiently determine image attributes",
370 "-pointsize value font point size",
371 "-precision value maximum number of significant digits to print",
372 "-preview type image preview type",
373 "-quality value JPEG/MIFF/PNG compression level",
374 "-quiet suppress all warning messages",
375 "-red-primary point chromaticity red primary point",
376 "-regard-warnings pay attention to warning messages",
377 "-remap filename transform image colors to match this set of colors",
378 "-respect-parentheses settings remain in effect until parenthesis boundary",
379 "-sampling-factor geometry",
380 " horizontal and vertical sampling factor",
381 "-scene value image scene number",
382 "-seed value seed a new sequence of pseudo-random numbers",
383 "-size geometry width and height of image",
384 "-stretch type render text with this font stretch",
385 "-stroke color graphic primitive stroke color",
386 "-strokewidth value graphic primitive stroke width",
387 "-style type render text with this font style",
388 "-taint image as ineligible for bi-modal delegate",
389 "-texture filename name of texture to tile onto the image background",
390 "-tile-offset geometry",
392 "-treedepth value color tree depth",
393 "-transparent-color color",
394 " transparent color",
395 "-undercolor color annotation bounding box color",
396 "-units type the units of image resolution",
397 "-verbose print detailed information about the image",
398 "-view FlashPix viewing transforms",
399 "-virtual-pixel method",
400 " virtual pixel access method",
401 "-weight type render text with this font weight",
402 "-white-point point chromaticity white point",
407 "-clone index clone an image",
408 "-delete index delete the image from the image sequence",
409 "-insert index insert last image into the image sequence",
410 "-swap indexes swap two images in the image sequence",
417 (void) printf("Version: %s\n",GetMagickVersion((unsigned long *) NULL));
418 (void) printf("Copyright: %s\n",GetMagickCopyright());
419 (void) printf("Features: %s\n\n",GetMagickFeatures());
420 (void) printf("Usage: %s [options ...] file [ [options ...] "
421 "file ...] [options ...] file\n",GetClientName());
422 (void) printf("\nImage Settings:\n");
423 for (p=settings; *p != (char *) NULL; p++)
424 (void) printf(" %s\n",*p);
425 (void) printf("\nImage Operators:\n");
426 for (p=operators; *p != (char *) NULL; p++)
427 (void) printf(" %s\n",*p);
428 (void) printf("\nImage Sequence Operators:\n");
429 for (p=sequence_operators; *p != (char *) NULL; p++)
430 (void) printf(" %s\n",*p);
431 (void) printf("\nImage Stack Operators:\n");
432 for (p=stack_operators; *p != (char *) NULL; p++)
433 (void) printf(" %s\n",*p);
434 (void) printf("\nMiscellaneous Options:\n");
435 for (p=miscellaneous; *p != (char *) NULL; p++)
436 (void) printf(" %s\n",*p);
438 "\nBy default, the image format of `file' is determined by its magic\n");
440 "number. To specify a particular image format, precede the filename\n");
442 "with an image format name and a colon (i.e. ps:image) or specify the\n");
444 "image type as the filename suffix (i.e. image.ps). Specify 'file' as\n");
445 (void) printf("'-' for standard input or output.\n");
449 WandExport MagickBooleanType ConvertImageCommand(ImageInfo *image_info,
450 int argc,char **argv,char **metadata,ExceptionInfo *exception)
452 #define NotInitialized (unsigned int) (~0)
453 #define DestroyConvert() \
455 DestroyImageStack(); \
456 for (i=0; i < (long) argc; i++) \
457 argv[i]=DestroyString(argv[i]); \
458 argv=(char **) RelinquishMagickMemory(argv); \
460 #define ThrowConvertException(asperity,tag,option) \
462 (void) ThrowMagickException(exception,GetMagickModule(),asperity,tag,"`%s'", \
465 return(MagickFalse); \
467 #define ThrowConvertInvalidArgumentException(option,argument) \
469 (void) ThrowMagickException(exception,GetMagickModule(),OptionError, \
470 "InvalidArgument","`%s': %s",option,argument); \
472 return(MagickFalse); \
486 image_stack[MaxImageStackDepth+1];
505 assert(image_info != (ImageInfo *) NULL);
506 assert(image_info->signature == MagickSignature);
507 if (image_info->debug != MagickFalse)
508 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
509 assert(exception != (ExceptionInfo *) NULL);
513 if ((LocaleCompare("version",option+1) == 0) ||
514 (LocaleCompare("-version",option+1) == 0))
516 (void) fprintf(stdout,"Version: %s\n",
517 GetMagickVersion((unsigned long *) NULL));
518 (void) fprintf(stdout,"Copyright: %s\n",GetMagickCopyright());
519 (void) fprintf(stdout,"Features: %s\n\n",GetMagickFeatures());
525 (void) ConvertUsage();
528 filename=(char *) NULL;
533 option=(char *) NULL;
537 Parse command-line arguments.
539 ReadCommandlLine(argc,&argv);
540 status=ExpandFilenames(&argc,&argv);
541 if (status == MagickFalse)
542 ThrowConvertException(ResourceLimitError,"MemoryAllocationFailed",
543 GetExceptionMessage(errno));
544 if ((argc > 2) && (LocaleCompare("-concatenate",argv[1]) == 0))
545 return(ConcatenateImages(argc,argv,exception));
546 for (i=1; i < (long) (argc-1); i++)
549 if (LocaleCompare(option,"(") == 0)
551 FireImageStack(MagickTrue,MagickTrue,pend);
552 if (k == MaxImageStackDepth)
553 ThrowConvertException(OptionError,"ParenthesisNestedTooDeeply",
558 if (LocaleCompare(option,")") == 0)
560 FireImageStack(MagickTrue,MagickTrue,MagickTrue);
562 ThrowConvertException(OptionError,"UnableToParseExpression",option);
566 if (IsMagickOption(option) == MagickFalse)
574 FireImageStack(MagickTrue,MagickTrue,pend);
576 if ((LocaleCompare(filename,"--") == 0) && (i < (argc-1)))
578 (void) CopyMagickString(image_info->filename,filename,MaxTextExtent);
579 if (image_info->ping != MagickFalse)
580 images=PingImages(image_info,exception);
582 images=ReadImages(image_info,exception);
583 status&=(images != (Image *) NULL) &&
584 (exception->severity < ErrorException);
585 if (images == (Image *) NULL)
587 AppendImageStack(images);
590 pend=image != (Image *) NULL ? MagickTrue : MagickFalse;
595 if (LocaleCompare("adaptive-blur",option+1) == 0)
598 if (i == (long) (argc-1))
599 ThrowConvertException(OptionError,"MissingArgument",option);
600 if (IsGeometry(argv[i]) == MagickFalse)
601 ThrowConvertInvalidArgumentException(option,argv[i]);
604 if (LocaleCompare("adaptive-resize",option+1) == 0)
607 if (i == (long) (argc-1))
608 ThrowConvertException(OptionError,"MissingArgument",option);
609 if (IsGeometry(argv[i]) == MagickFalse)
610 ThrowConvertInvalidArgumentException(option,argv[i]);
613 if (LocaleCompare("adaptive-sharpen",option+1) == 0)
616 if (i == (long) (argc-1))
617 ThrowConvertException(OptionError,"MissingArgument",option);
618 if (IsGeometry(argv[i]) == MagickFalse)
619 ThrowConvertInvalidArgumentException(option,argv[i]);
622 if (LocaleCompare("adjoin",option+1) == 0)
624 if (LocaleCompare("affine",option+1) == 0)
629 if (i == (long) (argc-1))
630 ThrowConvertException(OptionError,"MissingArgument",option);
631 if (IsGeometry(argv[i]) == MagickFalse)
632 ThrowConvertInvalidArgumentException(option,argv[i]);
635 if (LocaleCompare("alpha",option+1) == 0)
643 if (i == (long) argc)
644 ThrowConvertException(OptionError,"MissingArgument",option);
645 type=ParseMagickOption(MagickAlphaOptions,MagickFalse,argv[i]);
647 ThrowConvertException(OptionError,"UnrecognizedAlphaChannelType",
651 if (LocaleCompare("annotate",option+1) == 0)
656 if (i == (long) (argc-1))
657 ThrowConvertException(OptionError,"MissingArgument",option);
658 if (IsGeometry(argv[i]) == MagickFalse)
659 ThrowConvertInvalidArgumentException(option,argv[i]);
661 if (i == (long) (argc-1))
662 ThrowConvertException(OptionError,"MissingArgument",option);
665 if (LocaleCompare("antialias",option+1) == 0)
667 if (LocaleCompare("append",option+1) == 0)
669 if (LocaleCompare("attenuate",option+1) == 0)
674 if (i == (long) (argc-1))
675 ThrowConvertException(OptionError,"MissingArgument",option);
676 if (IsGeometry(argv[i]) == MagickFalse)
677 ThrowConvertInvalidArgumentException(option,argv[i]);
680 if (LocaleCompare("authenticate",option+1) == 0)
685 if (i == (long) (argc-1))
686 ThrowConvertException(OptionError,"MissingArgument",option);
689 if (LocaleCompare("auto-gamma",option+1) == 0)
691 if (LocaleCompare("auto-level",option+1) == 0)
693 if (LocaleCompare("auto-orient",option+1) == 0)
695 if (LocaleCompare("average",option+1) == 0)
697 ThrowConvertException(OptionError,"UnrecognizedOption",option)
701 if (LocaleCompare("background",option+1) == 0)
706 if (i == (long) (argc-1))
707 ThrowConvertException(OptionError,"MissingArgument",option);
710 if (LocaleCompare("bench",option+1) == 0)
715 if (i == (long) (argc-1))
716 ThrowConvertException(OptionError,"MissingArgument",option);
717 if (IsGeometry(argv[i]) == MagickFalse)
718 ThrowConvertInvalidArgumentException(option,argv[i]);
721 if (LocaleCompare("bias",option+1) == 0)
726 if (i == (long) (argc-1))
727 ThrowConvertException(OptionError,"MissingArgument",option);
728 if (IsGeometry(argv[i]) == MagickFalse)
729 ThrowConvertInvalidArgumentException(option,argv[i]);
732 if (LocaleCompare("black-point-compensation",option+1) == 0)
734 if (LocaleCompare("black-threshold",option+1) == 0)
739 if (i == (long) (argc-1))
740 ThrowConvertException(OptionError,"MissingArgument",option);
741 if (IsGeometry(argv[i]) == MagickFalse)
742 ThrowConvertInvalidArgumentException(option,argv[i]);
745 if (LocaleCompare("blue-primary",option+1) == 0)
750 if (i == (long) (argc-1))
751 ThrowConvertException(OptionError,"MissingArgument",option);
752 if (IsGeometry(argv[i]) == MagickFalse)
753 ThrowConvertInvalidArgumentException(option,argv[i]);
756 if (LocaleCompare("blue-shift",option+1) == 0)
761 if (i == (long) (argc-1))
762 ThrowConvertException(OptionError,"MissingArgument",option);
763 if (IsGeometry(argv[i]) == MagickFalse)
764 ThrowConvertInvalidArgumentException(option,argv[i]);
767 if (LocaleCompare("blur",option+1) == 0)
772 if (i == (long) (argc-1))
773 ThrowConvertException(OptionError,"MissingArgument",option);
774 if (IsGeometry(argv[i]) == MagickFalse)
775 ThrowConvertInvalidArgumentException(option,argv[i]);
778 if (LocaleCompare("border",option+1) == 0)
783 if (i == (long) (argc-1))
784 ThrowConvertException(OptionError,"MissingArgument",option);
785 if (IsGeometry(argv[i]) == MagickFalse)
786 ThrowConvertInvalidArgumentException(option,argv[i]);
789 if (LocaleCompare("bordercolor",option+1) == 0)
794 if (i == (long) (argc-1))
795 ThrowConvertException(OptionError,"MissingArgument",option);
798 if (LocaleCompare("box",option+1) == 0)
803 if (i == (long) (argc-1))
804 ThrowConvertException(OptionError,"MissingArgument",option);
807 if (LocaleCompare("brightness-contrast",option+1) == 0)
810 if (i == (long) (argc-1))
811 ThrowConvertException(OptionError,"MissingArgument",option);
812 if (IsGeometry(argv[i]) == MagickFalse)
813 ThrowConvertInvalidArgumentException(option,argv[i]);
816 ThrowConvertException(OptionError,"UnrecognizedOption",option)
820 if (LocaleCompare("cache",option+1) == 0)
825 if (i == (long) (argc-1))
826 ThrowConvertException(OptionError,"MissingArgument",option);
827 if (IsGeometry(argv[i]) == MagickFalse)
828 ThrowConvertInvalidArgumentException(option,argv[i]);
831 if (LocaleCompare("caption",option+1) == 0)
836 if (i == (long) argc)
837 ThrowConvertException(OptionError,"MissingArgument",option);
840 if (LocaleCompare("cdl",option+1) == 0)
845 if (i == (long) (argc-1))
846 ThrowConvertException(OptionError,"MissingArgument",option);
849 if (LocaleCompare("channel",option+1) == 0)
857 if (i == (long) (argc-1))
858 ThrowConvertException(OptionError,"MissingArgument",option);
859 channel=ParseChannelOption(argv[i]);
861 ThrowConvertException(OptionError,"UnrecognizedChannelType",
865 if (LocaleCompare("charcoal",option+1) == 0)
870 if (i == (long) (argc-1))
871 ThrowConvertException(OptionError,"MissingArgument",option);
872 if (IsGeometry(argv[i]) == MagickFalse)
873 ThrowConvertInvalidArgumentException(option,argv[i]);
876 if (LocaleCompare("chop",option+1) == 0)
881 if (i == (long) (argc-1))
882 ThrowConvertException(OptionError,"MissingArgument",option);
883 if (IsGeometry(argv[i]) == MagickFalse)
884 ThrowConvertInvalidArgumentException(option,argv[i]);
887 if (LocaleCompare("clamp",option+1) == 0)
889 if (LocaleCompare("clip",option+1) == 0)
891 if (LocaleCompare("clip-mask",option+1) == 0)
896 if (i == (long) (argc-1))
897 ThrowConvertException(OptionError,"MissingArgument",option);
900 if (LocaleCompare("clip-path",option+1) == 0)
903 if (i == (long) (argc-1))
904 ThrowConvertException(OptionError,"MissingArgument",option);
907 if (LocaleCompare("clone",option+1) == 0)
914 clone_images=image_stack[k-1].image;
915 if (clone_images == (Image *) NULL)
916 ThrowConvertException(ImageError,"ImageSequenceRequired",option);
917 FireImageStack(MagickTrue,MagickTrue,MagickTrue);
919 clone_images=CloneImages(clone_images,"-1",exception);
923 if (i == (long) (argc-1))
924 ThrowConvertException(OptionError,"MissingArgument",option);
925 if (IsSceneGeometry(argv[i],MagickFalse) == MagickFalse)
926 ThrowConvertInvalidArgumentException(option,argv[i]);
927 clone_images=CloneImages(clone_images,argv[i],exception);
929 if (clone_images == (Image *) NULL)
930 ThrowConvertException(OptionError,"NoSuchImage",option);
931 AppendImageStack(clone_images);
934 if (LocaleCompare("clut",option+1) == 0)
936 if (LocaleCompare("coalesce",option+1) == 0)
938 if (LocaleCompare("colorize",option+1) == 0)
943 if (i == (long) (argc-1))
944 ThrowConvertException(OptionError,"MissingArgument",option);
945 if (IsGeometry(argv[i]) == MagickFalse)
946 ThrowConvertInvalidArgumentException(option,argv[i]);
949 if (LocaleCompare("colors",option+1) == 0)
954 if ((i == (long) (argc-1)) ||
955 (IsGeometry(argv[i]) == MagickFalse))
956 ThrowConvertException(OptionError,"MissingArgument",option);
959 if (LocaleCompare("colorspace",option+1) == 0)
967 if (i == (long) (argc-1))
968 ThrowConvertException(OptionError,"MissingArgument",option);
969 colorspace=ParseMagickOption(MagickColorspaceOptions,
970 MagickFalse,argv[i]);
972 ThrowConvertException(OptionError,"UnrecognizedColorspace",
976 if (LocaleCompare("combine",option+1) == 0)
978 if (LocaleCompare("comment",option+1) == 0)
983 if (i == (long) argc)
984 ThrowConvertException(OptionError,"MissingArgument",option);
987 if (LocaleCompare("compose",option+1) == 0)
995 if (i == (long) argc)
996 ThrowConvertException(OptionError,"MissingArgument",option);
997 compose=ParseMagickOption(MagickComposeOptions,MagickFalse,
1000 ThrowConvertException(OptionError,"UnrecognizedComposeOperator",
1004 if (LocaleCompare("composite",option+1) == 0)
1006 if (LocaleCompare("compress",option+1) == 0)
1014 if (i == (long) (argc-1))
1015 ThrowConvertException(OptionError,"MissingArgument",option);
1016 compress=ParseMagickOption(MagickCompressOptions,MagickFalse,
1019 ThrowConvertException(OptionError,"UnrecognizedImageCompression",
1023 if (LocaleCompare("concurrent",option+1) == 0)
1025 if (LocaleCompare("contrast",option+1) == 0)
1027 if (LocaleCompare("contrast-stretch",option+1) == 0)
1030 if (i == (long) (argc-1))
1031 ThrowConvertException(OptionError,"MissingArgument",option);
1032 if (IsGeometry(argv[i]) == MagickFalse)
1033 ThrowConvertInvalidArgumentException(option,argv[i]);
1036 if (LocaleCompare("convolve",option+1) == 0)
1039 token[MaxTextExtent];
1044 if (i == (long) (argc-1))
1045 ThrowConvertException(OptionError,"MissingArgument",option);
1047 if (IsGeometry(argv[i]) == MagickFalse)
1048 ThrowConvertInvalidArgumentException(option,argv[i]);
1050 /* Allow the use of built-in kernels like 'gaussian'
1051 * These may not work for kernels with 'nan' values, like 'diamond'
1053 GetMagickToken(argv[i],NULL,token);
1054 if ( isalpha((int)token[0]) )
1059 op=ParseMagickOption(MagickKernelOptions,MagickFalse,token);
1061 ThrowConvertException(OptionError,"UnrecognizedKernelType",
1064 /* geometry is currently invalid if a 'nan' value is included */
1065 else if (IsGeometry(argv[i]) == MagickFalse)
1066 ThrowConvertInvalidArgumentException(option,argv[i]);
1070 if (LocaleCompare("crop",option+1) == 0)
1075 if (i == (long) (argc-1))
1076 ThrowConvertException(OptionError,"MissingArgument",option);
1077 if (IsGeometry(argv[i]) == MagickFalse)
1078 ThrowConvertInvalidArgumentException(option,argv[i]);
1081 if (LocaleCompare("cycle",option+1) == 0)
1086 if (i == (long) (argc-1))
1087 ThrowConvertException(OptionError,"MissingArgument",option);
1088 if (IsGeometry(argv[i]) == MagickFalse)
1089 ThrowConvertInvalidArgumentException(option,argv[i]);
1092 ThrowConvertException(OptionError,"UnrecognizedOption",option)
1096 if (LocaleCompare("decipher",option+1) == 0)
1101 if (i == (long) (argc-1))
1102 ThrowConvertException(OptionError,"MissingArgument",option);
1105 if (LocaleCompare("deconstruct",option+1) == 0)
1107 if (LocaleCompare("debug",option+1) == 0)
1115 if (i == (long) argc)
1116 ThrowConvertException(OptionError,"MissingArgument",option);
1117 event=ParseMagickOption(MagickLogEventOptions,MagickFalse,argv[i]);
1119 ThrowConvertException(OptionError,"UnrecognizedEventType",
1121 (void) SetLogEventMask(argv[i]);
1124 if (LocaleCompare("define",option+1) == 0)
1127 if (i == (long) argc)
1128 ThrowConvertException(OptionError,"MissingArgument",option);
1134 define=GetImageOption(image_info,argv[i]);
1135 if (define == (const char *) NULL)
1136 ThrowConvertException(OptionError,"NoSuchOption",argv[i]);
1141 if (LocaleCompare("delay",option+1) == 0)
1146 if (i == (long) argc)
1147 ThrowConvertException(OptionError,"MissingArgument",option);
1148 if (IsGeometry(argv[i]) == MagickFalse)
1149 ThrowConvertInvalidArgumentException(option,argv[i]);
1152 if (LocaleCompare("density",option+1) == 0)
1157 if (i == (long) (argc-1))
1158 ThrowConvertException(OptionError,"MissingArgument",option);
1159 if (IsGeometry(argv[i]) == MagickFalse)
1160 ThrowConvertInvalidArgumentException(option,argv[i]);
1163 if (LocaleCompare("depth",option+1) == 0)
1168 if (i == (long) (argc-1))
1169 ThrowConvertException(OptionError,"MissingArgument",option);
1170 if (IsGeometry(argv[i]) == MagickFalse)
1171 ThrowConvertInvalidArgumentException(option,argv[i]);
1174 if (LocaleCompare("delete",option+1) == 0)
1179 if (i == (long) (argc-1))
1180 ThrowConvertException(OptionError,"MissingArgument",option);
1181 if (IsSceneGeometry(argv[i],MagickFalse) == MagickFalse)
1182 ThrowConvertInvalidArgumentException(option,argv[i]);
1185 if (LocaleCompare("deskew",option+1) == 0)
1190 if (i == (long) (argc-1))
1191 ThrowConvertException(OptionError,"MissingArgument",option);
1192 if (IsGeometry(argv[i]) == MagickFalse)
1193 ThrowConvertInvalidArgumentException(option,argv[i]);
1196 if (LocaleCompare("despeckle",option+1) == 0)
1198 if (LocaleCompare("display",option+1) == 0)
1203 if (i == (long) (argc-1))
1204 ThrowConvertException(OptionError,"MissingArgument",option);
1207 if (LocaleCompare("dispose",option+1) == 0)
1215 if (i == (long) argc)
1216 ThrowConvertException(OptionError,"MissingArgument",option);
1217 dispose=ParseMagickOption(MagickDisposeOptions,MagickFalse,argv[i]);
1219 ThrowConvertException(OptionError,"UnrecognizedDisposeMethod",
1223 if (LocaleCompare("distort",option+1) == 0)
1229 if (i == (long) argc)
1230 ThrowConvertException(OptionError,"MissingArgument",option);
1231 op=ParseMagickOption(MagickDistortOptions,MagickFalse,argv[i]);
1233 ThrowConvertException(OptionError,"UnrecognizedDistortMethod",
1236 if (i == (long) (argc-1))
1237 ThrowConvertException(OptionError,"MissingArgument",option);
1240 if (LocaleCompare("dither",option+1) == 0)
1248 if (i == (long) argc)
1249 ThrowConvertException(OptionError,"MissingArgument",option);
1250 method=ParseMagickOption(MagickDitherOptions,MagickFalse,argv[i]);
1252 ThrowConvertException(OptionError,"UnrecognizedDitherMethod",
1256 if (LocaleCompare("draw",option+1) == 0)
1261 if (i == (long) (argc-1))
1262 ThrowConvertException(OptionError,"MissingArgument",option);
1265 if (LocaleCompare("duration",option+1) == 0)
1270 if (i == (long) (argc-1))
1271 ThrowConvertException(OptionError,"MissingArgument",option);
1272 if (IsGeometry(argv[i]) == MagickFalse)
1273 ThrowConvertInvalidArgumentException(option,argv[i]);
1276 ThrowConvertException(OptionError,"UnrecognizedOption",option)
1280 if (LocaleCompare("edge",option+1) == 0)
1285 if (i == (long) (argc-1))
1286 ThrowConvertException(OptionError,"MissingArgument",option);
1287 if (IsGeometry(argv[i]) == MagickFalse)
1288 ThrowConvertInvalidArgumentException(option,argv[i]);
1291 if (LocaleCompare("emboss",option+1) == 0)
1296 if (i == (long) (argc-1))
1297 ThrowConvertException(OptionError,"MissingArgument",option);
1298 if (IsGeometry(argv[i]) == MagickFalse)
1299 ThrowConvertInvalidArgumentException(option,argv[i]);
1302 if (LocaleCompare("encipher",option+1) == 0)
1307 if (i == (long) (argc-1))
1308 ThrowConvertException(OptionError,"MissingArgument",option);
1311 if (LocaleCompare("encoding",option+1) == 0)
1316 if (i == (long) (argc-1))
1317 ThrowConvertException(OptionError,"MissingArgument",option);
1320 if (LocaleCompare("endian",option+1) == 0)
1328 if (i == (long) (argc-1))
1329 ThrowConvertException(OptionError,"MissingArgument",option);
1330 endian=ParseMagickOption(MagickEndianOptions,MagickFalse,
1333 ThrowConvertException(OptionError,"UnrecognizedEndianType",
1337 if (LocaleCompare("enhance",option+1) == 0)
1339 if (LocaleCompare("equalize",option+1) == 0)
1341 if (LocaleCompare("evaluate",option+1) == 0)
1349 if (i == (long) argc)
1350 ThrowConvertException(OptionError,"MissingArgument",option);
1351 op=ParseMagickOption(MagickEvaluateOptions,MagickFalse,argv[i]);
1353 ThrowConvertException(OptionError,"UnrecognizedEvaluateOperator",
1356 if (i == (long) (argc-1))
1357 ThrowConvertException(OptionError,"MissingArgument",option);
1358 if (IsGeometry(argv[i]) == MagickFalse)
1359 ThrowConvertInvalidArgumentException(option,argv[i]);
1362 if (LocaleCompare("extent",option+1) == 0)
1367 if (i == (long) (argc-1))
1368 ThrowConvertException(OptionError,"MissingArgument",option);
1369 if (IsGeometry(argv[i]) == MagickFalse)
1370 ThrowConvertInvalidArgumentException(option,argv[i]);
1373 if (LocaleCompare("extract",option+1) == 0)
1378 if (i == (long) (argc-1))
1379 ThrowConvertException(OptionError,"MissingArgument",option);
1380 if (IsGeometry(argv[i]) == MagickFalse)
1381 ThrowConvertInvalidArgumentException(option,argv[i]);
1384 ThrowConvertException(OptionError,"UnrecognizedOption",option)
1388 if (LocaleCompare("family",option+1) == 0)
1393 if (i == (long) (argc-1))
1394 ThrowConvertException(OptionError,"MissingArgument",option);
1397 if (LocaleCompare("fft",option+1) == 0)
1399 if (LocaleCompare("fill",option+1) == 0)
1404 if (i == (long) (argc-1))
1405 ThrowConvertException(OptionError,"MissingArgument",option);
1408 if (LocaleCompare("filter",option+1) == 0)
1416 if (i == (long) (argc-1))
1417 ThrowConvertException(OptionError,"MissingArgument",option);
1418 filter=ParseMagickOption(MagickFilterOptions,MagickFalse,argv[i]);
1420 ThrowConvertException(OptionError,"UnrecognizedImageFilter",
1424 if (LocaleCompare("flatten",option+1) == 0)
1426 if (LocaleCompare("flip",option+1) == 0)
1428 if (LocaleCompare("flop",option+1) == 0)
1430 if (LocaleCompare("floodfill",option+1) == 0)
1435 if (i == (long) (argc-1))
1436 ThrowConvertException(OptionError,"MissingArgument",option);
1437 if (IsGeometry(argv[i]) == MagickFalse)
1438 ThrowConvertInvalidArgumentException(option,argv[i]);
1440 if (i == (long) (argc-1))
1441 ThrowConvertException(OptionError,"MissingArgument",option);
1444 if (LocaleCompare("font",option+1) == 0)
1449 if (i == (long) (argc-1))
1450 ThrowConvertException(OptionError,"MissingArgument",option);
1453 if (LocaleCompare("format",option+1) == 0)
1458 if (i == (long) (argc-1))
1459 ThrowConvertException(OptionError,"MissingArgument",option);
1463 if (LocaleCompare("frame",option+1) == 0)
1468 if (i == (long) (argc-1))
1469 ThrowConvertException(OptionError,"MissingArgument",option);
1470 if (IsGeometry(argv[i]) == MagickFalse)
1471 ThrowConvertInvalidArgumentException(option,argv[i]);
1474 if (LocaleCompare("function",option+1) == 0)
1482 if (i == (long) argc)
1483 ThrowConvertException(OptionError,"MissingArgument",option);
1484 op=ParseMagickOption(MagickFunctionOptions,MagickFalse,argv[i]);
1486 ThrowConvertException(OptionError,"UnrecognizedFunction",argv[i]);
1488 if (i == (long) (argc-1))
1489 ThrowConvertException(OptionError,"MissingArgument",option);
1492 if (LocaleCompare("fuzz",option+1) == 0)
1497 if (i == (long) (argc-1))
1498 ThrowConvertException(OptionError,"MissingArgument",option);
1499 if (IsGeometry(argv[i]) == MagickFalse)
1500 ThrowConvertInvalidArgumentException(option,argv[i]);
1503 if (LocaleCompare("fx",option+1) == 0)
1508 if (i == (long) (argc-1))
1509 ThrowConvertException(OptionError,"MissingArgument",option);
1512 ThrowConvertException(OptionError,"UnrecognizedOption",option)
1516 if (LocaleCompare("gamma",option+1) == 0)
1519 if (i == (long) (argc-1))
1520 ThrowConvertException(OptionError,"MissingArgument",option);
1521 if (IsGeometry(argv[i]) == MagickFalse)
1522 ThrowConvertInvalidArgumentException(option,argv[i]);
1525 if ((LocaleCompare("gaussian-blur",option+1) == 0) ||
1526 (LocaleCompare("gaussian",option+1) == 0))
1529 if (i == (long) (argc-1))
1530 ThrowConvertException(OptionError,"MissingArgument",option);
1531 if (IsGeometry(argv[i]) == MagickFalse)
1532 ThrowConvertInvalidArgumentException(option,argv[i]);
1535 if (LocaleCompare("geometry",option+1) == 0)
1540 if (i == (long) (argc-1))
1541 ThrowConvertException(OptionError,"MissingArgument",option);
1542 if (IsGeometry(argv[i]) == MagickFalse)
1543 ThrowConvertInvalidArgumentException(option,argv[i]);
1546 if (LocaleCompare("gravity",option+1) == 0)
1554 if (i == (long) (argc-1))
1555 ThrowConvertException(OptionError,"MissingArgument",option);
1556 gravity=ParseMagickOption(MagickGravityOptions,MagickFalse,
1559 ThrowConvertException(OptionError,"UnrecognizedGravityType",
1563 if (LocaleCompare("green-primary",option+1) == 0)
1568 if (i == (long) (argc-1))
1569 ThrowConvertException(OptionError,"MissingArgument",option);
1570 if (IsGeometry(argv[i]) == MagickFalse)
1571 ThrowConvertInvalidArgumentException(option,argv[i]);
1574 ThrowConvertException(OptionError,"UnrecognizedOption",option)
1578 if (LocaleCompare("hald-clut",option+1) == 0)
1580 if ((LocaleCompare("help",option+1) == 0) ||
1581 (LocaleCompare("-help",option+1) == 0))
1582 return(ConvertUsage());
1583 ThrowConvertException(OptionError,"UnrecognizedOption",option)
1587 if (LocaleCompare("identify",option+1) == 0)
1589 if (LocaleCompare("ift",option+1) == 0)
1591 if (LocaleCompare("implode",option+1) == 0)
1596 if (i == (long) (argc-1))
1597 ThrowConvertException(OptionError,"MissingArgument",option);
1598 if (IsGeometry(argv[i]) == MagickFalse)
1599 ThrowConvertInvalidArgumentException(option,argv[i]);
1602 if (LocaleCompare("insert",option+1) == 0)
1607 if (i == (long) (argc-1))
1608 ThrowConvertException(OptionError,"MissingArgument",option);
1609 if (IsGeometry(argv[i]) == MagickFalse)
1610 ThrowConvertInvalidArgumentException(option,argv[i]);
1613 if (LocaleCompare("intent",option+1) == 0)
1621 if (i == (long) (argc-1))
1622 ThrowConvertException(OptionError,"MissingArgument",option);
1623 intent=ParseMagickOption(MagickIntentOptions,MagickFalse,
1626 ThrowConvertException(OptionError,"UnrecognizedIntentType",
1630 if (LocaleCompare("interlace",option+1) == 0)
1638 if (i == (long) (argc-1))
1639 ThrowConvertException(OptionError,"MissingArgument",option);
1640 interlace=ParseMagickOption(MagickInterlaceOptions,MagickFalse,
1643 ThrowConvertException(OptionError,"UnrecognizedInterlaceType",
1647 if (LocaleCompare("interline-spacing",option+1) == 0)
1652 if (i == (long) (argc-1))
1653 ThrowConvertException(OptionError,"MissingArgument",option);
1654 if (IsGeometry(argv[i]) == MagickFalse)
1655 ThrowConvertInvalidArgumentException(option,argv[i]);
1658 if (LocaleCompare("interpolate",option+1) == 0)
1666 if (i == (long) argc)
1667 ThrowConvertException(OptionError,"MissingArgument",option);
1668 interpolate=ParseMagickOption(MagickInterpolateOptions,MagickFalse,
1670 if (interpolate < 0)
1671 ThrowConvertException(OptionError,"UnrecognizedInterpolateMethod",
1675 if (LocaleCompare("interword-spacing",option+1) == 0)
1680 if (i == (long) (argc-1))
1681 ThrowConvertException(OptionError,"MissingArgument",option);
1682 if (IsGeometry(argv[i]) == MagickFalse)
1683 ThrowConvertInvalidArgumentException(option,argv[i]);
1686 ThrowConvertException(OptionError,"UnrecognizedOption",option)
1690 if (LocaleCompare("kerning",option+1) == 0)
1695 if (i == (long) (argc-1))
1696 ThrowConvertException(OptionError,"MissingArgument",option);
1697 if (IsGeometry(argv[i]) == MagickFalse)
1698 ThrowConvertInvalidArgumentException(option,argv[i]);
1701 ThrowConvertException(OptionError,"UnrecognizedOption",option)
1705 if (LocaleCompare("label",option+1) == 0)
1710 if (i == (long) argc)
1711 ThrowConvertException(OptionError,"MissingArgument",option);
1714 if (LocaleCompare("lat",option+1) == 0)
1719 if (i == (long) (argc-1))
1720 ThrowConvertException(OptionError,"MissingArgument",option);
1721 if (IsGeometry(argv[i]) == MagickFalse)
1722 ThrowConvertInvalidArgumentException(option,argv[i]);
1725 if (LocaleCompare("layers",option+1) == 0)
1733 if (i == (long) (argc-1))
1734 ThrowConvertException(OptionError,"MissingArgument",option);
1735 type=ParseMagickOption(MagickLayerOptions,MagickFalse,argv[i]);
1737 ThrowConvertException(OptionError,"UnrecognizedLayerMethod",
1741 if (LocaleCompare("level",option+1) == 0)
1744 if (i == (long) (argc-1))
1745 ThrowConvertException(OptionError,"MissingArgument",option);
1746 if (IsGeometry(argv[i]) == MagickFalse)
1747 ThrowConvertInvalidArgumentException(option,argv[i]);
1750 if (LocaleCompare("level-colors",option+1) == 0)
1753 if (i == (long) (argc-1))
1754 ThrowConvertException(OptionError,"MissingArgument",option);
1757 if (LocaleCompare("linewidth",option+1) == 0)
1762 if (i == (long) (argc-1))
1763 ThrowConvertException(OptionError,"MissingArgument",option);
1764 if (IsGeometry(argv[i]) == MagickFalse)
1765 ThrowConvertInvalidArgumentException(option,argv[i]);
1768 if (LocaleCompare("liquid-rescale",option+1) == 0)
1771 if (i == (long) (argc-1))
1772 ThrowConvertException(OptionError,"MissingArgument",option);
1773 if (IsGeometry(argv[i]) == MagickFalse)
1774 ThrowConvertInvalidArgumentException(option,argv[i]);
1777 if (LocaleCompare("limit",option+1) == 0)
1791 if (i == (long) argc)
1792 ThrowConvertException(OptionError,"MissingArgument",option);
1793 resource=ParseMagickOption(MagickResourceOptions,MagickFalse,
1796 ThrowConvertException(OptionError,"UnrecognizedResourceType",
1799 if (i == (long) argc)
1800 ThrowConvertException(OptionError,"MissingArgument",option);
1801 value=strtod(argv[i],&p);
1802 if ((p == argv[i]) && (LocaleCompare("unlimited",argv[i]) != 0))
1803 ThrowConvertInvalidArgumentException(option,argv[i]);
1806 if (LocaleCompare("linear-stretch",option+1) == 0)
1809 if (i == (long) (argc-1))
1810 ThrowConvertException(OptionError,"MissingArgument",option);
1811 if (IsGeometry(argv[i]) == MagickFalse)
1812 ThrowConvertInvalidArgumentException(option,argv[i]);
1815 if (LocaleCompare("list",option+1) == 0)
1823 if (i == (long) argc)
1824 ThrowConvertException(OptionError,"MissingArgument",option);
1825 list=ParseMagickOption(MagickListOptions,MagickFalse,argv[i]);
1827 ThrowConvertException(OptionError,"UnrecognizedListType",argv[i]);
1828 (void) MogrifyImageInfo(image_info,(int) (i-j+1),(const char **)
1833 if (LocaleCompare("log",option+1) == 0)
1838 if ((i == (long) argc) ||
1839 (strchr(argv[i],'%') == (char *) NULL))
1840 ThrowConvertException(OptionError,"MissingArgument",option);
1843 if (LocaleCompare("loop",option+1) == 0)
1848 if (i == (long) (argc-1))
1849 ThrowConvertException(OptionError,"MissingArgument",option);
1850 if (IsGeometry(argv[i]) == MagickFalse)
1851 ThrowConvertInvalidArgumentException(option,argv[i]);
1854 ThrowConvertException(OptionError,"UnrecognizedOption",option)
1858 if (LocaleCompare("map",option+1) == 0)
1863 if (i == (long) (argc-1))
1864 ThrowConvertException(OptionError,"MissingArgument",option);
1867 if (LocaleCompare("mask",option+1) == 0)
1872 if (i == (long) (argc-1))
1873 ThrowConvertException(OptionError,"MissingArgument",option);
1876 if (LocaleCompare("matte",option+1) == 0)
1878 if (LocaleCompare("mattecolor",option+1) == 0)
1883 if (i == (long) (argc-1))
1884 ThrowConvertException(OptionError,"MissingArgument",option);
1887 if (LocaleCompare("median",option+1) == 0)
1892 if (i == (long) (argc-1))
1893 ThrowConvertException(OptionError,"MissingArgument",option);
1894 if (IsGeometry(argv[i]) == MagickFalse)
1895 ThrowConvertInvalidArgumentException(option,argv[i]);
1898 if (LocaleCompare("modulate",option+1) == 0)
1903 if (i == (long) (argc-1))
1904 ThrowConvertException(OptionError,"MissingArgument",option);
1905 if (IsGeometry(argv[i]) == MagickFalse)
1906 ThrowConvertInvalidArgumentException(option,argv[i]);
1909 if (LocaleCompare("monitor",option+1) == 0)
1911 if (LocaleCompare("monochrome",option+1) == 0)
1913 if (LocaleCompare("morph",option+1) == 0)
1918 if (i == (long) (argc-1))
1919 ThrowConvertException(OptionError,"MissingArgument",option);
1920 if (IsGeometry(argv[i]) == MagickFalse)
1921 ThrowConvertInvalidArgumentException(option,argv[i]);
1924 if (LocaleCompare("morphology",option+1) == 0)
1930 token[MaxTextExtent];
1933 if (i == (long) argc)
1934 ThrowConvertException(OptionError,"MissingArgument",option);
1935 GetMagickToken(argv[i],NULL,token);
1936 op=ParseMagickOption(MagickMorphologyOptions,MagickFalse,token);
1938 ThrowConvertException(OptionError,"UnrecognizedMorphologyMethod",
1941 if (i == (long) (argc-1))
1942 ThrowConvertException(OptionError,"MissingArgument",option);
1943 GetMagickToken(argv[i],NULL,token);
1944 if ( isalpha((int)token[0]) )
1946 op=ParseMagickOption(MagickKernelOptions,MagickFalse,token);
1948 ThrowConvertException(OptionError,"UnrecognizedKernelType",
1952 /* DO NOT ENABLE, geometry can not handle user defined kernels
1953 * which include 'nan' values, though '-' are acceptable.
1955 else if (IsGeometry(argv[i]) == MagickFalse)
1956 ThrowConvertInvalidArgumentException(option,argv[i]);
1960 if (LocaleCompare("mosaic",option+1) == 0)
1962 if (LocaleCompare("motion-blur",option+1) == 0)
1967 if (i == (long) (argc-1))
1968 ThrowConvertException(OptionError,"MissingArgument",option);
1969 if (IsGeometry(argv[i]) == MagickFalse)
1970 ThrowConvertInvalidArgumentException(option,argv[i]);
1973 ThrowConvertException(OptionError,"UnrecognizedOption",option)
1977 if (LocaleCompare("negate",option+1) == 0)
1979 if (LocaleCompare("noise",option+1) == 0)
1982 if (i == (long) (argc-1))
1983 ThrowConvertException(OptionError,"MissingArgument",option);
1989 noise=ParseMagickOption(MagickNoiseOptions,MagickFalse,argv[i]);
1991 ThrowConvertException(OptionError,"UnrecognizedNoiseType",
1995 if (IsGeometry(argv[i]) == MagickFalse)
1996 ThrowConvertInvalidArgumentException(option,argv[i]);
1999 if (LocaleCompare("noop",option+1) == 0)
2001 if (LocaleCompare("normalize",option+1) == 0)
2003 ThrowConvertException(OptionError,"UnrecognizedOption",option)
2007 if (LocaleCompare("opaque",option+1) == 0)
2010 if (i == (long) (argc-1))
2011 ThrowConvertException(OptionError,"MissingArgument",option);
2014 if (LocaleCompare("ordered-dither",option+1) == 0)
2019 if (i == (long) (argc-1))
2020 ThrowConvertException(OptionError,"MissingArgument",option);
2023 if (LocaleCompare("orient",option+1) == 0)
2031 if (i == (long) (argc-1))
2032 ThrowConvertException(OptionError,"MissingArgument",option);
2033 orientation=ParseMagickOption(MagickOrientationOptions,
2034 MagickFalse,argv[i]);
2035 if (orientation < 0)
2036 ThrowConvertException(OptionError,"UnrecognizedImageOrientation",
2040 ThrowConvertException(OptionError,"UnrecognizedOption",argv[i])
2044 if (LocaleCompare("page",option+1) == 0)
2049 if (i == (long) argc)
2050 ThrowConvertException(OptionError,"MissingArgument",option);
2053 if (LocaleCompare("paint",option+1) == 0)
2058 if (i == (long) (argc-1))
2059 ThrowConvertException(OptionError,"MissingArgument",option);
2060 if (IsGeometry(argv[i]) == MagickFalse)
2061 ThrowConvertInvalidArgumentException(option,argv[i]);
2064 if (LocaleCompare("ping",option+1) == 0)
2066 if (LocaleCompare("pointsize",option+1) == 0)
2071 if (i == (long) (argc-1))
2072 ThrowConvertException(OptionError,"MissingArgument",option);
2073 if (IsGeometry(argv[i]) == MagickFalse)
2074 ThrowConvertInvalidArgumentException(option,argv[i]);
2077 if (LocaleCompare("polaroid",option+1) == 0)
2082 if (i == (long) (argc-1))
2083 ThrowConvertException(OptionError,"MissingArgument",option);
2084 if (IsGeometry(argv[i]) == MagickFalse)
2085 ThrowConvertInvalidArgumentException(option,argv[i]);
2088 if (LocaleCompare("posterize",option+1) == 0)
2093 if (i == (long) (argc-1))
2094 ThrowConvertException(OptionError,"MissingArgument",option);
2095 if (IsGeometry(argv[i]) == MagickFalse)
2096 ThrowConvertInvalidArgumentException(option,argv[i]);
2099 if (LocaleCompare("precision",option+1) == 0)
2104 if (i == (long) (argc-1))
2105 ThrowConvertException(OptionError,"MissingArgument",option);
2106 if (IsGeometry(argv[i]) == MagickFalse)
2107 ThrowConvertInvalidArgumentException(option,argv[i]);
2110 if (LocaleCompare("preview",option+1) == 0)
2118 if (i == (long) (argc-1))
2119 ThrowConvertException(OptionError,"MissingArgument",option);
2120 preview=ParseMagickOption(MagickPreviewOptions,MagickFalse,
2123 ThrowConvertException(OptionError,"UnrecognizedPreviewType",
2127 if (LocaleCompare("print",option+1) == 0)
2132 if (i == (long) (argc-1))
2133 ThrowConvertException(OptionError,"MissingArgument",option);
2136 if (LocaleCompare("process",option+1) == 0)
2141 if (i == (long) (argc-1))
2142 ThrowConvertException(OptionError,"MissingArgument",option);
2145 if (LocaleCompare("profile",option+1) == 0)
2148 if (i == (long) (argc-1))
2149 ThrowConvertException(OptionError,"MissingArgument",option);
2152 ThrowConvertException(OptionError,"UnrecognizedOption",option)
2156 if (LocaleCompare("quality",option+1) == 0)
2161 if (i == (long) (argc-1))
2162 ThrowConvertException(OptionError,"MissingArgument",option);
2163 if (IsGeometry(argv[i]) == MagickFalse)
2164 ThrowConvertInvalidArgumentException(option,argv[i]);
2167 if (LocaleCompare("quantize",option+1) == 0)
2175 if (i == (long) (argc-1))
2176 ThrowConvertException(OptionError,"MissingArgument",option);
2177 colorspace=ParseMagickOption(MagickColorspaceOptions,
2178 MagickFalse,argv[i]);
2180 ThrowConvertException(OptionError,"UnrecognizedColorspace",
2184 if (LocaleCompare("quiet",option+1) == 0)
2186 ThrowConvertException(OptionError,"UnrecognizedOption",option)
2190 if (LocaleCompare("radial-blur",option+1) == 0)
2193 if (i == (long) (argc-1))
2194 ThrowConvertException(OptionError,"MissingArgument",option);
2195 if (IsGeometry(argv[i]) == MagickFalse)
2196 ThrowConvertInvalidArgumentException(option,argv[i]);
2199 if (LocaleCompare("raise",option+1) == 0)
2202 if (i == (long) (argc-1))
2203 ThrowConvertException(OptionError,"MissingArgument",option);
2204 if (IsGeometry(argv[i]) == MagickFalse)
2205 ThrowConvertInvalidArgumentException(option,argv[i]);
2208 if (LocaleCompare("random-threshold",option+1) == 0)
2213 if (i == (long) (argc-1))
2214 ThrowConvertException(OptionError,"MissingArgument",option);
2215 if (IsGeometry(argv[i]) == MagickFalse)
2216 ThrowConvertInvalidArgumentException(option,argv[i]);
2219 if (LocaleCompare("recolor",option+1) == 0)
2224 if (i == (long) (argc-1))
2225 ThrowConvertException(OptionError,"MissingArgument",option);
2226 if (IsGeometry(argv[i]) == MagickFalse)
2227 ThrowConvertInvalidArgumentException(option,argv[i]);
2230 if (LocaleCompare("red-primary",option+1) == 0)
2235 if (i == (long) (argc-1))
2236 ThrowConvertException(OptionError,"MissingArgument",option);
2237 if (IsGeometry(argv[i]) == MagickFalse)
2238 ThrowConvertInvalidArgumentException(option,argv[i]);
2241 if (LocaleCompare("regard-warnings",option+1) == 0)
2243 if (LocaleCompare("region",option+1) == 0)
2248 if (i == (long) (argc-1))
2249 ThrowConvertException(OptionError,"MissingArgument",option);
2250 if (IsGeometry(argv[i]) == MagickFalse)
2251 ThrowConvertInvalidArgumentException(option,argv[i]);
2254 if (LocaleCompare("remap",option+1) == 0)
2259 if (i == (long) (argc-1))
2260 ThrowConvertException(OptionError,"MissingArgument",option);
2263 if (LocaleCompare("render",option+1) == 0)
2265 if (LocaleCompare("repage",option+1) == 0)
2270 if (i == (long) (argc-1))
2271 ThrowConvertException(OptionError,"MissingArgument",option);
2272 if (IsGeometry(argv[i]) == MagickFalse)
2273 ThrowConvertInvalidArgumentException(option,argv[i]);
2276 if (LocaleCompare("resample",option+1) == 0)
2281 if (i == (long) (argc-1))
2282 ThrowConvertException(OptionError,"MissingArgument",option);
2283 if (IsGeometry(argv[i]) == MagickFalse)
2284 ThrowConvertInvalidArgumentException(option,argv[i]);
2287 if (LocaleCompare("resize",option+1) == 0)
2292 if (i == (long) (argc-1))
2293 ThrowConvertException(OptionError,"MissingArgument",option);
2294 if (IsGeometry(argv[i]) == MagickFalse)
2295 ThrowConvertInvalidArgumentException(option,argv[i]);
2298 if (LocaleNCompare("respect-parentheses",option+1,17) == 0)
2300 respect_parenthesis=(*option == '-') ? MagickTrue : MagickFalse;
2303 if (LocaleCompare("reverse",option+1) == 0)
2305 if (LocaleCompare("roll",option+1) == 0)
2310 if (i == (long) (argc-1))
2311 ThrowConvertException(OptionError,"MissingArgument",option);
2312 if (IsGeometry(argv[i]) == MagickFalse)
2313 ThrowConvertInvalidArgumentException(option,argv[i]);
2316 if (LocaleCompare("rotate",option+1) == 0)
2319 if (i == (long) (argc-1))
2320 ThrowConvertException(OptionError,"MissingArgument",option);
2321 if (IsGeometry(argv[i]) == MagickFalse)
2322 ThrowConvertInvalidArgumentException(option,argv[i]);
2325 ThrowConvertException(OptionError,"UnrecognizedOption",option)
2329 if (LocaleCompare("sample",option+1) == 0)
2334 if (i == (long) (argc-1))
2335 ThrowConvertException(OptionError,"MissingArgument",option);
2336 if (IsGeometry(argv[i]) == MagickFalse)
2337 ThrowConvertInvalidArgumentException(option,argv[i]);
2340 if (LocaleCompare("sampling-factor",option+1) == 0)
2345 if (i == (long) (argc-1))
2346 ThrowConvertException(OptionError,"MissingArgument",option);
2347 if (IsGeometry(argv[i]) == MagickFalse)
2348 ThrowConvertInvalidArgumentException(option,argv[i]);
2351 if (LocaleCompare("scale",option+1) == 0)
2356 if (i == (long) (argc-1))
2357 ThrowConvertException(OptionError,"MissingArgument",option);
2358 if (IsGeometry(argv[i]) == MagickFalse)
2359 ThrowConvertInvalidArgumentException(option,argv[i]);
2362 if (LocaleCompare("scene",option+1) == 0)
2367 if (i == (long) (argc-1))
2368 ThrowConvertException(OptionError,"MissingArgument",option);
2369 if (IsGeometry(argv[i]) == MagickFalse)
2370 ThrowConvertInvalidArgumentException(option,argv[i]);
2373 if (LocaleCompare("seed",option+1) == 0)
2378 if (i == (long) (argc-1))
2379 ThrowConvertException(OptionError,"MissingArgument",option);
2380 if (IsGeometry(argv[i]) == MagickFalse)
2381 ThrowConvertInvalidArgumentException(option,argv[i]);
2384 if (LocaleCompare("segment",option+1) == 0)
2389 if (i == (long) (argc-1))
2390 ThrowConvertException(OptionError,"MissingArgument",option);
2391 if (IsGeometry(argv[i]) == MagickFalse)
2392 ThrowConvertInvalidArgumentException(option,argv[i]);
2395 if (LocaleCompare("selective-blur",option+1) == 0)
2398 if (i == (long) (argc-1))
2399 ThrowConvertException(OptionError,"MissingArgument",option);
2400 if (IsGeometry(argv[i]) == MagickFalse)
2401 ThrowConvertInvalidArgumentException(option,argv[i]);
2404 if (LocaleCompare("separate",option+1) == 0)
2406 if (LocaleCompare("sepia-tone",option+1) == 0)
2411 if (i == (long) (argc-1))
2412 ThrowConvertException(OptionError,"MissingArgument",option);
2413 if (IsGeometry(argv[i]) == MagickFalse)
2414 ThrowConvertInvalidArgumentException(option,argv[i]);
2417 if (LocaleCompare("set",option+1) == 0)
2420 if (i == (long) argc)
2421 ThrowConvertException(OptionError,"MissingArgument",option);
2425 if (i == (long) argc)
2426 ThrowConvertException(OptionError,"MissingArgument",option);
2429 if (LocaleCompare("shade",option+1) == 0)
2432 if (i == (long) (argc-1))
2433 ThrowConvertException(OptionError,"MissingArgument",option);
2434 if (IsGeometry(argv[i]) == MagickFalse)
2435 ThrowConvertInvalidArgumentException(option,argv[i]);
2438 if (LocaleCompare("shadow",option+1) == 0)
2443 if (i == (long) (argc-1))
2444 ThrowConvertException(OptionError,"MissingArgument",option);
2445 if (IsGeometry(argv[i]) == MagickFalse)
2446 ThrowConvertInvalidArgumentException(option,argv[i]);
2449 if (LocaleCompare("sharpen",option+1) == 0)
2452 if (i == (long) (argc-1))
2453 ThrowConvertException(OptionError,"MissingArgument",option);
2454 if (IsGeometry(argv[i]) == MagickFalse)
2455 ThrowConvertInvalidArgumentException(option,argv[i]);
2458 if (LocaleCompare("shave",option+1) == 0)
2463 if (i == (long) (argc-1))
2464 ThrowConvertException(OptionError,"MissingArgument",option);
2465 if (IsGeometry(argv[i]) == MagickFalse)
2466 ThrowConvertInvalidArgumentException(option,argv[i]);
2469 if (LocaleCompare("shear",option+1) == 0)
2472 if (i == (long) (argc-1))
2473 ThrowConvertException(OptionError,"MissingArgument",option);
2474 if (IsGeometry(argv[i]) == MagickFalse)
2475 ThrowConvertInvalidArgumentException(option,argv[i]);
2478 if (LocaleCompare("sigmoidal-contrast",option+1) == 0)
2481 if (i == (long) (argc-1))
2482 ThrowConvertException(OptionError,"MissingArgument",option);
2483 if (IsGeometry(argv[i]) == MagickFalse)
2484 ThrowConvertInvalidArgumentException(option,argv[i]);
2487 if (LocaleCompare("size",option+1) == 0)
2492 if (i == (long) (argc-1))
2493 ThrowConvertException(OptionError,"MissingArgument",option);
2494 if (IsGeometry(argv[i]) == MagickFalse)
2495 ThrowConvertInvalidArgumentException(option,argv[i]);
2498 if (LocaleCompare("sketch",option+1) == 0)
2503 if (i == (long) (argc-1))
2504 ThrowConvertException(OptionError,"MissingArgument",option);
2505 if (IsGeometry(argv[i]) == MagickFalse)
2506 ThrowConvertInvalidArgumentException(option,argv[i]);
2509 if (LocaleCompare("solarize",option+1) == 0)
2514 if (i == (long) (argc-1))
2515 ThrowConvertException(OptionError,"MissingArgument",option);
2516 if (IsGeometry(argv[i]) == MagickFalse)
2517 ThrowConvertInvalidArgumentException(option,argv[i]);
2520 if (LocaleCompare("sparse-color",option+1) == 0)
2526 if (i == (long) argc)
2527 ThrowConvertException(OptionError,"MissingArgument",option);
2528 op=ParseMagickOption(MagickSparseColorOptions,MagickFalse,argv[i]);
2530 ThrowConvertException(OptionError,"UnrecognizedSparseColorMethod",
2533 if (i == (long) (argc-1))
2534 ThrowConvertException(OptionError,"MissingArgument",option);
2537 if (LocaleCompare("splice",option+1) == 0)
2542 if (i == (long) (argc-1))
2543 ThrowConvertException(OptionError,"MissingArgument",option);
2544 if (IsGeometry(argv[i]) == MagickFalse)
2545 ThrowConvertInvalidArgumentException(option,argv[i]);
2548 if (LocaleCompare("spread",option+1) == 0)
2553 if ((i == (long) (argc-1)) ||
2554 (IsGeometry(argv[i]) == MagickFalse))
2555 ThrowConvertException(OptionError,"MissingArgument",option);
2558 if (LocaleCompare("stretch",option+1) == 0)
2566 if (i == (long) (argc-1))
2567 ThrowConvertException(OptionError,"MissingArgument",option);
2568 stretch=ParseMagickOption(MagickStretchOptions,MagickFalse,
2571 ThrowConvertException(OptionError,"UnrecognizedStyleType",
2575 if (LocaleCompare("strip",option+1) == 0)
2577 if (LocaleCompare("stroke",option+1) == 0)
2582 if (i == (long) (argc-1))
2583 ThrowConvertException(OptionError,"MissingArgument",option);
2586 if (LocaleCompare("strokewidth",option+1) == 0)
2591 if (i == (long) (argc-1))
2592 ThrowConvertException(OptionError,"MissingArgument",option);
2593 if (IsGeometry(argv[i]) == MagickFalse)
2594 ThrowConvertInvalidArgumentException(option,argv[i]);
2597 if (LocaleCompare("style",option+1) == 0)
2605 if (i == (long) (argc-1))
2606 ThrowConvertException(OptionError,"MissingArgument",option);
2607 style=ParseMagickOption(MagickStyleOptions,MagickFalse,argv[i]);
2609 ThrowConvertException(OptionError,"UnrecognizedStyleType",
2613 if (LocaleCompare("support",option+1) == 0)
2615 i++; /* deprecated */
2618 if (LocaleCompare("swap",option+1) == 0)
2623 if (i == (long) (argc-1))
2624 ThrowConvertException(OptionError,"MissingArgument",option);
2625 if (IsGeometry(argv[i]) == MagickFalse)
2626 ThrowConvertInvalidArgumentException(option,argv[i]);
2629 if (LocaleCompare("swirl",option+1) == 0)
2634 if (i == (long) (argc-1))
2635 ThrowConvertException(OptionError,"MissingArgument",option);
2636 if (IsGeometry(argv[i]) == MagickFalse)
2637 ThrowConvertInvalidArgumentException(option,argv[i]);
2640 ThrowConvertException(OptionError,"UnrecognizedOption",option)
2644 if (LocaleCompare("taint",option+1) == 0)
2646 if (LocaleCompare("texture",option+1) == 0)
2651 if (i == (long) (argc-1))
2652 ThrowConvertException(OptionError,"MissingArgument",option);
2655 if (LocaleCompare("thumbnail",option+1) == 0)
2660 if (i == (long) (argc-1))
2661 ThrowConvertException(OptionError,"MissingArgument",option);
2662 if (IsGeometry(argv[i]) == MagickFalse)
2663 ThrowConvertInvalidArgumentException(option,argv[i]);
2666 if (LocaleCompare("threshold",option+1) == 0)
2671 if (i == (long) (argc-1))
2672 ThrowConvertException(OptionError,"MissingArgument",option);
2673 if (IsGeometry(argv[i]) == MagickFalse)
2674 ThrowConvertInvalidArgumentException(option,argv[i]);
2677 if (LocaleCompare("tile",option+1) == 0)
2682 if (i == (long) (argc-1))
2683 ThrowConvertException(OptionError,"MissingArgument",option);
2686 if (LocaleCompare("tile-offset",option+1) == 0)
2691 if (i == (long) (argc-1))
2692 ThrowConvertException(OptionError,"MissingArgument",option);
2693 if (IsGeometry(argv[i]) == MagickFalse)
2694 ThrowConvertInvalidArgumentException(option,argv[i]);
2697 if (LocaleCompare("tint",option+1) == 0)
2702 if (i == (long) (argc-1))
2703 ThrowConvertException(OptionError,"MissingArgument",option);
2704 if (IsGeometry(argv[i]) == MagickFalse)
2705 ThrowConvertInvalidArgumentException(option,argv[i]);
2708 if (LocaleCompare("transform",option+1) == 0)
2710 if (LocaleCompare("transparent",option+1) == 0)
2713 if (i == (long) (argc-1))
2714 ThrowConvertException(OptionError,"MissingArgument",option);
2717 if (LocaleCompare("transparent-color",option+1) == 0)
2722 if (i == (long) (argc-1))
2723 ThrowConvertException(OptionError,"MissingArgument",option);
2726 if (LocaleCompare("transpose",option+1) == 0)
2728 if (LocaleCompare("transverse",option+1) == 0)
2730 if (LocaleCompare("treedepth",option+1) == 0)
2735 if (i == (long) (argc-1))
2736 ThrowConvertException(OptionError,"MissingArgument",option);
2737 if (IsGeometry(argv[i]) == MagickFalse)
2738 ThrowConvertInvalidArgumentException(option,argv[i]);
2741 if (LocaleCompare("trim",option+1) == 0)
2743 if (LocaleCompare("type",option+1) == 0)
2751 if (i == (long) (argc-1))
2752 ThrowConvertException(OptionError,"MissingArgument",option);
2753 type=ParseMagickOption(MagickTypeOptions,MagickFalse,argv[i]);
2755 ThrowConvertException(OptionError,"UnrecognizedImageType",
2759 ThrowConvertException(OptionError,"UnrecognizedOption",option)
2763 if (LocaleCompare("undercolor",option+1) == 0)
2768 if (i == (long) (argc-1))
2769 ThrowConvertException(OptionError,"MissingArgument",option);
2772 if (LocaleCompare("unique-colors",option+1) == 0)
2774 if (LocaleCompare("units",option+1) == 0)
2782 if (i == (long) (argc-1))
2783 ThrowConvertException(OptionError,"MissingArgument",option);
2784 units=ParseMagickOption(MagickResolutionOptions,MagickFalse,
2787 ThrowConvertException(OptionError,"UnrecognizedUnitsType",
2791 if (LocaleCompare("unsharp",option+1) == 0)
2796 if (i == (long) (argc-1))
2797 ThrowConvertException(OptionError,"MissingArgument",option);
2798 if (IsGeometry(argv[i]) == MagickFalse)
2799 ThrowConvertInvalidArgumentException(option,argv[i]);
2802 ThrowConvertException(OptionError,"UnrecognizedOption",option)
2806 if (LocaleCompare("verbose",option+1) == 0)
2808 if ((LocaleCompare("version",option+1) == 0) ||
2809 (LocaleCompare("-version",option+1) == 0))
2811 (void) fprintf(stdout,"Version: %s\n",
2812 GetMagickVersion((unsigned long *) NULL));
2813 (void) fprintf(stdout,"Copyright: %s\n",GetMagickCopyright());
2814 (void) fprintf(stdout,"Features: %s\n\n",GetMagickFeatures());
2817 if (LocaleCompare("view",option+1) == 0)
2822 if (i == (long) (argc-1))
2823 ThrowConvertException(OptionError,"MissingArgument",option);
2826 if (LocaleCompare("vignette",option+1) == 0)
2831 if (i == (long) (argc-1))
2832 ThrowConvertException(OptionError,"MissingArgument",option);
2833 if (IsGeometry(argv[i]) == MagickFalse)
2834 ThrowConvertInvalidArgumentException(option,argv[i]);
2837 if (LocaleCompare("virtual-pixel",option+1) == 0)
2845 if (i == (long) (argc-1))
2846 ThrowConvertException(OptionError,"MissingArgument",option);
2847 method=ParseMagickOption(MagickVirtualPixelOptions,MagickFalse,
2850 ThrowConvertException(OptionError,
2851 "UnrecognizedVirtualPixelMethod",argv[i]);
2854 ThrowConvertException(OptionError,"UnrecognizedOption",option)
2858 if (LocaleCompare("wave",option+1) == 0)
2861 if (i == (long) (argc-1))
2862 ThrowConvertException(OptionError,"MissingArgument",option);
2863 if (IsGeometry(argv[i]) == MagickFalse)
2864 ThrowConvertInvalidArgumentException(option,argv[i]);
2867 if (LocaleCompare("weight",option+1) == 0)
2872 if (i == (long) (argc-1))
2873 ThrowConvertException(OptionError,"MissingArgument",option);
2876 if (LocaleCompare("white-point",option+1) == 0)
2881 if (i == (long) (argc-1))
2882 ThrowConvertException(OptionError,"MissingArgument",option);
2883 if (IsGeometry(argv[i]) == MagickFalse)
2884 ThrowConvertInvalidArgumentException(option,argv[i]);
2887 if (LocaleCompare("white-threshold",option+1) == 0)
2892 if (i == (long) (argc-1))
2893 ThrowConvertException(OptionError,"MissingArgument",option);
2894 if (IsGeometry(argv[i]) == MagickFalse)
2895 ThrowConvertInvalidArgumentException(option,argv[i]);
2898 if (LocaleCompare("write",option+1) == 0)
2901 if (i == (long) (argc-1))
2902 ThrowConvertException(OptionError,"MissingArgument",option);
2905 ThrowConvertException(OptionError,"UnrecognizedOption",option)
2910 ThrowConvertException(OptionError,"UnrecognizedOption",option)
2912 fire=ParseMagickOption(MagickImageListOptions,MagickFalse,option+1) < 0 ?
2913 MagickFalse : MagickTrue;
2914 if (fire != MagickFalse)
2915 FireImageStack(MagickTrue,MagickTrue,MagickTrue);
2918 ThrowConvertException(OptionError,"UnbalancedParenthesis",argv[i]);
2919 if (i-- != (long) (argc-1))
2920 ThrowConvertException(OptionError,"MissingAnImageFilename",argv[argc-1]);
2921 if (image == (Image *) NULL)
2922 ThrowConvertException(OptionError,"MissingAnImageFilename",argv[argc-1]);
2923 FinalizeImageSettings(image_info,image,MagickTrue);
2924 if (image == (Image *) NULL)
2925 ThrowConvertException(OptionError,"MissingAnImageFilename",argv[argc-1]);
2926 status&=WriteImages(image_info,image,argv[argc-1],exception);
2927 if (metadata != (char **) NULL)
2932 text=InterpretImageProperties(image_info,image,format);
2933 if (text == (char *) NULL)
2934 ThrowConvertException(ResourceLimitError,"MemoryAllocationFailed",
2935 GetExceptionMessage(errno));
2936 (void) ConcatenateString(&(*metadata),text);
2937 text=DestroyString(text);
2940 return(status != 0 ? MagickTrue : MagickFalse);