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-2011 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 "MagickWand/studio.h"
46 #include "MagickWand/MagickWand.h"
47 #include "MagickWand/mogrify-private.h"
48 #include "MagickCore/string-private.h"
49 #include "MagickCore/utility-private.h"
53 #define ThrowFileException(exception,severity,tag,context) \
58 message=GetExceptionMessage(errno); \
59 (void) ThrowMagickException(exception,GetMagickModule(),severity, \
60 tag == (const char *) NULL ? "unknown" : tag,"`%s': %s",context,message); \
61 message=DestroyString(message); \
65 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
69 + C o n v e r t I m a g e C o m m a n d %
73 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
75 % ConvertImageCommand() reads one or more images, applies one or more image
76 % processing operations, and writes out the image in the same or differing
79 % The format of the ConvertImageCommand method is:
81 % MagickBooleanType ConvertImageCommand(ImageInfo *image_info,int argc,
82 % char **argv,char **metadata,ExceptionInfo *exception)
84 % A description of each parameter follows:
86 % o image_info: the image info.
88 % o argc: the number of elements in the argument vector.
90 % o argv: A text array containing the command line arguments.
92 % o metadata: any metadata is returned here.
94 % o exception: return any errors or warnings in this structure.
98 static MagickBooleanType ConcatenateImages(int argc,char **argv,
99 ExceptionInfo *exception)
114 output=fopen_utf8(argv[argc-1],"wb");
115 if (output == (FILE *) NULL)
117 ThrowFileException(exception,FileOpenError,"UnableToOpenFile",
121 for (i=2; i < (ssize_t) (argc-1); i++)
123 input=fopen_utf8(argv[i],"rb");
124 if (input == (FILE *) NULL)
125 ThrowFileException(exception,FileOpenError,"UnableToOpenFile",argv[i]);
126 for (c=fgetc(input); c != EOF; c=fgetc(input))
127 (void) fputc((char) c,output);
128 (void) fclose(input);
129 (void) remove_utf8(argv[i]);
131 (void) fclose(output);
135 static MagickBooleanType ConvertUsage(void)
140 "-debug events display copious debugging information",
141 "-help print program options",
142 "-list type print a list of supported option arguments",
143 "-log format format of debugging information",
144 "-version print version information",
149 "-adaptive-blur geometry",
150 " adaptively blur pixels; decrease effect near edges",
151 "-adaptive-resize geometry",
152 " adaptively resize image using 'mesh' interpolation",
153 "-adaptive-sharpen geometry",
154 " adaptively sharpen pixels; increase effect near edges",
155 "-alpha option on, activate, off, deactivate, set, opaque, copy",
156 " transparent, extract, background, or shape",
157 "-annotate geometry text",
158 " annotate the image with text",
159 "-auto-gamma automagically adjust gamma level of image",
160 "-auto-level automagically adjust color levels of image",
161 "-auto-orient automagically orient (rotate) image",
162 "-bench iterations measure performance",
163 "-black-threshold value",
164 " force all pixels below the threshold into black",
165 "-blue-shift factor simulate a scene at nighttime in the moonlight",
166 "-blur geometry reduce image noise and reduce detail levels",
167 "-border geometry surround image with a border of color",
168 "-bordercolor color border color",
169 "-brightness-contrast geometry",
170 " improve brightness / contrast of the image",
171 "-cdl filename color correct with a color decision list",
172 "-charcoal radius simulate a charcoal drawing",
173 "-chop geometry remove pixels from the image interior",
174 "-clamp restrict pixel range from 0 to the quantum depth",
175 "-clip clip along the first path from the 8BIM profile",
176 "-clip-mask filename associate a clip mask with the image",
177 "-clip-path id clip along a named path from the 8BIM profile",
178 "-colorize value colorize the image with the fill color",
179 "-color-matrix matrix apply color correction to the image",
180 "-contrast enhance or reduce the image contrast",
181 "-contrast-stretch geometry",
182 " improve contrast by `stretching' the intensity range",
183 "-convolve coefficients",
184 " apply a convolution kernel to the image",
185 "-cycle amount cycle the image colormap",
186 "-decipher filename convert cipher pixels to plain pixels",
187 "-deskew threshold straighten an image",
188 "-despeckle reduce the speckles within an image",
189 "-distort method args",
190 " distort images according to given method ad args",
191 "-draw string annotate the image with a graphic primitive",
192 "-edge radius apply a filter to detect edges in the image",
193 "-encipher filename convert plain pixels to cipher pixels",
194 "-emboss radius emboss an image",
195 "-enhance apply a digital filter to enhance a noisy image",
196 "-equalize perform histogram equalization to an image",
197 "-evaluate operator value",
198 " evaluate an arithmetic, relational, or logical expression",
199 "-extent geometry set the image size",
200 "-extract geometry extract area from image",
201 "-fft implements the discrete Fourier transform (DFT)",
202 "-flip flip image vertically",
203 "-floodfill geometry color",
204 " floodfill the image with color",
205 "-flop flop image horizontally",
206 "-frame geometry surround image with an ornamental border",
207 "-function name parameters",
208 " apply function over image values",
209 "-gamma value level of gamma correction",
210 "-gaussian-blur geometry",
211 " reduce image noise and reduce detail levels",
212 "-geometry geometry preferred size or location of the image",
213 "-identify identify the format and characteristics of the image",
214 "-ift implements the inverse discrete Fourier transform (DFT)",
215 "-implode amount implode image pixels about the center",
216 "-lat geometry local adaptive thresholding",
217 "-layers method optimize, merge, or compare image layers",
218 "-level value adjust the level of image contrast",
219 "-level-colors color,color",
220 " level image with the given colors",
221 "-linear-stretch geometry",
222 " improve contrast by `stretching with saturation'",
223 "-liquid-rescale geometry",
224 " rescale image with seam-carving",
225 "-median geometry apply a median filter to the image",
226 "-mode geometry make each pixel the 'predominant color' of the neighborhood",
227 "-modulate value vary the brightness, saturation, and hue",
228 "-monochrome transform image to black and white",
229 "-morphology method kernel",
230 " apply a morphology method to the image",
231 "-motion-blur geometry",
232 " simulate motion blur",
233 "-negate replace every pixel with its complementary color ",
234 "-noise geometry add or reduce noise in an image",
235 "-normalize transform image to span the full range of colors",
236 "-opaque color change this color to the fill color",
237 "-ordered-dither NxN",
238 " add a noise pattern to the image with specific",
240 "-paint radius simulate an oil painting",
241 "-polaroid angle simulate a Polaroid picture",
242 "-posterize levels reduce the image to a limited number of color levels",
243 "-profile filename add, delete, or apply an image profile",
244 "-quantize colorspace reduce colors in this colorspace",
245 "-radial-blur angle radial blur the image",
246 "-raise value lighten/darken image edges to create a 3-D effect",
247 "-random-threshold low,high",
248 " random threshold the image",
249 "-region geometry apply options to a portion of the image",
250 "-render render vector graphics",
251 "-repage geometry size and location of an image canvas",
252 "-resample geometry change the resolution of an image",
253 "-resize geometry resize the image",
254 "-roll geometry roll an image vertically or horizontally",
255 "-rotate degrees apply Paeth rotation to the image",
256 "-sample geometry scale image with pixel sampling",
257 "-scale geometry scale the image",
258 "-segment values segment an image",
259 "-selective-blur geometry",
260 " selectively blur pixels within a contrast threshold",
261 "-sepia-tone threshold",
262 " simulate a sepia-toned photo",
263 "-set property value set an image property",
264 "-shade degrees shade the image using a distant light source",
265 "-shadow geometry simulate an image shadow",
266 "-sharpen geometry sharpen the image",
267 "-shave geometry shave pixels from the image edges",
268 "-shear geometry slide one edge of the image along the X or Y axis",
269 "-sigmoidal-contrast geometry",
270 " increase the contrast without saturating highlights or shadows",
271 "-sketch geometry simulate a pencil sketch",
272 "-solarize threshold negate all pixels above the threshold level",
273 "-sparse-color method args",
274 " fill in a image based on a few color points",
275 "-splice geometry splice the background color into the image",
276 "-spread radius displace image pixels by a random amount",
277 "-statistic type geometry",
278 " replace each pixel with corresponding statistic from the neighborhood",
279 "-strip strip image of all profiles and comments",
280 "-swirl degrees swirl image pixels about the center",
281 "-threshold value threshold the image",
282 "-thumbnail geometry create a thumbnail of the image",
283 "-tile filename tile image when filling a graphic primitive",
284 "-tint value tint the image with the fill color",
285 "-transform affine transform image",
286 "-transparent color make this color transparent within the image",
287 "-transpose flip image vertically and rotate 90 degrees",
288 "-transverse flop image horizontally and rotate 270 degrees",
289 "-trim trim image edges",
290 "-type type image type",
291 "-unique-colors discard all but one of any pixel color",
292 "-unsharp geometry sharpen the image",
293 "-vignette geometry soften the edges of the image in vignette style",
294 "-wave geometry alter an image along a sine wave",
295 "-white-threshold value",
296 " force all pixels above the threshold into white",
299 *sequence_operators[]=
301 "-append append an image sequence",
302 "-clut apply a color lookup table to the image",
303 "-coalesce merge a sequence of images",
304 "-combine combine a sequence of images",
305 "-composite composite image",
306 "-crop geometry cut out a rectangular region of the image",
307 "-deconstruct break down an image sequence into constituent parts",
308 "-evaluate-sequence operator",
309 " evaluate an arithmetic, relational, or logical expression",
310 "-flatten flatten a sequence of images",
311 "-fx expression apply mathematical expression to an image channel(s)",
312 "-hald-clut apply a Hald color lookup table to the image",
313 "-morph value morph an image sequence",
314 "-mosaic create a mosaic from an image sequence",
315 "-print string interpret string and print to console",
316 "-process arguments process the image with a custom image filter",
317 "-separate separate an image channel into a grayscale image",
318 "-smush geometry smush an image sequence together",
319 "-write filename write images to this file",
324 "-adjoin join images into a single multi-image file",
325 "-affine matrix affine transform matrix",
326 "-alpha option activate, deactivate, reset, or set the alpha channel",
327 "-antialias remove pixel-aliasing",
328 "-authenticate password",
329 " decipher image with this password",
330 "-attenuate value lessen (or intensify) when adding noise to an image",
331 "-background color background color",
332 "-bias value add bias when convolving an image",
333 "-black-point-compensation",
334 " use black point compensation",
335 "-blue-primary point chromaticity blue primary point",
336 "-bordercolor color border color",
337 "-caption string assign a caption to an image",
338 "-channel type apply option to select image channels",
339 "-colors value preferred number of colors in the image",
340 "-colorspace type alternate image colorspace",
341 "-comment string annotate image with comment",
342 "-compose operator set image composite operator",
343 "-compress type type of pixel compression when writing the image",
344 "-define format:option",
345 " define one or more image format options",
346 "-delay value display the next image after pausing",
347 "-density geometry horizontal and vertical density of the image",
348 "-depth value image depth",
349 "-direction type render text right-to-left or left-to-right",
350 "-display server get image or font from this X server",
351 "-dispose method layer disposal method",
352 "-dither method apply error diffusion to image",
353 "-encoding type text encoding type",
354 "-endian type endianness (MSB or LSB) of the image",
355 "-family name render text with this font family",
356 "-fill color color to use when filling a graphic primitive",
357 "-filter type use this filter when resizing an image",
358 "-font name render text with this font",
359 "-format \"string\" output formatted image characteristics",
360 "-fuzz distance colors within this distance are considered equal",
361 "-gravity type horizontal and vertical text placement",
362 "-green-primary point chromaticity green primary point",
363 "-intent type type of rendering intent when managing the image color",
364 "-interlace type type of image interlacing scheme",
365 "-interline-spacing value",
366 " set the space between two text lines",
367 "-interpolate method pixel color interpolation method",
368 "-interword-spacing value",
369 " set the space between two words",
370 "-kerning value set the space between two letters",
371 "-label string assign a label to an image",
372 "-limit type value pixel cache resource limit",
373 "-loop iterations add Netscape loop extension to your GIF animation",
374 "-mask filename associate a mask with the image",
375 "-mattecolor color frame color",
376 "-monitor monitor progress",
377 "-orient type image orientation",
378 "-page geometry size and location of an image canvas (setting)",
379 "-ping efficiently determine image attributes",
380 "-pointsize value font point size",
381 "-precision value maximum number of significant digits to print",
382 "-preview type image preview type",
383 "-quality value JPEG/MIFF/PNG compression level",
384 "-quiet suppress all warning messages",
385 "-red-primary point chromaticity red primary point",
386 "-regard-warnings pay attention to warning messages",
387 "-remap filename transform image colors to match this set of colors",
388 "-respect-parentheses settings remain in effect until parenthesis boundary",
389 "-sampling-factor geometry",
390 " horizontal and vertical sampling factor",
391 "-scene value image scene number",
392 "-seed value seed a new sequence of pseudo-random numbers",
393 "-size geometry width and height of image",
394 "-stretch type render text with this font stretch",
395 "-stroke color graphic primitive stroke color",
396 "-strokewidth value graphic primitive stroke width",
397 "-style type render text with this font style",
398 "-synchronize synchronize image to storage device",
399 "-taint declare the image as modified",
400 "-texture filename name of texture to tile onto the image background",
401 "-tile-offset geometry",
403 "-treedepth value color tree depth",
404 "-transparent-color color",
405 " transparent color",
406 "-undercolor color annotation bounding box color",
407 "-units type the units of image resolution",
408 "-verbose print detailed information about the image",
409 "-view FlashPix viewing transforms",
410 "-virtual-pixel method",
411 " virtual pixel access method",
412 "-weight type render text with this font weight",
413 "-white-point point chromaticity white point",
418 "-clone indexes clone an image",
419 "-delete indexes delete the image from the image sequence",
420 "-duplicate count,indexes",
421 " duplicate an image one or more times",
422 "-insert index insert last image into the image sequence",
423 "-reverse reverse image sequence",
424 "-swap indexes swap two images in the image sequence",
431 (void) printf("Version: %s\n",GetMagickVersion((size_t *) NULL));
432 (void) printf("Copyright: %s\n",GetMagickCopyright());
433 (void) printf("Features: %s\n\n",GetMagickFeatures());
434 (void) printf("Usage: %s [options ...] file [ [options ...] "
435 "file ...] [options ...] file\n",GetClientName());
436 (void) printf("\nImage Settings:\n");
437 for (p=settings; *p != (char *) NULL; p++)
438 (void) printf(" %s\n",*p);
439 (void) printf("\nImage Operators:\n");
440 for (p=operators; *p != (char *) NULL; p++)
441 (void) printf(" %s\n",*p);
442 (void) printf("\nImage Sequence Operators:\n");
443 for (p=sequence_operators; *p != (char *) NULL; p++)
444 (void) printf(" %s\n",*p);
445 (void) printf("\nImage Stack Operators:\n");
446 for (p=stack_operators; *p != (char *) NULL; p++)
447 (void) printf(" %s\n",*p);
448 (void) printf("\nMiscellaneous Options:\n");
449 for (p=miscellaneous; *p != (char *) NULL; p++)
450 (void) printf(" %s\n",*p);
452 "\nBy default, the image format of `file' is determined by its magic\n");
454 "number. To specify a particular image format, precede the filename\n");
456 "with an image format name and a colon (i.e. ps:image) or specify the\n");
458 "image type as the filename suffix (i.e. image.ps). Specify 'file' as\n");
459 (void) printf("'-' for standard input or output.\n");
463 WandExport MagickBooleanType ConvertImageCommand(ImageInfo *image_info,
464 int argc,char **argv,char **metadata,ExceptionInfo *exception)
466 #define NotInitialized (unsigned int) (~0)
467 #define DestroyConvert() \
469 DestroyImageStack(); \
470 for (i=0; i < (ssize_t) argc; i++) \
471 argv[i]=DestroyString(argv[i]); \
472 argv=(char **) RelinquishMagickMemory(argv); \
474 #define ThrowConvertException(asperity,tag,option) \
476 (void) ThrowMagickException(exception,GetMagickModule(),asperity,tag,"`%s'", \
479 return(MagickFalse); \
481 #define ThrowConvertInvalidArgumentException(option,argument) \
483 (void) ThrowMagickException(exception,GetMagickModule(),OptionError, \
484 "InvalidArgument","`%s': %s",option,argument); \
486 return(MagickFalse); \
500 image_stack[MaxImageStackDepth+1];
520 assert(image_info != (ImageInfo *) NULL);
521 assert(image_info->signature == MagickSignature);
522 if (image_info->debug != MagickFalse)
523 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
524 assert(exception != (ExceptionInfo *) NULL);
528 if ((LocaleCompare("version",option+1) == 0) ||
529 (LocaleCompare("-version",option+1) == 0))
531 (void) FormatLocaleFile(stdout,"Version: %s\n",
532 GetMagickVersion((size_t *) NULL));
533 (void) FormatLocaleFile(stdout,"Copyright: %s\n",
534 GetMagickCopyright());
535 (void) FormatLocaleFile(stdout,"Features: %s\n\n",
536 GetMagickFeatures());
541 return(ConvertUsage());
542 filename=(char *) NULL;
547 option=(char *) NULL;
549 respect_parenthesis=MagickFalse;
552 Parse command-line arguments.
554 ReadCommandlLine(argc,&argv);
555 status=ExpandFilenames(&argc,&argv);
556 if (status == MagickFalse)
557 ThrowConvertException(ResourceLimitError,"MemoryAllocationFailed",
558 GetExceptionMessage(errno));
559 if ((argc > 2) && (LocaleCompare("-concatenate",argv[1]) == 0))
560 return(ConcatenateImages(argc,argv,exception));
561 for (i=1; i < (ssize_t) (argc-1); i++)
564 if (LocaleCompare(option,"(") == 0)
566 FireImageStack(MagickTrue,MagickTrue,pend);
567 if (k == MaxImageStackDepth)
568 ThrowConvertException(OptionError,"ParenthesisNestedTooDeeply",
573 if (LocaleCompare(option,")") == 0)
575 FireImageStack(MagickTrue,MagickTrue,MagickTrue);
577 ThrowConvertException(OptionError,"UnableToParseExpression",option);
581 if (IsCommandOption(option) == MagickFalse)
589 FireImageStack(MagickTrue,MagickTrue,pend);
591 if ((LocaleCompare(filename,"--") == 0) && (i < (ssize_t) (argc-1)))
593 (void) CopyMagickString(image_info->filename,filename,MaxTextExtent);
594 if (image_info->ping != MagickFalse)
595 images=PingImages(image_info,exception);
597 images=ReadImages(image_info,exception);
598 status&=(images != (Image *) NULL) &&
599 (exception->severity < ErrorException);
600 if (images == (Image *) NULL)
602 AppendImageStack(images);
605 pend=image != (Image *) NULL ? MagickTrue : MagickFalse;
610 if (LocaleCompare("adaptive-blur",option+1) == 0)
613 if (i == (ssize_t) (argc-1))
614 ThrowConvertException(OptionError,"MissingArgument",option);
615 if (IsGeometry(argv[i]) == MagickFalse)
616 ThrowConvertInvalidArgumentException(option,argv[i]);
619 if (LocaleCompare("adaptive-resize",option+1) == 0)
622 if (i == (ssize_t) (argc-1))
623 ThrowConvertException(OptionError,"MissingArgument",option);
624 if (IsGeometry(argv[i]) == MagickFalse)
625 ThrowConvertInvalidArgumentException(option,argv[i]);
628 if (LocaleCompare("adaptive-sharpen",option+1) == 0)
631 if (i == (ssize_t) (argc-1))
632 ThrowConvertException(OptionError,"MissingArgument",option);
633 if (IsGeometry(argv[i]) == MagickFalse)
634 ThrowConvertInvalidArgumentException(option,argv[i]);
637 if (LocaleCompare("adjoin",option+1) == 0)
639 if (LocaleCompare("affine",option+1) == 0)
644 if (i == (ssize_t) (argc-1))
645 ThrowConvertException(OptionError,"MissingArgument",option);
648 if (LocaleCompare("alpha",option+1) == 0)
656 if (i == (ssize_t) argc)
657 ThrowConvertException(OptionError,"MissingArgument",option);
658 type=ParseCommandOption(MagickAlphaOptions,MagickFalse,argv[i]);
660 ThrowConvertException(OptionError,"UnrecognizedAlphaChannelType",
664 if (LocaleCompare("annotate",option+1) == 0)
669 if (i == (ssize_t) (argc-1))
670 ThrowConvertException(OptionError,"MissingArgument",option);
671 if (IsGeometry(argv[i]) == MagickFalse)
672 ThrowConvertInvalidArgumentException(option,argv[i]);
674 if (i == (ssize_t) (argc-1))
675 ThrowConvertException(OptionError,"MissingArgument",option);
678 if (LocaleCompare("antialias",option+1) == 0)
680 if (LocaleCompare("append",option+1) == 0)
682 if (LocaleCompare("attenuate",option+1) == 0)
687 if (i == (ssize_t) (argc-1))
688 ThrowConvertException(OptionError,"MissingArgument",option);
689 if (IsGeometry(argv[i]) == MagickFalse)
690 ThrowConvertInvalidArgumentException(option,argv[i]);
693 if (LocaleCompare("authenticate",option+1) == 0)
698 if (i == (ssize_t) (argc-1))
699 ThrowConvertException(OptionError,"MissingArgument",option);
702 if (LocaleCompare("auto-gamma",option+1) == 0)
704 if (LocaleCompare("auto-level",option+1) == 0)
706 if (LocaleCompare("auto-orient",option+1) == 0)
708 if (LocaleCompare("average",option+1) == 0)
710 ThrowConvertException(OptionError,"UnrecognizedOption",option)
714 if (LocaleCompare("background",option+1) == 0)
719 if (i == (ssize_t) (argc-1))
720 ThrowConvertException(OptionError,"MissingArgument",option);
723 if (LocaleCompare("bench",option+1) == 0)
728 if (i == (ssize_t) (argc-1))
729 ThrowConvertException(OptionError,"MissingArgument",option);
730 if (IsGeometry(argv[i]) == MagickFalse)
731 ThrowConvertInvalidArgumentException(option,argv[i]);
734 if (LocaleCompare("bias",option+1) == 0)
739 if (i == (ssize_t) (argc-1))
740 ThrowConvertException(OptionError,"MissingArgument",option);
741 if (IsGeometry(argv[i]) == MagickFalse)
742 ThrowConvertInvalidArgumentException(option,argv[i]);
745 if (LocaleCompare("black-point-compensation",option+1) == 0)
747 if (LocaleCompare("black-threshold",option+1) == 0)
752 if (i == (ssize_t) (argc-1))
753 ThrowConvertException(OptionError,"MissingArgument",option);
754 if (IsGeometry(argv[i]) == MagickFalse)
755 ThrowConvertInvalidArgumentException(option,argv[i]);
758 if (LocaleCompare("blue-primary",option+1) == 0)
763 if (i == (ssize_t) (argc-1))
764 ThrowConvertException(OptionError,"MissingArgument",option);
765 if (IsGeometry(argv[i]) == MagickFalse)
766 ThrowConvertInvalidArgumentException(option,argv[i]);
769 if (LocaleCompare("blue-shift",option+1) == 0)
774 if (i == (ssize_t) (argc-1))
775 ThrowConvertException(OptionError,"MissingArgument",option);
776 if (IsGeometry(argv[i]) == MagickFalse)
777 ThrowConvertInvalidArgumentException(option,argv[i]);
780 if (LocaleCompare("blur",option+1) == 0)
785 if (i == (ssize_t) (argc-1))
786 ThrowConvertException(OptionError,"MissingArgument",option);
787 if (IsGeometry(argv[i]) == MagickFalse)
788 ThrowConvertInvalidArgumentException(option,argv[i]);
791 if (LocaleCompare("border",option+1) == 0)
796 if (i == (ssize_t) (argc-1))
797 ThrowConvertException(OptionError,"MissingArgument",option);
798 if (IsGeometry(argv[i]) == MagickFalse)
799 ThrowConvertInvalidArgumentException(option,argv[i]);
802 if (LocaleCompare("bordercolor",option+1) == 0)
807 if (i == (ssize_t) (argc-1))
808 ThrowConvertException(OptionError,"MissingArgument",option);
811 if (LocaleCompare("box",option+1) == 0)
816 if (i == (ssize_t) (argc-1))
817 ThrowConvertException(OptionError,"MissingArgument",option);
820 if (LocaleCompare("brightness-contrast",option+1) == 0)
823 if (i == (ssize_t) (argc-1))
824 ThrowConvertException(OptionError,"MissingArgument",option);
825 if (IsGeometry(argv[i]) == MagickFalse)
826 ThrowConvertInvalidArgumentException(option,argv[i]);
829 ThrowConvertException(OptionError,"UnrecognizedOption",option)
833 if (LocaleCompare("cache",option+1) == 0)
838 if (i == (ssize_t) (argc-1))
839 ThrowConvertException(OptionError,"MissingArgument",option);
840 if (IsGeometry(argv[i]) == MagickFalse)
841 ThrowConvertInvalidArgumentException(option,argv[i]);
844 if (LocaleCompare("caption",option+1) == 0)
849 if (i == (ssize_t) argc)
850 ThrowConvertException(OptionError,"MissingArgument",option);
853 if (LocaleCompare("cdl",option+1) == 0)
858 if (i == (ssize_t) (argc-1))
859 ThrowConvertException(OptionError,"MissingArgument",option);
862 if (LocaleCompare("channel",option+1) == 0)
870 if (i == (ssize_t) (argc-1))
871 ThrowConvertException(OptionError,"MissingArgument",option);
872 channel=ParseChannelOption(argv[i]);
874 ThrowConvertException(OptionError,"UnrecognizedChannelType",
878 if (LocaleCompare("charcoal",option+1) == 0)
883 if (i == (ssize_t) (argc-1))
884 ThrowConvertException(OptionError,"MissingArgument",option);
885 if (IsGeometry(argv[i]) == MagickFalse)
886 ThrowConvertInvalidArgumentException(option,argv[i]);
889 if (LocaleCompare("chop",option+1) == 0)
894 if (i == (ssize_t) (argc-1))
895 ThrowConvertException(OptionError,"MissingArgument",option);
896 if (IsGeometry(argv[i]) == MagickFalse)
897 ThrowConvertInvalidArgumentException(option,argv[i]);
900 if (LocaleCompare("clamp",option+1) == 0)
902 if (LocaleCompare("clip",option+1) == 0)
904 if (LocaleCompare("clip-mask",option+1) == 0)
909 if (i == (ssize_t) (argc-1))
910 ThrowConvertException(OptionError,"MissingArgument",option);
913 if (LocaleCompare("clip-path",option+1) == 0)
916 if (i == (ssize_t) (argc-1))
917 ThrowConvertException(OptionError,"MissingArgument",option);
920 if (LocaleCompare("clone",option+1) == 0)
927 clone_images=image_stack[k-1].image;
928 if (clone_images == (Image *) NULL)
929 ThrowConvertException(ImageError,"ImageSequenceRequired",option);
930 FireImageStack(MagickTrue,MagickTrue,MagickTrue);
932 clone_images=CloneImages(clone_images,"-1",exception);
936 if (i == (ssize_t) (argc-1))
937 ThrowConvertException(OptionError,"MissingArgument",option);
938 if (IsSceneGeometry(argv[i],MagickFalse) == MagickFalse)
939 ThrowConvertInvalidArgumentException(option,argv[i]);
940 clone_images=CloneImages(clone_images,argv[i],exception);
942 if (clone_images == (Image *) NULL)
943 ThrowConvertException(OptionError,"NoSuchImage",option);
944 AppendImageStack(clone_images);
947 if (LocaleCompare("clut",option+1) == 0)
949 if (LocaleCompare("coalesce",option+1) == 0)
951 if (LocaleCompare("colorize",option+1) == 0)
956 if (i == (ssize_t) (argc-1))
957 ThrowConvertException(OptionError,"MissingArgument",option);
958 if (IsGeometry(argv[i]) == MagickFalse)
959 ThrowConvertInvalidArgumentException(option,argv[i]);
962 if (LocaleCompare("color-matrix",option+1) == 0)
970 if (i == (ssize_t) (argc-1))
971 ThrowConvertException(OptionError,"MissingArgument",option);
972 kernel_info=AcquireKernelInfo(argv[i]);
973 if (kernel_info == (KernelInfo *) NULL)
974 ThrowConvertInvalidArgumentException(option,argv[i]);
975 kernel_info=DestroyKernelInfo(kernel_info);
978 if (LocaleCompare("colors",option+1) == 0)
983 if ((i == (ssize_t) (argc-1)) ||
984 (IsGeometry(argv[i]) == MagickFalse))
985 ThrowConvertException(OptionError,"MissingArgument",option);
988 if (LocaleCompare("colorspace",option+1) == 0)
996 if (i == (ssize_t) (argc-1))
997 ThrowConvertException(OptionError,"MissingArgument",option);
998 colorspace=ParseCommandOption(MagickColorspaceOptions,
999 MagickFalse,argv[i]);
1001 ThrowConvertException(OptionError,"UnrecognizedColorspace",
1005 if (LocaleCompare("combine",option+1) == 0)
1007 if (LocaleCompare("comment",option+1) == 0)
1012 if (i == (ssize_t) argc)
1013 ThrowConvertException(OptionError,"MissingArgument",option);
1016 if (LocaleCompare("compose",option+1) == 0)
1024 if (i == (ssize_t) argc)
1025 ThrowConvertException(OptionError,"MissingArgument",option);
1026 compose=ParseCommandOption(MagickComposeOptions,MagickFalse,
1029 ThrowConvertException(OptionError,"UnrecognizedComposeOperator",
1033 if (LocaleCompare("composite",option+1) == 0)
1035 if (LocaleCompare("compress",option+1) == 0)
1043 if (i == (ssize_t) (argc-1))
1044 ThrowConvertException(OptionError,"MissingArgument",option);
1045 compress=ParseCommandOption(MagickCompressOptions,MagickFalse,
1048 ThrowConvertException(OptionError,"UnrecognizedImageCompression",
1052 if (LocaleCompare("concurrent",option+1) == 0)
1054 if (LocaleCompare("contrast",option+1) == 0)
1056 if (LocaleCompare("contrast-stretch",option+1) == 0)
1059 if (i == (ssize_t) (argc-1))
1060 ThrowConvertException(OptionError,"MissingArgument",option);
1061 if (IsGeometry(argv[i]) == MagickFalse)
1062 ThrowConvertInvalidArgumentException(option,argv[i]);
1065 if (LocaleCompare("convolve",option+1) == 0)
1073 if (i == (ssize_t) (argc-1))
1074 ThrowConvertException(OptionError,"MissingArgument",option);
1075 kernel_info=AcquireKernelInfo(argv[i]);
1076 if (kernel_info == (KernelInfo *) NULL)
1077 ThrowConvertInvalidArgumentException(option,argv[i]);
1078 kernel_info=DestroyKernelInfo(kernel_info);
1081 if (LocaleCompare("crop",option+1) == 0)
1086 if (i == (ssize_t) (argc-1))
1087 ThrowConvertException(OptionError,"MissingArgument",option);
1088 if (IsGeometry(argv[i]) == MagickFalse)
1089 ThrowConvertInvalidArgumentException(option,argv[i]);
1092 if (LocaleCompare("cycle",option+1) == 0)
1097 if (i == (ssize_t) (argc-1))
1098 ThrowConvertException(OptionError,"MissingArgument",option);
1099 if (IsGeometry(argv[i]) == MagickFalse)
1100 ThrowConvertInvalidArgumentException(option,argv[i]);
1103 ThrowConvertException(OptionError,"UnrecognizedOption",option)
1107 if (LocaleCompare("decipher",option+1) == 0)
1112 if (i == (ssize_t) (argc-1))
1113 ThrowConvertException(OptionError,"MissingArgument",option);
1116 if (LocaleCompare("deconstruct",option+1) == 0)
1118 if (LocaleCompare("debug",option+1) == 0)
1126 if (i == (ssize_t) argc)
1127 ThrowConvertException(OptionError,"MissingArgument",option);
1128 event=ParseCommandOption(MagickLogEventOptions,MagickFalse,argv[i]);
1130 ThrowConvertException(OptionError,"UnrecognizedEventType",
1132 (void) SetLogEventMask(argv[i]);
1135 if (LocaleCompare("define",option+1) == 0)
1138 if (i == (ssize_t) argc)
1139 ThrowConvertException(OptionError,"MissingArgument",option);
1145 define=GetImageOption(image_info,argv[i]);
1146 if (define == (const char *) NULL)
1147 ThrowConvertException(OptionError,"NoSuchOption",argv[i]);
1152 if (LocaleCompare("delay",option+1) == 0)
1157 if (i == (ssize_t) argc)
1158 ThrowConvertException(OptionError,"MissingArgument",option);
1159 if (IsGeometry(argv[i]) == MagickFalse)
1160 ThrowConvertInvalidArgumentException(option,argv[i]);
1163 if (LocaleCompare("density",option+1) == 0)
1168 if (i == (ssize_t) (argc-1))
1169 ThrowConvertException(OptionError,"MissingArgument",option);
1170 if (IsGeometry(argv[i]) == MagickFalse)
1171 ThrowConvertInvalidArgumentException(option,argv[i]);
1174 if (LocaleCompare("depth",option+1) == 0)
1179 if (i == (ssize_t) (argc-1))
1180 ThrowConvertException(OptionError,"MissingArgument",option);
1181 if (IsGeometry(argv[i]) == MagickFalse)
1182 ThrowConvertInvalidArgumentException(option,argv[i]);
1185 if (LocaleCompare("delete",option+1) == 0)
1190 if (i == (ssize_t) (argc-1))
1191 ThrowConvertException(OptionError,"MissingArgument",option);
1192 if (IsSceneGeometry(argv[i],MagickFalse) == MagickFalse)
1193 ThrowConvertInvalidArgumentException(option,argv[i]);
1196 if (LocaleCompare("deskew",option+1) == 0)
1201 if (i == (ssize_t) (argc-1))
1202 ThrowConvertException(OptionError,"MissingArgument",option);
1203 if (IsGeometry(argv[i]) == MagickFalse)
1204 ThrowConvertInvalidArgumentException(option,argv[i]);
1207 if (LocaleCompare("despeckle",option+1) == 0)
1209 if (LocaleCompare("direction",option+1) == 0)
1217 if (i == (ssize_t) argc)
1218 ThrowConvertException(OptionError,"MissingArgument",option);
1219 direction=ParseCommandOption(MagickDirectionOptions,MagickFalse,
1222 ThrowConvertException(OptionError,"UnrecognizedDirectionType",
1226 if (LocaleCompare("display",option+1) == 0)
1231 if (i == (ssize_t) (argc-1))
1232 ThrowConvertException(OptionError,"MissingArgument",option);
1235 if (LocaleCompare("dispose",option+1) == 0)
1243 if (i == (ssize_t) argc)
1244 ThrowConvertException(OptionError,"MissingArgument",option);
1245 dispose=ParseCommandOption(MagickDisposeOptions,MagickFalse,argv[i]);
1247 ThrowConvertException(OptionError,"UnrecognizedDisposeMethod",
1251 if (LocaleCompare("distort",option+1) == 0)
1257 if (i == (ssize_t) argc)
1258 ThrowConvertException(OptionError,"MissingArgument",option);
1259 op=ParseCommandOption(MagickDistortOptions,MagickFalse,argv[i]);
1261 ThrowConvertException(OptionError,"UnrecognizedDistortMethod",
1264 if (i == (ssize_t) (argc-1))
1265 ThrowConvertException(OptionError,"MissingArgument",option);
1268 if (LocaleCompare("dither",option+1) == 0)
1276 if (i == (ssize_t) argc)
1277 ThrowConvertException(OptionError,"MissingArgument",option);
1278 method=ParseCommandOption(MagickDitherOptions,MagickFalse,argv[i]);
1280 ThrowConvertException(OptionError,"UnrecognizedDitherMethod",
1284 if (LocaleCompare("draw",option+1) == 0)
1289 if (i == (ssize_t) (argc-1))
1290 ThrowConvertException(OptionError,"MissingArgument",option);
1293 if (LocaleCompare("duplicate",option+1) == 0)
1298 if (i == (ssize_t) (argc-1))
1299 ThrowConvertException(OptionError,"MissingArgument",option);
1300 if (IsGeometry(argv[i]) == MagickFalse)
1301 ThrowConvertInvalidArgumentException(option,argv[i]);
1304 if (LocaleCompare("duration",option+1) == 0)
1309 if (i == (ssize_t) (argc-1))
1310 ThrowConvertException(OptionError,"MissingArgument",option);
1311 if (IsGeometry(argv[i]) == MagickFalse)
1312 ThrowConvertInvalidArgumentException(option,argv[i]);
1315 ThrowConvertException(OptionError,"UnrecognizedOption",option)
1319 if (LocaleCompare("edge",option+1) == 0)
1324 if (i == (ssize_t) (argc-1))
1325 ThrowConvertException(OptionError,"MissingArgument",option);
1326 if (IsGeometry(argv[i]) == MagickFalse)
1327 ThrowConvertInvalidArgumentException(option,argv[i]);
1330 if (LocaleCompare("emboss",option+1) == 0)
1335 if (i == (ssize_t) (argc-1))
1336 ThrowConvertException(OptionError,"MissingArgument",option);
1337 if (IsGeometry(argv[i]) == MagickFalse)
1338 ThrowConvertInvalidArgumentException(option,argv[i]);
1341 if (LocaleCompare("encipher",option+1) == 0)
1346 if (i == (ssize_t) (argc-1))
1347 ThrowConvertException(OptionError,"MissingArgument",option);
1350 if (LocaleCompare("encoding",option+1) == 0)
1355 if (i == (ssize_t) (argc-1))
1356 ThrowConvertException(OptionError,"MissingArgument",option);
1359 if (LocaleCompare("endian",option+1) == 0)
1367 if (i == (ssize_t) (argc-1))
1368 ThrowConvertException(OptionError,"MissingArgument",option);
1369 endian=ParseCommandOption(MagickEndianOptions,MagickFalse,
1372 ThrowConvertException(OptionError,"UnrecognizedEndianType",
1376 if (LocaleCompare("enhance",option+1) == 0)
1378 if (LocaleCompare("equalize",option+1) == 0)
1380 if (LocaleCompare("evaluate",option+1) == 0)
1388 if (i == (ssize_t) argc)
1389 ThrowConvertException(OptionError,"MissingArgument",option);
1390 op=ParseCommandOption(MagickEvaluateOptions,MagickFalse,argv[i]);
1392 ThrowConvertException(OptionError,"UnrecognizedEvaluateOperator",
1395 if (i == (ssize_t) (argc-1))
1396 ThrowConvertException(OptionError,"MissingArgument",option);
1397 if (IsGeometry(argv[i]) == MagickFalse)
1398 ThrowConvertInvalidArgumentException(option,argv[i]);
1401 if (LocaleCompare("evaluate-sequence",option+1) == 0)
1409 if (i == (ssize_t) argc)
1410 ThrowConvertException(OptionError,"MissingArgument",option);
1411 op=ParseCommandOption(MagickEvaluateOptions,MagickFalse,argv[i]);
1413 ThrowConvertException(OptionError,"UnrecognizedEvaluateOperator",
1417 if (LocaleCompare("extent",option+1) == 0)
1422 if (i == (ssize_t) (argc-1))
1423 ThrowConvertException(OptionError,"MissingArgument",option);
1424 if (IsGeometry(argv[i]) == MagickFalse)
1425 ThrowConvertInvalidArgumentException(option,argv[i]);
1428 if (LocaleCompare("extract",option+1) == 0)
1433 if (i == (ssize_t) (argc-1))
1434 ThrowConvertException(OptionError,"MissingArgument",option);
1435 if (IsGeometry(argv[i]) == MagickFalse)
1436 ThrowConvertInvalidArgumentException(option,argv[i]);
1439 ThrowConvertException(OptionError,"UnrecognizedOption",option)
1443 if (LocaleCompare("family",option+1) == 0)
1448 if (i == (ssize_t) (argc-1))
1449 ThrowConvertException(OptionError,"MissingArgument",option);
1452 if (LocaleCompare("fft",option+1) == 0)
1454 if (LocaleCompare("fill",option+1) == 0)
1459 if (i == (ssize_t) (argc-1))
1460 ThrowConvertException(OptionError,"MissingArgument",option);
1463 if (LocaleCompare("filter",option+1) == 0)
1471 if (i == (ssize_t) (argc-1))
1472 ThrowConvertException(OptionError,"MissingArgument",option);
1473 filter=ParseCommandOption(MagickFilterOptions,MagickFalse,argv[i]);
1475 ThrowConvertException(OptionError,"UnrecognizedImageFilter",
1479 if (LocaleCompare("flatten",option+1) == 0)
1481 if (LocaleCompare("flip",option+1) == 0)
1483 if (LocaleCompare("flop",option+1) == 0)
1485 if (LocaleCompare("floodfill",option+1) == 0)
1490 if (i == (ssize_t) (argc-1))
1491 ThrowConvertException(OptionError,"MissingArgument",option);
1492 if (IsGeometry(argv[i]) == MagickFalse)
1493 ThrowConvertInvalidArgumentException(option,argv[i]);
1495 if (i == (ssize_t) (argc-1))
1496 ThrowConvertException(OptionError,"MissingArgument",option);
1499 if (LocaleCompare("font",option+1) == 0)
1504 if (i == (ssize_t) (argc-1))
1505 ThrowConvertException(OptionError,"MissingArgument",option);
1508 if (LocaleCompare("format",option+1) == 0)
1513 if (i == (ssize_t) (argc-1))
1514 ThrowConvertException(OptionError,"MissingArgument",option);
1518 if (LocaleCompare("frame",option+1) == 0)
1523 if (i == (ssize_t) (argc-1))
1524 ThrowConvertException(OptionError,"MissingArgument",option);
1525 if (IsGeometry(argv[i]) == MagickFalse)
1526 ThrowConvertInvalidArgumentException(option,argv[i]);
1529 if (LocaleCompare("function",option+1) == 0)
1537 if (i == (ssize_t) argc)
1538 ThrowConvertException(OptionError,"MissingArgument",option);
1539 op=ParseCommandOption(MagickFunctionOptions,MagickFalse,argv[i]);
1541 ThrowConvertException(OptionError,"UnrecognizedFunction",argv[i]);
1543 if (i == (ssize_t) (argc-1))
1544 ThrowConvertException(OptionError,"MissingArgument",option);
1547 if (LocaleCompare("fuzz",option+1) == 0)
1552 if (i == (ssize_t) (argc-1))
1553 ThrowConvertException(OptionError,"MissingArgument",option);
1554 if (IsGeometry(argv[i]) == MagickFalse)
1555 ThrowConvertInvalidArgumentException(option,argv[i]);
1558 if (LocaleCompare("fx",option+1) == 0)
1563 if (i == (ssize_t) (argc-1))
1564 ThrowConvertException(OptionError,"MissingArgument",option);
1567 ThrowConvertException(OptionError,"UnrecognizedOption",option)
1571 if (LocaleCompare("gamma",option+1) == 0)
1574 if (i == (ssize_t) (argc-1))
1575 ThrowConvertException(OptionError,"MissingArgument",option);
1576 if (IsGeometry(argv[i]) == MagickFalse)
1577 ThrowConvertInvalidArgumentException(option,argv[i]);
1580 if ((LocaleCompare("gaussian-blur",option+1) == 0) ||
1581 (LocaleCompare("gaussian",option+1) == 0))
1584 if (i == (ssize_t) (argc-1))
1585 ThrowConvertException(OptionError,"MissingArgument",option);
1586 if (IsGeometry(argv[i]) == MagickFalse)
1587 ThrowConvertInvalidArgumentException(option,argv[i]);
1590 if (LocaleCompare("geometry",option+1) == 0)
1595 if (i == (ssize_t) (argc-1))
1596 ThrowConvertException(OptionError,"MissingArgument",option);
1597 if (IsGeometry(argv[i]) == MagickFalse)
1598 ThrowConvertInvalidArgumentException(option,argv[i]);
1601 if (LocaleCompare("gravity",option+1) == 0)
1609 if (i == (ssize_t) (argc-1))
1610 ThrowConvertException(OptionError,"MissingArgument",option);
1611 gravity=ParseCommandOption(MagickGravityOptions,MagickFalse,
1614 ThrowConvertException(OptionError,"UnrecognizedGravityType",
1618 if (LocaleCompare("green-primary",option+1) == 0)
1623 if (i == (ssize_t) (argc-1))
1624 ThrowConvertException(OptionError,"MissingArgument",option);
1625 if (IsGeometry(argv[i]) == MagickFalse)
1626 ThrowConvertInvalidArgumentException(option,argv[i]);
1629 ThrowConvertException(OptionError,"UnrecognizedOption",option)
1633 if (LocaleCompare("hald-clut",option+1) == 0)
1635 if ((LocaleCompare("help",option+1) == 0) ||
1636 (LocaleCompare("-help",option+1) == 0))
1637 return(ConvertUsage());
1638 ThrowConvertException(OptionError,"UnrecognizedOption",option)
1642 if (LocaleCompare("identify",option+1) == 0)
1644 if (LocaleCompare("ift",option+1) == 0)
1646 if (LocaleCompare("implode",option+1) == 0)
1651 if (i == (ssize_t) (argc-1))
1652 ThrowConvertException(OptionError,"MissingArgument",option);
1653 if (IsGeometry(argv[i]) == MagickFalse)
1654 ThrowConvertInvalidArgumentException(option,argv[i]);
1657 if (LocaleCompare("insert",option+1) == 0)
1662 if (i == (ssize_t) (argc-1))
1663 ThrowConvertException(OptionError,"MissingArgument",option);
1664 if (IsGeometry(argv[i]) == MagickFalse)
1665 ThrowConvertInvalidArgumentException(option,argv[i]);
1668 if (LocaleCompare("intent",option+1) == 0)
1676 if (i == (ssize_t) (argc-1))
1677 ThrowConvertException(OptionError,"MissingArgument",option);
1678 intent=ParseCommandOption(MagickIntentOptions,MagickFalse,
1681 ThrowConvertException(OptionError,"UnrecognizedIntentType",
1685 if (LocaleCompare("interlace",option+1) == 0)
1693 if (i == (ssize_t) (argc-1))
1694 ThrowConvertException(OptionError,"MissingArgument",option);
1695 interlace=ParseCommandOption(MagickInterlaceOptions,MagickFalse,
1698 ThrowConvertException(OptionError,"UnrecognizedInterlaceType",
1702 if (LocaleCompare("interline-spacing",option+1) == 0)
1707 if (i == (ssize_t) (argc-1))
1708 ThrowConvertException(OptionError,"MissingArgument",option);
1709 if (IsGeometry(argv[i]) == MagickFalse)
1710 ThrowConvertInvalidArgumentException(option,argv[i]);
1713 if (LocaleCompare("interpolate",option+1) == 0)
1721 if (i == (ssize_t) argc)
1722 ThrowConvertException(OptionError,"MissingArgument",option);
1723 interpolate=ParseCommandOption(MagickInterpolateOptions,MagickFalse,
1725 if (interpolate < 0)
1726 ThrowConvertException(OptionError,"UnrecognizedInterpolateMethod",
1730 if (LocaleCompare("interword-spacing",option+1) == 0)
1735 if (i == (ssize_t) (argc-1))
1736 ThrowConvertException(OptionError,"MissingArgument",option);
1737 if (IsGeometry(argv[i]) == MagickFalse)
1738 ThrowConvertInvalidArgumentException(option,argv[i]);
1741 ThrowConvertException(OptionError,"UnrecognizedOption",option)
1745 if (LocaleCompare("kerning",option+1) == 0)
1750 if (i == (ssize_t) (argc-1))
1751 ThrowConvertException(OptionError,"MissingArgument",option);
1752 if (IsGeometry(argv[i]) == MagickFalse)
1753 ThrowConvertInvalidArgumentException(option,argv[i]);
1756 ThrowConvertException(OptionError,"UnrecognizedOption",option)
1760 if (LocaleCompare("label",option+1) == 0)
1765 if (i == (ssize_t) argc)
1766 ThrowConvertException(OptionError,"MissingArgument",option);
1769 if (LocaleCompare("lat",option+1) == 0)
1774 if (i == (ssize_t) (argc-1))
1775 ThrowConvertException(OptionError,"MissingArgument",option);
1776 if (IsGeometry(argv[i]) == MagickFalse)
1777 ThrowConvertInvalidArgumentException(option,argv[i]);
1780 if (LocaleCompare("layers",option+1) == 0)
1788 if (i == (ssize_t) (argc-1))
1789 ThrowConvertException(OptionError,"MissingArgument",option);
1790 type=ParseCommandOption(MagickLayerOptions,MagickFalse,argv[i]);
1792 ThrowConvertException(OptionError,"UnrecognizedLayerMethod",
1796 if (LocaleCompare("level",option+1) == 0)
1799 if (i == (ssize_t) (argc-1))
1800 ThrowConvertException(OptionError,"MissingArgument",option);
1801 if (IsGeometry(argv[i]) == MagickFalse)
1802 ThrowConvertInvalidArgumentException(option,argv[i]);
1805 if (LocaleCompare("level-colors",option+1) == 0)
1808 if (i == (ssize_t) (argc-1))
1809 ThrowConvertException(OptionError,"MissingArgument",option);
1812 if (LocaleCompare("linewidth",option+1) == 0)
1817 if (i == (ssize_t) (argc-1))
1818 ThrowConvertException(OptionError,"MissingArgument",option);
1819 if (IsGeometry(argv[i]) == MagickFalse)
1820 ThrowConvertInvalidArgumentException(option,argv[i]);
1823 if (LocaleCompare("liquid-rescale",option+1) == 0)
1826 if (i == (ssize_t) (argc-1))
1827 ThrowConvertException(OptionError,"MissingArgument",option);
1828 if (IsGeometry(argv[i]) == MagickFalse)
1829 ThrowConvertInvalidArgumentException(option,argv[i]);
1832 if (LocaleCompare("limit",option+1) == 0)
1846 if (i == (ssize_t) argc)
1847 ThrowConvertException(OptionError,"MissingArgument",option);
1848 resource=ParseCommandOption(MagickResourceOptions,MagickFalse,
1851 ThrowConvertException(OptionError,"UnrecognizedResourceType",
1854 if (i == (ssize_t) argc)
1855 ThrowConvertException(OptionError,"MissingArgument",option);
1856 value=StringToDouble(argv[i],&p);
1858 if ((p == argv[i]) && (LocaleCompare("unlimited",argv[i]) != 0))
1859 ThrowConvertInvalidArgumentException(option,argv[i]);
1862 if (LocaleCompare("linear-stretch",option+1) == 0)
1865 if (i == (ssize_t) (argc-1))
1866 ThrowConvertException(OptionError,"MissingArgument",option);
1867 if (IsGeometry(argv[i]) == MagickFalse)
1868 ThrowConvertInvalidArgumentException(option,argv[i]);
1871 if (LocaleCompare("list",option+1) == 0)
1879 if (i == (ssize_t) argc)
1880 ThrowConvertException(OptionError,"MissingArgument",option);
1881 list=ParseCommandOption(MagickListOptions,MagickFalse,argv[i]);
1883 ThrowConvertException(OptionError,"UnrecognizedListType",argv[i]);
1884 status=MogrifyImageInfo(image_info,(int) (i-j+1),(const char **)
1887 return(status != 0 ? MagickFalse : MagickTrue);
1889 if (LocaleCompare("log",option+1) == 0)
1894 if ((i == (ssize_t) argc) ||
1895 (strchr(argv[i],'%') == (char *) NULL))
1896 ThrowConvertException(OptionError,"MissingArgument",option);
1899 if (LocaleCompare("loop",option+1) == 0)
1904 if (i == (ssize_t) (argc-1))
1905 ThrowConvertException(OptionError,"MissingArgument",option);
1906 if (IsGeometry(argv[i]) == MagickFalse)
1907 ThrowConvertInvalidArgumentException(option,argv[i]);
1910 ThrowConvertException(OptionError,"UnrecognizedOption",option)
1914 if (LocaleCompare("map",option+1) == 0)
1919 if (i == (ssize_t) (argc-1))
1920 ThrowConvertException(OptionError,"MissingArgument",option);
1923 if (LocaleCompare("mask",option+1) == 0)
1928 if (i == (ssize_t) (argc-1))
1929 ThrowConvertException(OptionError,"MissingArgument",option);
1932 if (LocaleCompare("matte",option+1) == 0)
1934 if (LocaleCompare("mattecolor",option+1) == 0)
1939 if (i == (ssize_t) (argc-1))
1940 ThrowConvertException(OptionError,"MissingArgument",option);
1943 if (LocaleCompare("maximum",option+1) == 0)
1945 if (LocaleCompare("median",option+1) == 0)
1950 if (i == (ssize_t) (argc-1))
1951 ThrowConvertException(OptionError,"MissingArgument",option);
1952 if (IsGeometry(argv[i]) == MagickFalse)
1953 ThrowConvertInvalidArgumentException(option,argv[i]);
1956 if (LocaleCompare("minimum",option+1) == 0)
1958 if (LocaleCompare("mode",option+1) == 0)
1963 if (i == (ssize_t) (argc-1))
1964 ThrowConvertException(OptionError,"MissingArgument",option);
1965 if (IsGeometry(argv[i]) == MagickFalse)
1966 ThrowConvertInvalidArgumentException(option,argv[i]);
1969 if (LocaleCompare("modulate",option+1) == 0)
1974 if (i == (ssize_t) (argc-1))
1975 ThrowConvertException(OptionError,"MissingArgument",option);
1976 if (IsGeometry(argv[i]) == MagickFalse)
1977 ThrowConvertInvalidArgumentException(option,argv[i]);
1980 if (LocaleCompare("monitor",option+1) == 0)
1982 if (LocaleCompare("monochrome",option+1) == 0)
1984 if (LocaleCompare("morph",option+1) == 0)
1989 if (i == (ssize_t) (argc-1))
1990 ThrowConvertException(OptionError,"MissingArgument",option);
1991 if (IsGeometry(argv[i]) == MagickFalse)
1992 ThrowConvertInvalidArgumentException(option,argv[i]);
1995 if (LocaleCompare("morphology",option+1) == 0)
1998 token[MaxTextExtent];
2007 if (i == (ssize_t) argc)
2008 ThrowConvertException(OptionError,"MissingArgument",option);
2009 GetMagickToken(argv[i],NULL,token);
2010 op=ParseCommandOption(MagickMorphologyOptions,MagickFalse,token);
2012 ThrowConvertException(OptionError,"UnrecognizedMorphologyMethod",
2015 if (i == (ssize_t) (argc-1))
2016 ThrowConvertException(OptionError,"MissingArgument",option);
2017 kernel_info=AcquireKernelInfo(argv[i]);
2018 if (kernel_info == (KernelInfo *) NULL)
2019 ThrowConvertInvalidArgumentException(option,argv[i]);
2020 kernel_info=DestroyKernelInfo(kernel_info);
2023 if (LocaleCompare("mosaic",option+1) == 0)
2025 if (LocaleCompare("motion-blur",option+1) == 0)
2030 if (i == (ssize_t) (argc-1))
2031 ThrowConvertException(OptionError,"MissingArgument",option);
2032 if (IsGeometry(argv[i]) == MagickFalse)
2033 ThrowConvertInvalidArgumentException(option,argv[i]);
2036 ThrowConvertException(OptionError,"UnrecognizedOption",option)
2040 if (LocaleCompare("negate",option+1) == 0)
2042 if (LocaleCompare("noise",option+1) == 0)
2045 if (i == (ssize_t) (argc-1))
2046 ThrowConvertException(OptionError,"MissingArgument",option);
2052 noise=ParseCommandOption(MagickNoiseOptions,MagickFalse,argv[i]);
2054 ThrowConvertException(OptionError,"UnrecognizedNoiseType",
2058 if (IsGeometry(argv[i]) == MagickFalse)
2059 ThrowConvertInvalidArgumentException(option,argv[i]);
2062 if (LocaleCompare("noop",option+1) == 0)
2064 if (LocaleCompare("normalize",option+1) == 0)
2066 ThrowConvertException(OptionError,"UnrecognizedOption",option)
2070 if (LocaleCompare("opaque",option+1) == 0)
2073 if (i == (ssize_t) (argc-1))
2074 ThrowConvertException(OptionError,"MissingArgument",option);
2077 if (LocaleCompare("ordered-dither",option+1) == 0)
2082 if (i == (ssize_t) (argc-1))
2083 ThrowConvertException(OptionError,"MissingArgument",option);
2086 if (LocaleCompare("orient",option+1) == 0)
2094 if (i == (ssize_t) (argc-1))
2095 ThrowConvertException(OptionError,"MissingArgument",option);
2096 orientation=ParseCommandOption(MagickOrientationOptions,
2097 MagickFalse,argv[i]);
2098 if (orientation < 0)
2099 ThrowConvertException(OptionError,"UnrecognizedImageOrientation",
2103 ThrowConvertException(OptionError,"UnrecognizedOption",argv[i])
2107 if (LocaleCompare("page",option+1) == 0)
2112 if (i == (ssize_t) argc)
2113 ThrowConvertException(OptionError,"MissingArgument",option);
2116 if (LocaleCompare("paint",option+1) == 0)
2121 if (i == (ssize_t) (argc-1))
2122 ThrowConvertException(OptionError,"MissingArgument",option);
2123 if (IsGeometry(argv[i]) == MagickFalse)
2124 ThrowConvertInvalidArgumentException(option,argv[i]);
2127 if (LocaleCompare("ping",option+1) == 0)
2129 if (LocaleCompare("pointsize",option+1) == 0)
2134 if (i == (ssize_t) (argc-1))
2135 ThrowConvertException(OptionError,"MissingArgument",option);
2136 if (IsGeometry(argv[i]) == MagickFalse)
2137 ThrowConvertInvalidArgumentException(option,argv[i]);
2140 if (LocaleCompare("polaroid",option+1) == 0)
2145 if (i == (ssize_t) (argc-1))
2146 ThrowConvertException(OptionError,"MissingArgument",option);
2147 if (IsGeometry(argv[i]) == MagickFalse)
2148 ThrowConvertInvalidArgumentException(option,argv[i]);
2151 if (LocaleCompare("posterize",option+1) == 0)
2156 if (i == (ssize_t) (argc-1))
2157 ThrowConvertException(OptionError,"MissingArgument",option);
2158 if (IsGeometry(argv[i]) == MagickFalse)
2159 ThrowConvertInvalidArgumentException(option,argv[i]);
2162 if (LocaleCompare("precision",option+1) == 0)
2167 if (i == (ssize_t) (argc-1))
2168 ThrowConvertException(OptionError,"MissingArgument",option);
2169 if (IsGeometry(argv[i]) == MagickFalse)
2170 ThrowConvertInvalidArgumentException(option,argv[i]);
2173 if (LocaleCompare("preview",option+1) == 0)
2181 if (i == (ssize_t) (argc-1))
2182 ThrowConvertException(OptionError,"MissingArgument",option);
2183 preview=ParseCommandOption(MagickPreviewOptions,MagickFalse,
2186 ThrowConvertException(OptionError,"UnrecognizedPreviewType",
2190 if (LocaleCompare("print",option+1) == 0)
2195 if (i == (ssize_t) (argc-1))
2196 ThrowConvertException(OptionError,"MissingArgument",option);
2199 if (LocaleCompare("process",option+1) == 0)
2204 if (i == (ssize_t) (argc-1))
2205 ThrowConvertException(OptionError,"MissingArgument",option);
2208 if (LocaleCompare("profile",option+1) == 0)
2211 if (i == (ssize_t) (argc-1))
2212 ThrowConvertException(OptionError,"MissingArgument",option);
2215 ThrowConvertException(OptionError,"UnrecognizedOption",option)
2219 if (LocaleCompare("quality",option+1) == 0)
2224 if (i == (ssize_t) (argc-1))
2225 ThrowConvertException(OptionError,"MissingArgument",option);
2226 if (IsGeometry(argv[i]) == MagickFalse)
2227 ThrowConvertInvalidArgumentException(option,argv[i]);
2230 if (LocaleCompare("quantize",option+1) == 0)
2238 if (i == (ssize_t) (argc-1))
2239 ThrowConvertException(OptionError,"MissingArgument",option);
2240 colorspace=ParseCommandOption(MagickColorspaceOptions,
2241 MagickFalse,argv[i]);
2243 ThrowConvertException(OptionError,"UnrecognizedColorspace",
2247 if (LocaleCompare("quiet",option+1) == 0)
2249 ThrowConvertException(OptionError,"UnrecognizedOption",option)
2253 if (LocaleCompare("radial-blur",option+1) == 0)
2256 if (i == (ssize_t) (argc-1))
2257 ThrowConvertException(OptionError,"MissingArgument",option);
2258 if (IsGeometry(argv[i]) == MagickFalse)
2259 ThrowConvertInvalidArgumentException(option,argv[i]);
2262 if (LocaleCompare("raise",option+1) == 0)
2265 if (i == (ssize_t) (argc-1))
2266 ThrowConvertException(OptionError,"MissingArgument",option);
2267 if (IsGeometry(argv[i]) == MagickFalse)
2268 ThrowConvertInvalidArgumentException(option,argv[i]);
2271 if (LocaleCompare("random-threshold",option+1) == 0)
2276 if (i == (ssize_t) (argc-1))
2277 ThrowConvertException(OptionError,"MissingArgument",option);
2278 if (IsGeometry(argv[i]) == MagickFalse)
2279 ThrowConvertInvalidArgumentException(option,argv[i]);
2282 if (LocaleCompare("recolor",option+1) == 0)
2287 if (i == (ssize_t) (argc-1))
2288 ThrowConvertException(OptionError,"MissingArgument",option);
2289 if (IsGeometry(argv[i]) == MagickFalse)
2290 ThrowConvertInvalidArgumentException(option,argv[i]);
2293 if (LocaleCompare("red-primary",option+1) == 0)
2298 if (i == (ssize_t) (argc-1))
2299 ThrowConvertException(OptionError,"MissingArgument",option);
2300 if (IsGeometry(argv[i]) == MagickFalse)
2301 ThrowConvertInvalidArgumentException(option,argv[i]);
2304 if (LocaleCompare("regard-warnings",option+1) == 0)
2306 if (LocaleCompare("region",option+1) == 0)
2311 if (i == (ssize_t) (argc-1))
2312 ThrowConvertException(OptionError,"MissingArgument",option);
2313 if (IsGeometry(argv[i]) == MagickFalse)
2314 ThrowConvertInvalidArgumentException(option,argv[i]);
2317 if (LocaleCompare("remap",option+1) == 0)
2322 if (i == (ssize_t) (argc-1))
2323 ThrowConvertException(OptionError,"MissingArgument",option);
2326 if (LocaleCompare("render",option+1) == 0)
2328 if (LocaleCompare("repage",option+1) == 0)
2333 if (i == (ssize_t) (argc-1))
2334 ThrowConvertException(OptionError,"MissingArgument",option);
2335 if (IsGeometry(argv[i]) == MagickFalse)
2336 ThrowConvertInvalidArgumentException(option,argv[i]);
2339 if (LocaleCompare("resample",option+1) == 0)
2344 if (i == (ssize_t) (argc-1))
2345 ThrowConvertException(OptionError,"MissingArgument",option);
2346 if (IsGeometry(argv[i]) == MagickFalse)
2347 ThrowConvertInvalidArgumentException(option,argv[i]);
2350 if (LocaleCompare("resize",option+1) == 0)
2355 if (i == (ssize_t) (argc-1))
2356 ThrowConvertException(OptionError,"MissingArgument",option);
2357 if (IsGeometry(argv[i]) == MagickFalse)
2358 ThrowConvertInvalidArgumentException(option,argv[i]);
2361 if (LocaleNCompare("respect-parentheses",option+1,17) == 0)
2363 respect_parenthesis=(*option == '-') ? MagickTrue : MagickFalse;
2366 if (LocaleCompare("reverse",option+1) == 0)
2368 if (LocaleCompare("roll",option+1) == 0)
2373 if (i == (ssize_t) (argc-1))
2374 ThrowConvertException(OptionError,"MissingArgument",option);
2375 if (IsGeometry(argv[i]) == MagickFalse)
2376 ThrowConvertInvalidArgumentException(option,argv[i]);
2379 if (LocaleCompare("rotate",option+1) == 0)
2382 if (i == (ssize_t) (argc-1))
2383 ThrowConvertException(OptionError,"MissingArgument",option);
2384 if (IsGeometry(argv[i]) == MagickFalse)
2385 ThrowConvertInvalidArgumentException(option,argv[i]);
2388 ThrowConvertException(OptionError,"UnrecognizedOption",option)
2392 if (LocaleCompare("sample",option+1) == 0)
2397 if (i == (ssize_t) (argc-1))
2398 ThrowConvertException(OptionError,"MissingArgument",option);
2399 if (IsGeometry(argv[i]) == MagickFalse)
2400 ThrowConvertInvalidArgumentException(option,argv[i]);
2403 if (LocaleCompare("sampling-factor",option+1) == 0)
2408 if (i == (ssize_t) (argc-1))
2409 ThrowConvertException(OptionError,"MissingArgument",option);
2410 if (IsGeometry(argv[i]) == MagickFalse)
2411 ThrowConvertInvalidArgumentException(option,argv[i]);
2414 if (LocaleCompare("scale",option+1) == 0)
2419 if (i == (ssize_t) (argc-1))
2420 ThrowConvertException(OptionError,"MissingArgument",option);
2421 if (IsGeometry(argv[i]) == MagickFalse)
2422 ThrowConvertInvalidArgumentException(option,argv[i]);
2425 if (LocaleCompare("scene",option+1) == 0)
2430 if (i == (ssize_t) (argc-1))
2431 ThrowConvertException(OptionError,"MissingArgument",option);
2432 if (IsGeometry(argv[i]) == MagickFalse)
2433 ThrowConvertInvalidArgumentException(option,argv[i]);
2436 if (LocaleCompare("seed",option+1) == 0)
2441 if (i == (ssize_t) (argc-1))
2442 ThrowConvertException(OptionError,"MissingArgument",option);
2443 if (IsGeometry(argv[i]) == MagickFalse)
2444 ThrowConvertInvalidArgumentException(option,argv[i]);
2447 if (LocaleCompare("segment",option+1) == 0)
2452 if (i == (ssize_t) (argc-1))
2453 ThrowConvertException(OptionError,"MissingArgument",option);
2454 if (IsGeometry(argv[i]) == MagickFalse)
2455 ThrowConvertInvalidArgumentException(option,argv[i]);
2458 if (LocaleCompare("selective-blur",option+1) == 0)
2461 if (i == (ssize_t) (argc-1))
2462 ThrowConvertException(OptionError,"MissingArgument",option);
2463 if (IsGeometry(argv[i]) == MagickFalse)
2464 ThrowConvertInvalidArgumentException(option,argv[i]);
2467 if (LocaleCompare("separate",option+1) == 0)
2469 if (LocaleCompare("sepia-tone",option+1) == 0)
2474 if (i == (ssize_t) (argc-1))
2475 ThrowConvertException(OptionError,"MissingArgument",option);
2476 if (IsGeometry(argv[i]) == MagickFalse)
2477 ThrowConvertInvalidArgumentException(option,argv[i]);
2480 if (LocaleCompare("set",option+1) == 0)
2483 if (i == (ssize_t) argc)
2484 ThrowConvertException(OptionError,"MissingArgument",option);
2488 if (i == (ssize_t) argc)
2489 ThrowConvertException(OptionError,"MissingArgument",option);
2492 if (LocaleCompare("shade",option+1) == 0)
2495 if (i == (ssize_t) (argc-1))
2496 ThrowConvertException(OptionError,"MissingArgument",option);
2497 if (IsGeometry(argv[i]) == MagickFalse)
2498 ThrowConvertInvalidArgumentException(option,argv[i]);
2501 if (LocaleCompare("shadow",option+1) == 0)
2506 if (i == (ssize_t) (argc-1))
2507 ThrowConvertException(OptionError,"MissingArgument",option);
2508 if (IsGeometry(argv[i]) == MagickFalse)
2509 ThrowConvertInvalidArgumentException(option,argv[i]);
2512 if (LocaleCompare("sharpen",option+1) == 0)
2515 if (i == (ssize_t) (argc-1))
2516 ThrowConvertException(OptionError,"MissingArgument",option);
2517 if (IsGeometry(argv[i]) == MagickFalse)
2518 ThrowConvertInvalidArgumentException(option,argv[i]);
2521 if (LocaleCompare("shave",option+1) == 0)
2526 if (i == (ssize_t) (argc-1))
2527 ThrowConvertException(OptionError,"MissingArgument",option);
2528 if (IsGeometry(argv[i]) == MagickFalse)
2529 ThrowConvertInvalidArgumentException(option,argv[i]);
2532 if (LocaleCompare("shear",option+1) == 0)
2535 if (i == (ssize_t) (argc-1))
2536 ThrowConvertException(OptionError,"MissingArgument",option);
2537 if (IsGeometry(argv[i]) == MagickFalse)
2538 ThrowConvertInvalidArgumentException(option,argv[i]);
2541 if (LocaleCompare("sigmoidal-contrast",option+1) == 0)
2544 if (i == (ssize_t) (argc-1))
2545 ThrowConvertException(OptionError,"MissingArgument",option);
2546 if (IsGeometry(argv[i]) == MagickFalse)
2547 ThrowConvertInvalidArgumentException(option,argv[i]);
2550 if (LocaleCompare("size",option+1) == 0)
2555 if (i == (ssize_t) (argc-1))
2556 ThrowConvertException(OptionError,"MissingArgument",option);
2557 if (IsGeometry(argv[i]) == MagickFalse)
2558 ThrowConvertInvalidArgumentException(option,argv[i]);
2561 if (LocaleCompare("sketch",option+1) == 0)
2566 if (i == (ssize_t) (argc-1))
2567 ThrowConvertException(OptionError,"MissingArgument",option);
2568 if (IsGeometry(argv[i]) == MagickFalse)
2569 ThrowConvertInvalidArgumentException(option,argv[i]);
2572 if (LocaleCompare("smush",option+1) == 0)
2575 if (i == (ssize_t) (argc-1))
2576 ThrowConvertException(OptionError,"MissingArgument",option);
2577 if (IsGeometry(argv[i]) == MagickFalse)
2578 ThrowConvertInvalidArgumentException(option,argv[i]);
2581 if (LocaleCompare("solarize",option+1) == 0)
2586 if (i == (ssize_t) (argc-1))
2587 ThrowConvertException(OptionError,"MissingArgument",option);
2588 if (IsGeometry(argv[i]) == MagickFalse)
2589 ThrowConvertInvalidArgumentException(option,argv[i]);
2592 if (LocaleCompare("sparse-color",option+1) == 0)
2598 if (i == (ssize_t) argc)
2599 ThrowConvertException(OptionError,"MissingArgument",option);
2600 op=ParseCommandOption(MagickSparseColorOptions,MagickFalse,argv[i]);
2602 ThrowConvertException(OptionError,"UnrecognizedSparseColorMethod",
2605 if (i == (ssize_t) (argc-1))
2606 ThrowConvertException(OptionError,"MissingArgument",option);
2609 if (LocaleCompare("splice",option+1) == 0)
2614 if (i == (ssize_t) (argc-1))
2615 ThrowConvertException(OptionError,"MissingArgument",option);
2616 if (IsGeometry(argv[i]) == MagickFalse)
2617 ThrowConvertInvalidArgumentException(option,argv[i]);
2620 if (LocaleCompare("spread",option+1) == 0)
2625 if ((i == (ssize_t) (argc-1)) ||
2626 (IsGeometry(argv[i]) == MagickFalse))
2627 ThrowConvertException(OptionError,"MissingArgument",option);
2630 if (LocaleCompare("statistic",option+1) == 0)
2638 if (i == (ssize_t) argc)
2639 ThrowConvertException(OptionError,"MissingArgument",option);
2640 op=ParseCommandOption(MagickStatisticOptions,MagickFalse,argv[i]);
2642 ThrowConvertException(OptionError,"UnrecognizedStatisticType",
2645 if (i == (ssize_t) (argc-1))
2646 ThrowConvertException(OptionError,"MissingArgument",option);
2647 if (IsGeometry(argv[i]) == MagickFalse)
2648 ThrowConvertInvalidArgumentException(option,argv[i]);
2651 if (LocaleCompare("stretch",option+1) == 0)
2659 if (i == (ssize_t) (argc-1))
2660 ThrowConvertException(OptionError,"MissingArgument",option);
2661 stretch=ParseCommandOption(MagickStretchOptions,MagickFalse,
2664 ThrowConvertException(OptionError,"UnrecognizedStyleType",
2668 if (LocaleCompare("strip",option+1) == 0)
2670 if (LocaleCompare("stroke",option+1) == 0)
2675 if (i == (ssize_t) (argc-1))
2676 ThrowConvertException(OptionError,"MissingArgument",option);
2679 if (LocaleCompare("strokewidth",option+1) == 0)
2684 if (i == (ssize_t) (argc-1))
2685 ThrowConvertException(OptionError,"MissingArgument",option);
2686 if (IsGeometry(argv[i]) == MagickFalse)
2687 ThrowConvertInvalidArgumentException(option,argv[i]);
2690 if (LocaleCompare("style",option+1) == 0)
2698 if (i == (ssize_t) (argc-1))
2699 ThrowConvertException(OptionError,"MissingArgument",option);
2700 style=ParseCommandOption(MagickStyleOptions,MagickFalse,argv[i]);
2702 ThrowConvertException(OptionError,"UnrecognizedStyleType",
2706 if (LocaleCompare("support",option+1) == 0)
2708 i++; /* deprecated */
2711 if (LocaleCompare("swap",option+1) == 0)
2716 if (i == (ssize_t) (argc-1))
2717 ThrowConvertException(OptionError,"MissingArgument",option);
2718 if (IsGeometry(argv[i]) == MagickFalse)
2719 ThrowConvertInvalidArgumentException(option,argv[i]);
2722 if (LocaleCompare("swirl",option+1) == 0)
2727 if (i == (ssize_t) (argc-1))
2728 ThrowConvertException(OptionError,"MissingArgument",option);
2729 if (IsGeometry(argv[i]) == MagickFalse)
2730 ThrowConvertInvalidArgumentException(option,argv[i]);
2733 if (LocaleCompare("synchronize",option+1) == 0)
2735 ThrowConvertException(OptionError,"UnrecognizedOption",option)
2739 if (LocaleCompare("taint",option+1) == 0)
2741 if (LocaleCompare("texture",option+1) == 0)
2746 if (i == (ssize_t) (argc-1))
2747 ThrowConvertException(OptionError,"MissingArgument",option);
2750 if (LocaleCompare("thumbnail",option+1) == 0)
2755 if (i == (ssize_t) (argc-1))
2756 ThrowConvertException(OptionError,"MissingArgument",option);
2757 if (IsGeometry(argv[i]) == MagickFalse)
2758 ThrowConvertInvalidArgumentException(option,argv[i]);
2761 if (LocaleCompare("threshold",option+1) == 0)
2766 if (i == (ssize_t) (argc-1))
2767 ThrowConvertException(OptionError,"MissingArgument",option);
2768 if (IsGeometry(argv[i]) == MagickFalse)
2769 ThrowConvertInvalidArgumentException(option,argv[i]);
2772 if (LocaleCompare("tile",option+1) == 0)
2777 if (i == (ssize_t) (argc-1))
2778 ThrowConvertException(OptionError,"MissingArgument",option);
2781 if (LocaleCompare("tile-offset",option+1) == 0)
2786 if (i == (ssize_t) (argc-1))
2787 ThrowConvertException(OptionError,"MissingArgument",option);
2788 if (IsGeometry(argv[i]) == MagickFalse)
2789 ThrowConvertInvalidArgumentException(option,argv[i]);
2792 if (LocaleCompare("tint",option+1) == 0)
2797 if (i == (ssize_t) (argc-1))
2798 ThrowConvertException(OptionError,"MissingArgument",option);
2799 if (IsGeometry(argv[i]) == MagickFalse)
2800 ThrowConvertInvalidArgumentException(option,argv[i]);
2803 if (LocaleCompare("transform",option+1) == 0)
2805 if (LocaleCompare("transparent",option+1) == 0)
2808 if (i == (ssize_t) (argc-1))
2809 ThrowConvertException(OptionError,"MissingArgument",option);
2812 if (LocaleCompare("transparent-color",option+1) == 0)
2817 if (i == (ssize_t) (argc-1))
2818 ThrowConvertException(OptionError,"MissingArgument",option);
2821 if (LocaleCompare("transpose",option+1) == 0)
2823 if (LocaleCompare("transverse",option+1) == 0)
2825 if (LocaleCompare("treedepth",option+1) == 0)
2830 if (i == (ssize_t) (argc-1))
2831 ThrowConvertException(OptionError,"MissingArgument",option);
2832 if (IsGeometry(argv[i]) == MagickFalse)
2833 ThrowConvertInvalidArgumentException(option,argv[i]);
2836 if (LocaleCompare("trim",option+1) == 0)
2838 if (LocaleCompare("type",option+1) == 0)
2846 if (i == (ssize_t) (argc-1))
2847 ThrowConvertException(OptionError,"MissingArgument",option);
2848 type=ParseCommandOption(MagickTypeOptions,MagickFalse,argv[i]);
2850 ThrowConvertException(OptionError,"UnrecognizedImageType",
2854 ThrowConvertException(OptionError,"UnrecognizedOption",option)
2858 if (LocaleCompare("undercolor",option+1) == 0)
2863 if (i == (ssize_t) (argc-1))
2864 ThrowConvertException(OptionError,"MissingArgument",option);
2867 if (LocaleCompare("unique-colors",option+1) == 0)
2869 if (LocaleCompare("units",option+1) == 0)
2877 if (i == (ssize_t) (argc-1))
2878 ThrowConvertException(OptionError,"MissingArgument",option);
2879 units=ParseCommandOption(MagickResolutionOptions,MagickFalse,
2882 ThrowConvertException(OptionError,"UnrecognizedUnitsType",
2886 if (LocaleCompare("unsharp",option+1) == 0)
2891 if (i == (ssize_t) (argc-1))
2892 ThrowConvertException(OptionError,"MissingArgument",option);
2893 if (IsGeometry(argv[i]) == MagickFalse)
2894 ThrowConvertInvalidArgumentException(option,argv[i]);
2897 ThrowConvertException(OptionError,"UnrecognizedOption",option)
2901 if (LocaleCompare("verbose",option+1) == 0)
2903 if ((LocaleCompare("version",option+1) == 0) ||
2904 (LocaleCompare("-version",option+1) == 0))
2906 (void) FormatLocaleFile(stdout,"Version: %s\n",
2907 GetMagickVersion((size_t *) NULL));
2908 (void) FormatLocaleFile(stdout,"Copyright: %s\n",
2909 GetMagickCopyright());
2910 (void) FormatLocaleFile(stdout,"Features: %s\n\n",
2911 GetMagickFeatures());
2914 if (LocaleCompare("view",option+1) == 0)
2919 if (i == (ssize_t) (argc-1))
2920 ThrowConvertException(OptionError,"MissingArgument",option);
2923 if (LocaleCompare("vignette",option+1) == 0)
2928 if (i == (ssize_t) (argc-1))
2929 ThrowConvertException(OptionError,"MissingArgument",option);
2930 if (IsGeometry(argv[i]) == MagickFalse)
2931 ThrowConvertInvalidArgumentException(option,argv[i]);
2934 if (LocaleCompare("virtual-pixel",option+1) == 0)
2942 if (i == (ssize_t) (argc-1))
2943 ThrowConvertException(OptionError,"MissingArgument",option);
2944 method=ParseCommandOption(MagickVirtualPixelOptions,MagickFalse,
2947 ThrowConvertException(OptionError,
2948 "UnrecognizedVirtualPixelMethod",argv[i]);
2951 ThrowConvertException(OptionError,"UnrecognizedOption",option)
2955 if (LocaleCompare("wave",option+1) == 0)
2958 if (i == (ssize_t) (argc-1))
2959 ThrowConvertException(OptionError,"MissingArgument",option);
2960 if (IsGeometry(argv[i]) == MagickFalse)
2961 ThrowConvertInvalidArgumentException(option,argv[i]);
2964 if (LocaleCompare("weight",option+1) == 0)
2969 if (i == (ssize_t) (argc-1))
2970 ThrowConvertException(OptionError,"MissingArgument",option);
2973 if (LocaleCompare("white-point",option+1) == 0)
2978 if (i == (ssize_t) (argc-1))
2979 ThrowConvertException(OptionError,"MissingArgument",option);
2980 if (IsGeometry(argv[i]) == MagickFalse)
2981 ThrowConvertInvalidArgumentException(option,argv[i]);
2984 if (LocaleCompare("white-threshold",option+1) == 0)
2989 if (i == (ssize_t) (argc-1))
2990 ThrowConvertException(OptionError,"MissingArgument",option);
2991 if (IsGeometry(argv[i]) == MagickFalse)
2992 ThrowConvertInvalidArgumentException(option,argv[i]);
2995 if (LocaleCompare("write",option+1) == 0)
2998 if (i == (ssize_t) (argc-1))
2999 ThrowConvertException(OptionError,"MissingArgument",option);
3002 ThrowConvertException(OptionError,"UnrecognizedOption",option)
3007 ThrowConvertException(OptionError,"UnrecognizedOption",option)
3009 fire=(GetCommandOptionFlags(MagickCommandOptions,MagickFalse,option) &
3010 FireOptionFlag) == 0 ? MagickFalse : MagickTrue;
3011 if (fire != MagickFalse)
3012 FireImageStack(MagickTrue,MagickTrue,MagickTrue);
3015 ThrowConvertException(OptionError,"UnbalancedParenthesis",argv[i]);
3016 if (i-- != (ssize_t) (argc-1))
3017 ThrowConvertException(OptionError,"MissingAnImageFilename",argv[argc-1]);
3018 if (image == (Image *) NULL)
3019 ThrowConvertException(OptionError,"MissingAnImageFilename",argv[argc-1]);
3020 FinalizeImageSettings(image_info,image,MagickTrue);
3021 if (image == (Image *) NULL)
3022 ThrowConvertException(OptionError,"MissingAnImageFilename",argv[argc-1]);
3023 status&=WriteImages(image_info,image,argv[argc-1],exception);
3024 if (metadata != (char **) NULL)
3029 text=InterpretImageProperties(image_info,image,format,exception);
3030 if (text == (char *) NULL)
3031 ThrowConvertException(ResourceLimitError,"MemoryAllocationFailed",
3032 GetExceptionMessage(errno));
3033 (void) ConcatenateString(&(*metadata),text);
3034 text=DestroyString(text);
3037 return(status != 0 ? MagickTrue : MagickFalse);