cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1 | /* |
| 2 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 3 | % % |
| 4 | % % |
| 5 | % % |
| 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 % |
| 11 | % % |
| 12 | % % |
| 13 | % Convert an image from one format to another. % |
| 14 | % % |
| 15 | % Software Design % |
| 16 | % John Cristy % |
| 17 | % April 1992 % |
| 18 | % % |
| 19 | % % |
| 20 | % Copyright 1999-2009 ImageMagick Studio LLC, a non-profit organization % |
| 21 | % dedicated to making software imaging solutions freely available. % |
| 22 | % % |
| 23 | % You may not use this file except in compliance with the License. You may % |
| 24 | % obtain a copy of the License at % |
| 25 | % % |
| 26 | % http://www.imagemagick.org/script/license.php % |
| 27 | % % |
| 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. % |
| 33 | % % |
| 34 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 35 | % |
| 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, |
| 38 | % and much more. |
| 39 | % |
| 40 | */ |
| 41 | |
| 42 | /* |
| 43 | Include declarations. |
| 44 | */ |
| 45 | #include "wand/studio.h" |
| 46 | #include "wand/MagickWand.h" |
| 47 | #include "wand/mogrify-private.h" |
| 48 | |
| 49 | /* |
| 50 | Define declarations. |
| 51 | */ |
| 52 | #define ThrowFileException(exception,severity,tag,context) \ |
| 53 | { \ |
| 54 | (void) ThrowMagickException(exception,GetMagickModule(),severity, \ |
| 55 | tag == (const char *) NULL ? "unknown" : tag,"`%s': %s",context, \ |
| 56 | GetExceptionMessage(errno)); \ |
| 57 | } |
| 58 | |
| 59 | /* |
| 60 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 61 | % % |
| 62 | % % |
| 63 | % % |
| 64 | + C o n v e r t I m a g e C o m m a n d % |
| 65 | % % |
| 66 | % % |
| 67 | % % |
| 68 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 69 | % |
| 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 |
| 72 | % format. |
| 73 | % |
| 74 | % The format of the ConvertImageCommand method is: |
| 75 | % |
| 76 | % MagickBooleanType ConvertImageCommand(ImageInfo *image_info,int argc, |
| 77 | % char **argv,char **metadata,ExceptionInfo *exception) |
| 78 | % |
| 79 | % A description of each parameter follows: |
| 80 | % |
| 81 | % o image_info: the image info. |
| 82 | % |
| 83 | % o argc: the number of elements in the argument vector. |
| 84 | % |
| 85 | % o argv: A text array containing the command line arguments. |
| 86 | % |
| 87 | % o metadata: any metadata is returned here. |
| 88 | % |
| 89 | % o exception: return any errors or warnings in this structure. |
| 90 | % |
| 91 | */ |
| 92 | |
| 93 | static MagickBooleanType ConcatenateImages(int argc,char **argv, |
| 94 | ExceptionInfo *exception) |
| 95 | { |
| 96 | FILE |
| 97 | *input, |
| 98 | *output; |
| 99 | |
| 100 | int |
| 101 | c; |
| 102 | |
| 103 | register long |
| 104 | i; |
| 105 | |
| 106 | /* |
| 107 | Open output file. |
| 108 | */ |
| 109 | output=OpenMagickStream(argv[argc-1],"wb"); |
| 110 | if (output == (FILE *) NULL) |
| 111 | { |
| 112 | ThrowFileException(exception,FileOpenError,"UnableToOpenFile", |
| 113 | argv[argc-1]); |
| 114 | return(MagickFalse); |
| 115 | } |
| 116 | for (i=2; i < (long) (argc-1); i++) |
| 117 | { |
| 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]); |
| 125 | } |
| 126 | (void) fclose(output); |
| 127 | return(MagickTrue); |
| 128 | } |
| 129 | |
| 130 | static MagickBooleanType ConvertUsage(void) |
| 131 | { |
| 132 | static const char |
| 133 | *miscellaneous[]= |
| 134 | { |
| 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", |
| 140 | (char *) NULL |
| 141 | }, |
| 142 | *operators[]= |
| 143 | { |
| 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 | "-cdl filename color correct with a color decision list", |
| 165 | "-charcoal radius simulate a charcoal drawing", |
| 166 | "-chop geometry remove pixels from the image interior", |
| 167 | "-clip clip along the first path from the 8BIM profile", |
| 168 | "-clip-mask filename associate a clip mask with the image", |
| 169 | "-clip-path id clip along a named path from the 8BIM profile", |
| 170 | "-colorize value colorize the image with the fill color", |
| 171 | "-contrast enhance or reduce the image contrast", |
| 172 | "-contrast-stretch geometry", |
| 173 | " improve contrast by `stretching' the intensity range", |
| 174 | "-convolve coefficients", |
| 175 | " apply a convolution kernel to the image", |
| 176 | "-cycle amount cycle the image colormap", |
| 177 | "-decipher filename convert cipher pixels to plain pixels", |
| 178 | "-deskew threshold straighten an image", |
| 179 | "-despeckle reduce the speckles within an image", |
| 180 | "-distort method args", |
| 181 | " distort images according to given method ad args", |
| 182 | "-draw string annotate the image with a graphic primitive", |
| 183 | "-edge radius apply a filter to detect edges in the image", |
| 184 | "-encipher filename convert plain pixels to cipher pixels", |
| 185 | "-emboss radius emboss an image", |
| 186 | "-enhance apply a digital filter to enhance a noisy image", |
| 187 | "-equalize perform histogram equalization to an image", |
| 188 | "-evaluate operator value", |
| 189 | " evaluate an expression over image values", |
| 190 | "-extent geometry set the image size", |
| 191 | "-extract geometry extract area from image", |
| 192 | "-fft implements the discrete Fourier transform (DFT)", |
| 193 | "-flip flip image vertically", |
| 194 | "-floodfill geometry color", |
| 195 | " floodfill the image with color", |
| 196 | "-flop flop image horizontally", |
| 197 | "-frame geometry surround image with an ornamental border", |
| 198 | "-function name paramters", |
| 199 | " apply function over image values", |
| 200 | "-gamma value level of gamma correction", |
| 201 | "-gaussian-blur geometry", |
| 202 | " reduce image noise and reduce detail levels", |
| 203 | "-geometry geometry perferred size or location of the image", |
| 204 | "-identify identify the format and characteristics of the image", |
| 205 | "-ift implements the inverse discrete Fourier transform (DFT)", |
| 206 | "-implode amount implode image pixels about the center", |
| 207 | "-lat geometry local adaptive thresholding", |
| 208 | "-layers method optimize, merge, or compare image layers", |
| 209 | "-level value adjust the level of image contrast", |
| 210 | "-level-colors color,color", |
cristy | ee0f8d7 | 2009-09-19 00:58:29 +0000 | [diff] [blame] | 211 | " level image with the given colors", |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 212 | "-linear-stretch geometry", |
| 213 | " improve contrast by `stretching with saturation'", |
| 214 | "-liquid-rescale geometry", |
| 215 | " rescale image with seam-carving", |
| 216 | "-median radius apply a median filter to the image", |
| 217 | "-modulate value vary the brightness, saturation, and hue", |
| 218 | "-monochrome transform image to black and white", |
| 219 | "-motion-blur geometry", |
| 220 | " simulate motion blur", |
| 221 | "-negate replace every pixel with its complementary color ", |
| 222 | "-noise radius add or reduce noise in an image", |
| 223 | "-normalize transform image to span the full range of colors", |
| 224 | "-opaque color change this color to the fill color", |
| 225 | "-ordered-dither NxN", |
| 226 | " add a noise pattern to the image with specific", |
| 227 | " amplitudes", |
| 228 | "-paint radius simulate an oil painting", |
| 229 | "-polaroid angle simulate a Polaroid picture", |
| 230 | "-posterize levels reduce the image to a limited number of color levels", |
| 231 | "-print string interpret string and print to console", |
| 232 | "-profile filename add, delete, or apply an image profile", |
| 233 | "-quantize colorspace reduce colors in this colorspace", |
| 234 | "-radial-blur angle radial blur the image", |
| 235 | "-raise value lighten/darken image edges to create a 3-D effect", |
| 236 | "-random-threshold low,high", |
| 237 | " random threshold the image", |
| 238 | "-recolor matrix translate, scale, shear, or rotate image colors", |
| 239 | "-region geometry apply options to a portion of the image", |
| 240 | "-render render vector graphics", |
| 241 | "-repage geometry size and location of an image canvas", |
| 242 | "-resample geometry change the resolution of an image", |
| 243 | "-resize geometry resize the image", |
| 244 | "-roll geometry roll an image vertically or horizontally", |
| 245 | "-rotate degrees apply Paeth rotation to the image", |
| 246 | "-sample geometry scale image with pixel sampling", |
| 247 | "-scale geometry scale the image", |
| 248 | "-segment values segment an image", |
| 249 | "-selective-blur geometry", |
| 250 | " selectively blur pixels within a contrast threshold", |
| 251 | "-sepia-tone threshold", |
| 252 | " simulate a sepia-toned photo", |
| 253 | "-set property value set an image property", |
| 254 | "-shade degrees shade the image using a distant light source", |
| 255 | "-shadow geometry simulate an image shadow", |
| 256 | "-sharpen geometry sharpen the image", |
| 257 | "-shave geometry shave pixels from the image edges", |
| 258 | "-shear geometry slide one edge of the image along the X or Y axis", |
| 259 | "-sigmoidal-contrast geometry", |
| 260 | " increase the contrast without saturating highlights or shadows", |
| 261 | "-sketch geometry simulate a pencil sketch", |
| 262 | "-solarize threshold negate all pixels above the threshold level", |
| 263 | "-sparse-color method args", |
| 264 | " fill in a image based on a few color points", |
| 265 | "-splice geometry splice the background color into the image", |
| 266 | "-spread radius displace image pixels by a random amount", |
| 267 | "-strip strip image of all profiles and comments", |
| 268 | "-swirl degrees swirl image pixels about the center", |
| 269 | "-threshold value threshold the image", |
| 270 | "-thumbnail geometry create a thumbnail of the image", |
| 271 | "-tile filename tile image when filling a graphic primitive", |
| 272 | "-tint value tint the image with the fill color", |
| 273 | "-transform affine transform image", |
| 274 | "-transparent color make this color transparent within the image", |
| 275 | "-transpose flip image vertically and rotate 90 degrees", |
| 276 | "-transverse flop image horizontally and rotate 270 degrees", |
| 277 | "-trim trim image edges", |
| 278 | "-type type image type", |
| 279 | "-unique-colors discard all but one of any pixel color", |
| 280 | "-unsharp geometry sharpen the image", |
| 281 | "-vignette geometry soften the edges of the image in vignette style", |
| 282 | "-wave geometry alter an image along a sine wave", |
| 283 | "-white-threshold value", |
| 284 | " force all pixels above the threshold into white", |
| 285 | (char *) NULL |
| 286 | }, |
| 287 | *sequence_operators[]= |
| 288 | { |
| 289 | "-append append an image sequence", |
| 290 | "-average average an image sequence", |
| 291 | "-clut apply a color lookup table to the image", |
| 292 | "-coalesce merge a sequence of images", |
| 293 | "-combine combine a sequence of images", |
| 294 | "-composite composite image", |
| 295 | "-crop geometry cut out a rectangular region of the image", |
| 296 | "-deconstruct break down an image sequence into constituent parts", |
| 297 | "-flatten flatten a sequence of images", |
| 298 | "-fx expression apply mathematical expression to an image channel(s)", |
| 299 | "-hald-clut apply a Hald color lookup table to the image", |
| 300 | "-morph value morph an image sequence", |
| 301 | "-mosaic create a mosaic from an image sequence", |
| 302 | "-process arguments process the image with a custom image filter", |
| 303 | "-reverse reverse image sequence", |
| 304 | "-separate separate an image channel into a grayscale image", |
| 305 | "-write filename write images to this file", |
| 306 | (char *) NULL |
| 307 | }, |
| 308 | *settings[]= |
| 309 | { |
| 310 | "-adjoin join images into a single multi-image file", |
| 311 | "-affine matrix affine transform matrix", |
| 312 | "-alpha option activate, deactivate, reset, or set the alpha channel", |
| 313 | "-antialias remove pixel-aliasing", |
| 314 | "-authenticate password", |
| 315 | " decipher image with this password", |
| 316 | "-attenuate value lessen (or intensify) when adding noise to an image", |
| 317 | "-background color background color", |
| 318 | "-bias value add bias when convolving an image", |
| 319 | "-black-point-compensation", |
| 320 | " use black point compensation", |
| 321 | "-blue-primary point chromaticity blue primary point", |
| 322 | "-bordercolor color border color", |
| 323 | "-caption string assign a caption to an image", |
| 324 | "-channel type apply option to select image channels", |
| 325 | "-colors value preferred number of colors in the image", |
| 326 | "-colorspace type alternate image colorspace", |
| 327 | "-comment string annotate image with comment", |
| 328 | "-compose operator set image composite operator", |
| 329 | "-compress type type of pixel compression when writing the image", |
| 330 | "-define format:option", |
| 331 | " define one or more image format options", |
| 332 | "-delay value display the next image after pausing", |
| 333 | "-density geometry horizontal and vertical density of the image", |
| 334 | "-depth value image depth", |
| 335 | "-display server get image or font from this X server", |
| 336 | "-dispose method layer disposal method", |
| 337 | "-dither method apply error diffusion to image", |
| 338 | "-encoding type text encoding type", |
| 339 | "-endian type endianness (MSB or LSB) of the image", |
| 340 | "-family name render text with this font family", |
| 341 | "-fill color color to use when filling a graphic primitive", |
| 342 | "-filter type use this filter when resizing an image", |
| 343 | "-font name render text with this font", |
| 344 | "-format \"string\" output formatted image characteristics", |
| 345 | "-fuzz distance colors within this distance are considered equal", |
| 346 | "-gravity type horizontal and vertical text placement", |
| 347 | "-green-primary point chromaticity green primary point", |
| 348 | "-intent type type of rendering intent when managing the image color", |
| 349 | "-interlace type type of image interlacing scheme", |
cristy | b32b90a | 2009-09-07 21:45:48 +0000 | [diff] [blame] | 350 | "-interline-spacing value", |
| 351 | " set the space between two text lines", |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 352 | "-interpolate method pixel color interpolation method", |
| 353 | "-interword-spacing value", |
| 354 | " set the space between two words", |
| 355 | "-kerning value set the space between two letters", |
| 356 | "-label string assign a label to an image", |
| 357 | "-limit type value pixel cache resource limit", |
| 358 | "-loop iterations add Netscape loop extension to your GIF animation", |
| 359 | "-mask filename associate a mask with the image", |
| 360 | "-mattecolor color frame color", |
| 361 | "-monitor monitor progress", |
| 362 | "-orient type image orientation", |
| 363 | "-page geometry size and location of an image canvas (setting)", |
| 364 | "-ping efficiently determine image attributes", |
| 365 | "-pointsize value font point size", |
| 366 | "-preview type image preview type", |
| 367 | "-quality value JPEG/MIFF/PNG compression level", |
| 368 | "-quiet suppress all warning messages", |
| 369 | "-red-primary point chromaticity red primary point", |
| 370 | "-regard-warnings pay attention to warning messages", |
| 371 | "-remap filename transform image colors to match this set of colors", |
| 372 | "-respect-parentheses settings remain in effect until parenthesis boundary", |
| 373 | "-sampling-factor geometry", |
| 374 | " horizontal and vertical sampling factor", |
| 375 | "-scene value image scene number", |
| 376 | "-seed value seed a new sequence of pseudo-random numbers", |
| 377 | "-size geometry width and height of image", |
| 378 | "-stretch type render text with this font stretch", |
| 379 | "-stroke color graphic primitive stroke color", |
| 380 | "-strokewidth value graphic primitive stroke width", |
| 381 | "-style type render text with this font style", |
| 382 | "-taint image as ineligible for bi-modal delegate", |
| 383 | "-texture filename name of texture to tile onto the image background", |
| 384 | "-tile-offset geometry", |
| 385 | " tile offset", |
| 386 | "-treedepth value color tree depth", |
| 387 | "-transparent-color color", |
| 388 | " transparent color", |
| 389 | "-undercolor color annotation bounding box color", |
| 390 | "-units type the units of image resolution", |
| 391 | "-verbose print detailed information about the image", |
| 392 | "-view FlashPix viewing transforms", |
| 393 | "-virtual-pixel method", |
| 394 | " virtual pixel access method", |
| 395 | "-weight type render text with this font weight", |
| 396 | "-white-point point chromaticity white point", |
| 397 | (char *) NULL |
| 398 | }, |
| 399 | *stack_operators[]= |
| 400 | { |
| 401 | "-clone index clone an image", |
| 402 | "-delete index delete the image from the image sequence", |
| 403 | "-insert index insert last image into the image sequence", |
| 404 | "-swap indexes swap two images in the image sequence", |
| 405 | (char *) NULL |
| 406 | }; |
| 407 | |
| 408 | const char |
| 409 | **p; |
| 410 | |
| 411 | (void) printf("Version: %s\n",GetMagickVersion((unsigned long *) NULL)); |
| 412 | (void) printf("Copyright: %s\n\n",GetMagickCopyright()); |
| 413 | (void) printf("Usage: %s [options ...] file [ [options ...] " |
| 414 | "file ...] [options ...] file\n",GetClientName()); |
| 415 | (void) printf("\nImage Settings:\n"); |
| 416 | for (p=settings; *p != (char *) NULL; p++) |
| 417 | (void) printf(" %s\n",*p); |
| 418 | (void) printf("\nImage Operators:\n"); |
| 419 | for (p=operators; *p != (char *) NULL; p++) |
| 420 | (void) printf(" %s\n",*p); |
| 421 | (void) printf("\nImage Sequence Operators:\n"); |
| 422 | for (p=sequence_operators; *p != (char *) NULL; p++) |
| 423 | (void) printf(" %s\n",*p); |
| 424 | (void) printf("\nImage Stack Operators:\n"); |
| 425 | for (p=stack_operators; *p != (char *) NULL; p++) |
| 426 | (void) printf(" %s\n",*p); |
| 427 | (void) printf("\nMiscellaneous Options:\n"); |
| 428 | for (p=miscellaneous; *p != (char *) NULL; p++) |
| 429 | (void) printf(" %s\n",*p); |
| 430 | (void) printf( |
| 431 | "\nBy default, the image format of `file' is determined by its magic\n"); |
| 432 | (void) printf( |
| 433 | "number. To specify a particular image format, precede the filename\n"); |
| 434 | (void) printf( |
| 435 | "with an image format name and a colon (i.e. ps:image) or specify the\n"); |
| 436 | (void) printf( |
| 437 | "image type as the filename suffix (i.e. image.ps). Specify 'file' as\n"); |
| 438 | (void) printf("'-' for standard input or output.\n"); |
| 439 | return(MagickFalse); |
| 440 | } |
| 441 | |
| 442 | WandExport MagickBooleanType ConvertImageCommand(ImageInfo *image_info, |
| 443 | int argc,char **argv,char **metadata,ExceptionInfo *exception) |
| 444 | { |
| 445 | #define NotInitialized (unsigned int) (~0) |
| 446 | #define DestroyConvert() \ |
| 447 | { \ |
| 448 | DestroyImageStack(); \ |
| 449 | for (i=0; i < (long) argc; i++) \ |
| 450 | argv[i]=DestroyString(argv[i]); \ |
| 451 | argv=(char **) RelinquishMagickMemory(argv); \ |
| 452 | } |
| 453 | #define ThrowConvertException(asperity,tag,option) \ |
| 454 | { \ |
| 455 | (void) ThrowMagickException(exception,GetMagickModule(),asperity,tag,"`%s'", \ |
| 456 | option); \ |
| 457 | DestroyConvert(); \ |
| 458 | return(MagickFalse); \ |
| 459 | } |
| 460 | #define ThrowConvertInvalidArgumentException(option,argument) \ |
| 461 | { \ |
| 462 | (void) ThrowMagickException(exception,GetMagickModule(),OptionError, \ |
| 463 | "InvalidArgument","`%s': %s",option,argument); \ |
| 464 | DestroyConvert(); \ |
| 465 | return(MagickFalse); \ |
| 466 | } |
| 467 | |
| 468 | char |
| 469 | *filename, |
| 470 | *option; |
| 471 | |
| 472 | const char |
| 473 | *format; |
| 474 | |
| 475 | Image |
| 476 | *image; |
| 477 | |
| 478 | ImageStack |
| 479 | image_stack[MaxImageStackDepth+1]; |
| 480 | |
| 481 | long |
| 482 | j, |
| 483 | k; |
| 484 | |
| 485 | MagickBooleanType |
| 486 | fire, |
| 487 | pend; |
| 488 | |
| 489 | MagickStatusType |
| 490 | status; |
| 491 | |
| 492 | register long |
| 493 | i; |
| 494 | |
| 495 | /* |
| 496 | Set defaults. |
| 497 | */ |
| 498 | assert(image_info != (ImageInfo *) NULL); |
| 499 | assert(image_info->signature == MagickSignature); |
| 500 | if (image_info->debug != MagickFalse) |
| 501 | (void) LogMagickEvent(TraceEvent,GetMagickModule(),"..."); |
| 502 | assert(exception != (ExceptionInfo *) NULL); |
| 503 | if (argc == 2) |
| 504 | { |
| 505 | option=argv[1]; |
| 506 | if ((LocaleCompare("version",option+1) == 0) || |
| 507 | (LocaleCompare("-version",option+1) == 0)) |
| 508 | { |
| 509 | (void) fprintf(stdout,"Version: %s\n", |
| 510 | GetMagickVersion((unsigned long *) NULL)); |
| 511 | (void) fprintf(stdout,"Copyright: %s\n\n",GetMagickCopyright()); |
| 512 | return(MagickFalse); |
| 513 | } |
| 514 | } |
| 515 | if (argc < 3) |
| 516 | { |
| 517 | (void) ConvertUsage(); |
| 518 | return(MagickTrue); |
| 519 | } |
| 520 | filename=(char *) NULL; |
| 521 | format="%w,%h,%m"; |
| 522 | j=1; |
| 523 | k=0; |
| 524 | NewImageStack(); |
| 525 | option=(char *) NULL; |
| 526 | pend=MagickFalse; |
| 527 | status=MagickTrue; |
| 528 | /* |
| 529 | Parse command-line arguments. |
| 530 | */ |
| 531 | ReadCommandlLine(argc,&argv); |
| 532 | status=ExpandFilenames(&argc,&argv); |
| 533 | if (status == MagickFalse) |
| 534 | ThrowConvertException(ResourceLimitError,"MemoryAllocationFailed", |
| 535 | GetExceptionMessage(errno)); |
| 536 | if ((argc > 2) && (LocaleCompare("-concatenate",argv[1]) == 0)) |
| 537 | return(ConcatenateImages(argc,argv,exception)); |
| 538 | for (i=1; i < (long) (argc-1); i++) |
| 539 | { |
| 540 | option=argv[i]; |
| 541 | if (LocaleCompare(option,"(") == 0) |
| 542 | { |
| 543 | FireImageStack(MagickTrue,MagickTrue,pend); |
| 544 | if (k == MaxImageStackDepth) |
| 545 | ThrowConvertException(OptionError,"ParenthesisNestedTooDeeply", |
| 546 | option); |
| 547 | PushImageStack(); |
| 548 | continue; |
| 549 | } |
| 550 | if (LocaleCompare(option,")") == 0) |
| 551 | { |
| 552 | FireImageStack(MagickTrue,MagickTrue,MagickTrue); |
| 553 | if (k == 0) |
| 554 | ThrowConvertException(OptionError,"UnableToParseExpression",option); |
| 555 | PopImageStack(); |
| 556 | continue; |
| 557 | } |
| 558 | if (IsMagickOption(option) == MagickFalse) |
| 559 | { |
| 560 | Image |
| 561 | *images; |
| 562 | |
| 563 | /* |
| 564 | Read input image. |
| 565 | */ |
| 566 | FireImageStack(MagickTrue,MagickTrue,pend); |
| 567 | filename=argv[i]; |
| 568 | if ((LocaleCompare(filename,"--") == 0) && (i < (argc-1))) |
| 569 | filename=argv[++i]; |
| 570 | (void) CopyMagickString(image_info->filename,filename,MaxTextExtent); |
| 571 | if (image_info->ping != MagickFalse) |
| 572 | images=PingImages(image_info,exception); |
| 573 | else |
| 574 | images=ReadImages(image_info,exception); |
| 575 | status&=(images != (Image *) NULL) && |
| 576 | (exception->severity < ErrorException); |
| 577 | if (images == (Image *) NULL) |
| 578 | continue; |
| 579 | AppendImageStack(images); |
| 580 | continue; |
| 581 | } |
| 582 | pend=image != (Image *) NULL ? MagickTrue : MagickFalse; |
| 583 | switch (*(option+1)) |
| 584 | { |
| 585 | case 'a': |
| 586 | { |
| 587 | if (LocaleCompare("adaptive-blur",option+1) == 0) |
| 588 | { |
| 589 | i++; |
| 590 | if (i == (long) (argc-1)) |
| 591 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 592 | if (IsGeometry(argv[i]) == MagickFalse) |
| 593 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 594 | break; |
| 595 | } |
| 596 | if (LocaleCompare("adaptive-resize",option+1) == 0) |
| 597 | { |
| 598 | i++; |
| 599 | if (i == (long) (argc-1)) |
| 600 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 601 | if (IsGeometry(argv[i]) == MagickFalse) |
| 602 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 603 | break; |
| 604 | } |
| 605 | if (LocaleCompare("adaptive-sharpen",option+1) == 0) |
| 606 | { |
| 607 | i++; |
| 608 | if (i == (long) (argc-1)) |
| 609 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 610 | if (IsGeometry(argv[i]) == MagickFalse) |
| 611 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 612 | break; |
| 613 | } |
| 614 | if (LocaleCompare("adjoin",option+1) == 0) |
| 615 | break; |
| 616 | if (LocaleCompare("affine",option+1) == 0) |
| 617 | { |
| 618 | if (*option == '+') |
| 619 | break; |
| 620 | i++; |
| 621 | if (i == (long) (argc-1)) |
| 622 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 623 | if (IsGeometry(argv[i]) == MagickFalse) |
| 624 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 625 | break; |
| 626 | } |
| 627 | if (LocaleCompare("alpha",option+1) == 0) |
| 628 | { |
| 629 | long |
| 630 | type; |
| 631 | |
| 632 | if (*option == '+') |
| 633 | break; |
| 634 | i++; |
| 635 | if (i == (long) argc) |
| 636 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 637 | type=ParseMagickOption(MagickAlphaOptions,MagickFalse,argv[i]); |
| 638 | if (type < 0) |
| 639 | ThrowConvertException(OptionError,"UnrecognizedAlphaChannelType", |
| 640 | argv[i]); |
| 641 | break; |
| 642 | } |
| 643 | if (LocaleCompare("annotate",option+1) == 0) |
| 644 | { |
| 645 | if (*option == '+') |
| 646 | break; |
| 647 | i++; |
| 648 | if (i == (long) (argc-1)) |
| 649 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 650 | if (IsGeometry(argv[i]) == MagickFalse) |
| 651 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 652 | i++; |
| 653 | if (i == (long) (argc-1)) |
| 654 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 655 | break; |
| 656 | } |
| 657 | if (LocaleCompare("antialias",option+1) == 0) |
| 658 | break; |
| 659 | if (LocaleCompare("append",option+1) == 0) |
| 660 | break; |
| 661 | if (LocaleCompare("attenuate",option+1) == 0) |
| 662 | { |
| 663 | if (*option == '+') |
| 664 | break; |
| 665 | i++; |
| 666 | if (i == (long) (argc-1)) |
| 667 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 668 | if (IsGeometry(argv[i]) == MagickFalse) |
| 669 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 670 | break; |
| 671 | } |
| 672 | if (LocaleCompare("authenticate",option+1) == 0) |
| 673 | { |
| 674 | if (*option == '+') |
| 675 | break; |
| 676 | i++; |
| 677 | if (i == (long) (argc-1)) |
| 678 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 679 | break; |
| 680 | } |
| 681 | if (LocaleCompare("auto-gamma",option+1) == 0) |
| 682 | break; |
| 683 | if (LocaleCompare("auto-level",option+1) == 0) |
| 684 | break; |
| 685 | if (LocaleCompare("auto-orient",option+1) == 0) |
| 686 | break; |
| 687 | if (LocaleCompare("average",option+1) == 0) |
| 688 | break; |
| 689 | ThrowConvertException(OptionError,"UnrecognizedOption",option) |
| 690 | } |
| 691 | case 'b': |
| 692 | { |
| 693 | if (LocaleCompare("background",option+1) == 0) |
| 694 | { |
| 695 | if (*option == '+') |
| 696 | break; |
| 697 | i++; |
| 698 | if (i == (long) (argc-1)) |
| 699 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 700 | break; |
| 701 | } |
| 702 | if (LocaleCompare("bench",option+1) == 0) |
| 703 | { |
| 704 | if (*option == '+') |
| 705 | break; |
| 706 | i++; |
| 707 | if (i == (long) (argc-1)) |
| 708 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 709 | if (IsGeometry(argv[i]) == MagickFalse) |
| 710 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 711 | break; |
| 712 | } |
| 713 | if (LocaleCompare("bias",option+1) == 0) |
| 714 | { |
| 715 | if (*option == '+') |
| 716 | break; |
| 717 | i++; |
| 718 | if (i == (long) (argc-1)) |
| 719 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 720 | if (IsGeometry(argv[i]) == MagickFalse) |
| 721 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 722 | break; |
| 723 | } |
| 724 | if (LocaleCompare("black-point-compensation",option+1) == 0) |
| 725 | break; |
| 726 | if (LocaleCompare("black-threshold",option+1) == 0) |
| 727 | { |
| 728 | if (*option == '+') |
| 729 | break; |
| 730 | i++; |
| 731 | if (i == (long) (argc-1)) |
| 732 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 733 | if (IsGeometry(argv[i]) == MagickFalse) |
| 734 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 735 | break; |
| 736 | } |
| 737 | if (LocaleCompare("blue-primary",option+1) == 0) |
| 738 | { |
| 739 | if (*option == '+') |
| 740 | break; |
| 741 | i++; |
| 742 | if (i == (long) (argc-1)) |
| 743 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 744 | if (IsGeometry(argv[i]) == MagickFalse) |
| 745 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 746 | break; |
| 747 | } |
| 748 | if (LocaleCompare("blue-shift",option+1) == 0) |
| 749 | { |
| 750 | if (*option == '+') |
| 751 | break; |
| 752 | i++; |
| 753 | if (i == (long) (argc-1)) |
| 754 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 755 | if (IsGeometry(argv[i]) == MagickFalse) |
| 756 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 757 | break; |
| 758 | } |
| 759 | if (LocaleCompare("blur",option+1) == 0) |
| 760 | { |
| 761 | if (*option == '+') |
| 762 | break; |
| 763 | i++; |
| 764 | if (i == (long) (argc-1)) |
| 765 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 766 | if (IsGeometry(argv[i]) == MagickFalse) |
| 767 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 768 | break; |
| 769 | } |
| 770 | if (LocaleCompare("border",option+1) == 0) |
| 771 | { |
| 772 | if (*option == '+') |
| 773 | break; |
| 774 | i++; |
| 775 | if (i == (long) (argc-1)) |
| 776 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 777 | if (IsGeometry(argv[i]) == MagickFalse) |
| 778 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 779 | break; |
| 780 | } |
| 781 | if (LocaleCompare("bordercolor",option+1) == 0) |
| 782 | { |
| 783 | if (*option == '+') |
| 784 | break; |
| 785 | i++; |
| 786 | if (i == (long) (argc-1)) |
| 787 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 788 | break; |
| 789 | } |
| 790 | if (LocaleCompare("box",option+1) == 0) |
| 791 | { |
| 792 | if (*option == '+') |
| 793 | break; |
| 794 | i++; |
| 795 | if (i == (long) (argc-1)) |
| 796 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 797 | break; |
| 798 | } |
| 799 | ThrowConvertException(OptionError,"UnrecognizedOption",option) |
| 800 | } |
| 801 | case 'c': |
| 802 | { |
| 803 | if (LocaleCompare("cache",option+1) == 0) |
| 804 | { |
| 805 | if (*option == '+') |
| 806 | break; |
| 807 | i++; |
| 808 | if (i == (long) (argc-1)) |
| 809 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 810 | if (IsGeometry(argv[i]) == MagickFalse) |
| 811 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 812 | break; |
| 813 | } |
| 814 | if (LocaleCompare("caption",option+1) == 0) |
| 815 | { |
| 816 | if (*option == '+') |
| 817 | break; |
| 818 | i++; |
| 819 | if (i == (long) argc) |
| 820 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 821 | break; |
| 822 | } |
| 823 | if (LocaleCompare("cdl",option+1) == 0) |
| 824 | { |
| 825 | if (*option == '+') |
| 826 | break; |
| 827 | i++; |
| 828 | if (i == (long) (argc-1)) |
| 829 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 830 | break; |
| 831 | } |
| 832 | if (LocaleCompare("channel",option+1) == 0) |
| 833 | { |
| 834 | long |
| 835 | channel; |
| 836 | |
| 837 | if (*option == '+') |
| 838 | break; |
| 839 | i++; |
| 840 | if (i == (long) (argc-1)) |
| 841 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 842 | channel=ParseChannelOption(argv[i]); |
| 843 | if (channel < 0) |
| 844 | ThrowConvertException(OptionError,"UnrecognizedChannelType", |
| 845 | argv[i]); |
| 846 | break; |
| 847 | } |
| 848 | if (LocaleCompare("charcoal",option+1) == 0) |
| 849 | { |
| 850 | if (*option == '+') |
| 851 | break; |
| 852 | i++; |
| 853 | if (i == (long) (argc-1)) |
| 854 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 855 | if (IsGeometry(argv[i]) == MagickFalse) |
| 856 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 857 | break; |
| 858 | } |
| 859 | if (LocaleCompare("chop",option+1) == 0) |
| 860 | { |
| 861 | if (*option == '+') |
| 862 | break; |
| 863 | i++; |
| 864 | if (i == (long) (argc-1)) |
| 865 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 866 | if (IsGeometry(argv[i]) == MagickFalse) |
| 867 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 868 | break; |
| 869 | } |
| 870 | if (LocaleCompare("clip",option+1) == 0) |
| 871 | break; |
| 872 | if (LocaleCompare("clip-mask",option+1) == 0) |
| 873 | { |
| 874 | if (*option == '+') |
| 875 | break; |
| 876 | i++; |
| 877 | if (i == (long) (argc-1)) |
| 878 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 879 | break; |
| 880 | } |
| 881 | if (LocaleCompare("clip-path",option+1) == 0) |
| 882 | { |
| 883 | i++; |
| 884 | if (i == (long) (argc-1)) |
| 885 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 886 | break; |
| 887 | } |
| 888 | if (LocaleCompare("clone",option+1) == 0) |
| 889 | { |
| 890 | Image |
| 891 | *clone_images; |
| 892 | |
| 893 | clone_images=image; |
| 894 | if (k != 0) |
| 895 | clone_images=image_stack[k-1].image; |
| 896 | if (clone_images == (Image *) NULL) |
| 897 | ThrowConvertException(ImageError,"ImageSequenceRequired",option); |
| 898 | FireImageStack(MagickTrue,MagickTrue,MagickTrue); |
| 899 | if (*option == '+') |
| 900 | clone_images=CloneImages(clone_images,"-1",exception); |
| 901 | else |
| 902 | { |
| 903 | i++; |
| 904 | if (i == (long) (argc-1)) |
| 905 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 906 | if (IsSceneGeometry(argv[i],MagickFalse) == MagickFalse) |
| 907 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 908 | clone_images=CloneImages(clone_images,argv[i],exception); |
| 909 | } |
| 910 | if (clone_images == (Image *) NULL) |
| 911 | ThrowConvertException(OptionError,"NoSuchImage",option); |
| 912 | AppendImageStack(clone_images); |
| 913 | break; |
| 914 | } |
| 915 | if (LocaleCompare("clut",option+1) == 0) |
| 916 | break; |
| 917 | if (LocaleCompare("coalesce",option+1) == 0) |
| 918 | break; |
| 919 | if (LocaleCompare("colorize",option+1) == 0) |
| 920 | { |
| 921 | if (*option == '+') |
| 922 | break; |
| 923 | i++; |
| 924 | if (i == (long) (argc-1)) |
| 925 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 926 | if (IsGeometry(argv[i]) == MagickFalse) |
| 927 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 928 | break; |
| 929 | } |
| 930 | if (LocaleCompare("colors",option+1) == 0) |
| 931 | { |
| 932 | if (*option == '+') |
| 933 | break; |
| 934 | i++; |
| 935 | if ((i == (long) (argc-1)) || |
| 936 | (IsGeometry(argv[i]) == MagickFalse)) |
| 937 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 938 | break; |
| 939 | } |
| 940 | if (LocaleCompare("colorspace",option+1) == 0) |
| 941 | { |
| 942 | long |
| 943 | colorspace; |
| 944 | |
| 945 | if (*option == '+') |
| 946 | break; |
| 947 | i++; |
| 948 | if (i == (long) (argc-1)) |
| 949 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 950 | colorspace=ParseMagickOption(MagickColorspaceOptions, |
| 951 | MagickFalse,argv[i]); |
| 952 | if (colorspace < 0) |
| 953 | ThrowConvertException(OptionError,"UnrecognizedColorspace", |
| 954 | argv[i]); |
| 955 | break; |
| 956 | } |
| 957 | if (LocaleCompare("combine",option+1) == 0) |
| 958 | break; |
| 959 | if (LocaleCompare("comment",option+1) == 0) |
| 960 | { |
| 961 | if (*option == '+') |
| 962 | break; |
| 963 | i++; |
| 964 | if (i == (long) argc) |
| 965 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 966 | break; |
| 967 | } |
| 968 | if (LocaleCompare("compose",option+1) == 0) |
| 969 | { |
| 970 | long |
| 971 | compose; |
| 972 | |
| 973 | if (*option == '+') |
| 974 | break; |
| 975 | i++; |
| 976 | if (i == (long) argc) |
| 977 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 978 | compose=ParseMagickOption(MagickComposeOptions,MagickFalse, |
| 979 | argv[i]); |
| 980 | if (compose < 0) |
| 981 | ThrowConvertException(OptionError,"UnrecognizedComposeOperator", |
| 982 | argv[i]); |
| 983 | break; |
| 984 | } |
| 985 | if (LocaleCompare("composite",option+1) == 0) |
| 986 | break; |
| 987 | if (LocaleCompare("compress",option+1) == 0) |
| 988 | { |
| 989 | long |
| 990 | compress; |
| 991 | |
| 992 | if (*option == '+') |
| 993 | break; |
| 994 | i++; |
| 995 | if (i == (long) (argc-1)) |
| 996 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 997 | compress=ParseMagickOption(MagickCompressOptions,MagickFalse, |
| 998 | argv[i]); |
| 999 | if (compress < 0) |
| 1000 | ThrowConvertException(OptionError,"UnrecognizedImageCompression", |
| 1001 | argv[i]); |
| 1002 | break; |
| 1003 | } |
| 1004 | if (LocaleCompare("contrast",option+1) == 0) |
| 1005 | break; |
| 1006 | if (LocaleCompare("contrast-stretch",option+1) == 0) |
| 1007 | { |
| 1008 | i++; |
| 1009 | if (i == (long) (argc-1)) |
| 1010 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1011 | if (IsGeometry(argv[i]) == MagickFalse) |
| 1012 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 1013 | break; |
| 1014 | } |
| 1015 | if (LocaleCompare("convolve",option+1) == 0) |
| 1016 | { |
| 1017 | if (*option == '+') |
| 1018 | break; |
| 1019 | i++; |
| 1020 | if (i == (long) (argc-1)) |
| 1021 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1022 | if (IsGeometry(argv[i]) == MagickFalse) |
| 1023 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 1024 | break; |
| 1025 | } |
| 1026 | if (LocaleCompare("crop",option+1) == 0) |
| 1027 | { |
| 1028 | if (*option == '+') |
| 1029 | break; |
| 1030 | i++; |
| 1031 | if (i == (long) (argc-1)) |
| 1032 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1033 | if (IsGeometry(argv[i]) == MagickFalse) |
| 1034 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 1035 | break; |
| 1036 | } |
| 1037 | if (LocaleCompare("cycle",option+1) == 0) |
| 1038 | { |
| 1039 | if (*option == '+') |
| 1040 | break; |
| 1041 | i++; |
| 1042 | if (i == (long) (argc-1)) |
| 1043 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1044 | if (IsGeometry(argv[i]) == MagickFalse) |
| 1045 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 1046 | break; |
| 1047 | } |
| 1048 | ThrowConvertException(OptionError,"UnrecognizedOption",option) |
| 1049 | } |
| 1050 | case 'd': |
| 1051 | { |
| 1052 | if (LocaleCompare("decipher",option+1) == 0) |
| 1053 | { |
| 1054 | if (*option == '+') |
| 1055 | break; |
| 1056 | i++; |
| 1057 | if (i == (long) (argc-1)) |
| 1058 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1059 | break; |
| 1060 | } |
| 1061 | if (LocaleCompare("deconstruct",option+1) == 0) |
| 1062 | break; |
| 1063 | if (LocaleCompare("debug",option+1) == 0) |
| 1064 | { |
| 1065 | long |
| 1066 | event; |
| 1067 | |
| 1068 | if (*option == '+') |
| 1069 | break; |
| 1070 | i++; |
| 1071 | if (i == (long) argc) |
| 1072 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1073 | event=ParseMagickOption(MagickLogEventOptions,MagickFalse,argv[i]); |
| 1074 | if (event < 0) |
| 1075 | ThrowConvertException(OptionError,"UnrecognizedEventType", |
| 1076 | argv[i]); |
| 1077 | (void) SetLogEventMask(argv[i]); |
| 1078 | break; |
| 1079 | } |
| 1080 | if (LocaleCompare("define",option+1) == 0) |
| 1081 | { |
| 1082 | i++; |
| 1083 | if (i == (long) argc) |
| 1084 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1085 | if (*option == '+') |
| 1086 | { |
| 1087 | const char |
| 1088 | *define; |
| 1089 | |
| 1090 | define=GetImageOption(image_info,argv[i]); |
| 1091 | if (define == (const char *) NULL) |
| 1092 | ThrowConvertException(OptionError,"NoSuchOption",argv[i]); |
| 1093 | break; |
| 1094 | } |
| 1095 | break; |
| 1096 | } |
| 1097 | if (LocaleCompare("delay",option+1) == 0) |
| 1098 | { |
| 1099 | if (*option == '+') |
| 1100 | break; |
| 1101 | i++; |
| 1102 | if (i == (long) argc) |
| 1103 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1104 | if (IsGeometry(argv[i]) == MagickFalse) |
| 1105 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 1106 | break; |
| 1107 | } |
| 1108 | if (LocaleCompare("density",option+1) == 0) |
| 1109 | { |
| 1110 | if (*option == '+') |
| 1111 | break; |
| 1112 | i++; |
| 1113 | if (i == (long) (argc-1)) |
| 1114 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1115 | if (IsGeometry(argv[i]) == MagickFalse) |
| 1116 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 1117 | break; |
| 1118 | } |
| 1119 | if (LocaleCompare("depth",option+1) == 0) |
| 1120 | { |
| 1121 | if (*option == '+') |
| 1122 | break; |
| 1123 | i++; |
| 1124 | if (i == (long) (argc-1)) |
| 1125 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1126 | if (IsGeometry(argv[i]) == MagickFalse) |
| 1127 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 1128 | break; |
| 1129 | } |
| 1130 | if (LocaleCompare("delete",option+1) == 0) |
| 1131 | { |
| 1132 | if (*option == '+') |
| 1133 | break; |
| 1134 | i++; |
| 1135 | if (i == (long) (argc-1)) |
| 1136 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1137 | if (IsSceneGeometry(argv[i],MagickFalse) == MagickFalse) |
| 1138 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 1139 | break; |
| 1140 | } |
| 1141 | if (LocaleCompare("deskew",option+1) == 0) |
| 1142 | { |
| 1143 | if (*option == '+') |
| 1144 | break; |
| 1145 | i++; |
| 1146 | if (i == (long) (argc-1)) |
| 1147 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1148 | if (IsGeometry(argv[i]) == MagickFalse) |
| 1149 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 1150 | break; |
| 1151 | } |
| 1152 | if (LocaleCompare("despeckle",option+1) == 0) |
| 1153 | break; |
| 1154 | if (LocaleCompare("display",option+1) == 0) |
| 1155 | { |
| 1156 | if (*option == '+') |
| 1157 | break; |
| 1158 | i++; |
| 1159 | if (i == (long) (argc-1)) |
| 1160 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1161 | break; |
| 1162 | } |
| 1163 | if (LocaleCompare("dispose",option+1) == 0) |
| 1164 | { |
| 1165 | long |
| 1166 | dispose; |
| 1167 | |
| 1168 | if (*option == '+') |
| 1169 | break; |
| 1170 | i++; |
| 1171 | if (i == (long) argc) |
| 1172 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1173 | dispose=ParseMagickOption(MagickDisposeOptions,MagickFalse,argv[i]); |
| 1174 | if (dispose < 0) |
| 1175 | ThrowConvertException(OptionError,"UnrecognizedDisposeMethod", |
| 1176 | argv[i]); |
| 1177 | break; |
| 1178 | } |
| 1179 | if (LocaleCompare("distort",option+1) == 0) |
| 1180 | { |
| 1181 | long |
| 1182 | op; |
| 1183 | |
| 1184 | i++; |
| 1185 | if (i == (long) argc) |
| 1186 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1187 | op=ParseMagickOption(MagickDistortOptions,MagickFalse,argv[i]); |
| 1188 | if (op < 0) |
| 1189 | ThrowConvertException(OptionError,"UnrecognizedDistortMethod", |
| 1190 | argv[i]); |
| 1191 | i++; |
| 1192 | if (i == (long) (argc-1)) |
| 1193 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1194 | break; |
| 1195 | } |
| 1196 | if (LocaleCompare("dither",option+1) == 0) |
| 1197 | { |
| 1198 | long |
| 1199 | method; |
| 1200 | |
| 1201 | if (*option == '+') |
| 1202 | break; |
| 1203 | i++; |
| 1204 | if (i == (long) argc) |
| 1205 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1206 | method=ParseMagickOption(MagickDitherOptions,MagickFalse,argv[i]); |
| 1207 | if (method < 0) |
| 1208 | ThrowConvertException(OptionError,"UnrecognizedDitherMethod", |
| 1209 | argv[i]); |
| 1210 | break; |
| 1211 | } |
| 1212 | if (LocaleCompare("draw",option+1) == 0) |
| 1213 | { |
| 1214 | if (*option == '+') |
| 1215 | break; |
| 1216 | i++; |
| 1217 | if (i == (long) (argc-1)) |
| 1218 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1219 | break; |
| 1220 | } |
| 1221 | ThrowConvertException(OptionError,"UnrecognizedOption",option) |
| 1222 | } |
| 1223 | case 'e': |
| 1224 | { |
| 1225 | if (LocaleCompare("edge",option+1) == 0) |
| 1226 | { |
| 1227 | if (*option == '+') |
| 1228 | break; |
| 1229 | i++; |
| 1230 | if (i == (long) (argc-1)) |
| 1231 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1232 | if (IsGeometry(argv[i]) == MagickFalse) |
| 1233 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 1234 | break; |
| 1235 | } |
| 1236 | if (LocaleCompare("emboss",option+1) == 0) |
| 1237 | { |
| 1238 | if (*option == '+') |
| 1239 | break; |
| 1240 | i++; |
| 1241 | if (i == (long) (argc-1)) |
| 1242 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1243 | if (IsGeometry(argv[i]) == MagickFalse) |
| 1244 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 1245 | break; |
| 1246 | } |
| 1247 | if (LocaleCompare("encipher",option+1) == 0) |
| 1248 | { |
| 1249 | if (*option == '+') |
| 1250 | break; |
| 1251 | i++; |
| 1252 | if (i == (long) (argc-1)) |
| 1253 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1254 | break; |
| 1255 | } |
| 1256 | if (LocaleCompare("encoding",option+1) == 0) |
| 1257 | { |
| 1258 | if (*option == '+') |
| 1259 | break; |
| 1260 | i++; |
| 1261 | if (i == (long) (argc-1)) |
| 1262 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1263 | break; |
| 1264 | } |
| 1265 | if (LocaleCompare("endian",option+1) == 0) |
| 1266 | { |
| 1267 | long |
| 1268 | endian; |
| 1269 | |
| 1270 | if (*option == '+') |
| 1271 | break; |
| 1272 | i++; |
| 1273 | if (i == (long) (argc-1)) |
| 1274 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1275 | endian=ParseMagickOption(MagickEndianOptions,MagickFalse, |
| 1276 | argv[i]); |
| 1277 | if (endian < 0) |
| 1278 | ThrowConvertException(OptionError,"UnrecognizedEndianType", |
| 1279 | argv[i]); |
| 1280 | break; |
| 1281 | } |
| 1282 | if (LocaleCompare("enhance",option+1) == 0) |
| 1283 | break; |
| 1284 | if (LocaleCompare("equalize",option+1) == 0) |
| 1285 | break; |
| 1286 | if (LocaleCompare("evaluate",option+1) == 0) |
| 1287 | { |
| 1288 | long |
| 1289 | op; |
| 1290 | |
| 1291 | if (*option == '+') |
| 1292 | break; |
| 1293 | i++; |
| 1294 | if (i == (long) argc) |
| 1295 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1296 | op=ParseMagickOption(MagickEvaluateOptions,MagickFalse,argv[i]); |
| 1297 | if (op < 0) |
| 1298 | ThrowConvertException(OptionError,"UnrecognizedEvaluateOperator", |
| 1299 | argv[i]); |
| 1300 | i++; |
| 1301 | if (i == (long) (argc-1)) |
| 1302 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1303 | if (IsGeometry(argv[i]) == MagickFalse) |
| 1304 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 1305 | break; |
| 1306 | } |
| 1307 | if (LocaleCompare("extent",option+1) == 0) |
| 1308 | { |
| 1309 | if (*option == '+') |
| 1310 | break; |
| 1311 | i++; |
| 1312 | if (i == (long) (argc-1)) |
| 1313 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1314 | if (IsGeometry(argv[i]) == MagickFalse) |
| 1315 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 1316 | break; |
| 1317 | } |
| 1318 | if (LocaleCompare("extract",option+1) == 0) |
| 1319 | { |
| 1320 | if (*option == '+') |
| 1321 | break; |
| 1322 | i++; |
| 1323 | if (i == (long) (argc-1)) |
| 1324 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1325 | if (IsGeometry(argv[i]) == MagickFalse) |
| 1326 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 1327 | break; |
| 1328 | } |
| 1329 | ThrowConvertException(OptionError,"UnrecognizedOption",option) |
| 1330 | } |
| 1331 | case 'f': |
| 1332 | { |
| 1333 | if (LocaleCompare("family",option+1) == 0) |
| 1334 | { |
| 1335 | if (*option == '+') |
| 1336 | break; |
| 1337 | i++; |
| 1338 | if (i == (long) (argc-1)) |
| 1339 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1340 | break; |
| 1341 | } |
| 1342 | if (LocaleCompare("fft",option+1) == 0) |
| 1343 | break; |
| 1344 | if (LocaleCompare("fill",option+1) == 0) |
| 1345 | { |
| 1346 | if (*option == '+') |
| 1347 | break; |
| 1348 | i++; |
| 1349 | if (i == (long) (argc-1)) |
| 1350 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1351 | break; |
| 1352 | } |
| 1353 | if (LocaleCompare("filter",option+1) == 0) |
| 1354 | { |
| 1355 | long |
| 1356 | filter; |
| 1357 | |
| 1358 | if (*option == '+') |
| 1359 | break; |
| 1360 | i++; |
| 1361 | if (i == (long) (argc-1)) |
| 1362 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1363 | filter=ParseMagickOption(MagickFilterOptions,MagickFalse,argv[i]); |
| 1364 | if (filter < 0) |
| 1365 | ThrowConvertException(OptionError,"UnrecognizedImageFilter", |
| 1366 | argv[i]); |
| 1367 | break; |
| 1368 | } |
| 1369 | if (LocaleCompare("flatten",option+1) == 0) |
| 1370 | break; |
| 1371 | if (LocaleCompare("flip",option+1) == 0) |
| 1372 | break; |
| 1373 | if (LocaleCompare("flop",option+1) == 0) |
| 1374 | break; |
| 1375 | if (LocaleCompare("floodfill",option+1) == 0) |
| 1376 | { |
| 1377 | if (*option == '+') |
| 1378 | break; |
| 1379 | i++; |
| 1380 | if (i == (long) (argc-1)) |
| 1381 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1382 | if (IsGeometry(argv[i]) == MagickFalse) |
| 1383 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 1384 | i++; |
| 1385 | if (i == (long) (argc-1)) |
| 1386 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1387 | break; |
| 1388 | } |
| 1389 | if (LocaleCompare("font",option+1) == 0) |
| 1390 | { |
| 1391 | if (*option == '+') |
| 1392 | break; |
| 1393 | i++; |
| 1394 | if (i == (long) (argc-1)) |
| 1395 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1396 | break; |
| 1397 | } |
| 1398 | if (LocaleCompare("format",option+1) == 0) |
| 1399 | { |
| 1400 | if (*option == '+') |
| 1401 | break; |
| 1402 | i++; |
| 1403 | if (i == (long) (argc-1)) |
| 1404 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1405 | format=argv[i]; |
| 1406 | break; |
| 1407 | } |
| 1408 | if (LocaleCompare("frame",option+1) == 0) |
| 1409 | { |
| 1410 | if (*option == '+') |
| 1411 | break; |
| 1412 | i++; |
| 1413 | if (i == (long) (argc-1)) |
| 1414 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1415 | if (IsGeometry(argv[i]) == MagickFalse) |
| 1416 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 1417 | break; |
| 1418 | } |
| 1419 | if (LocaleCompare("function",option+1) == 0) |
| 1420 | { |
| 1421 | long |
| 1422 | op; |
| 1423 | |
| 1424 | if (*option == '+') |
| 1425 | break; |
| 1426 | i++; |
| 1427 | if (i == (long) argc) |
| 1428 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1429 | op=ParseMagickOption(MagickFunctionOptions,MagickFalse,argv[i]); |
| 1430 | if (op < 0) |
| 1431 | ThrowConvertException(OptionError,"UnrecognizedFunction",argv[i]); |
| 1432 | i++; |
| 1433 | if (i == (long) (argc-1)) |
| 1434 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1435 | break; |
| 1436 | } |
| 1437 | if (LocaleCompare("fuzz",option+1) == 0) |
| 1438 | { |
| 1439 | if (*option == '+') |
| 1440 | break; |
| 1441 | i++; |
| 1442 | if (i == (long) (argc-1)) |
| 1443 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1444 | if (IsGeometry(argv[i]) == MagickFalse) |
| 1445 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 1446 | break; |
| 1447 | } |
| 1448 | if (LocaleCompare("fx",option+1) == 0) |
| 1449 | { |
| 1450 | if (*option == '+') |
| 1451 | break; |
| 1452 | i++; |
| 1453 | if (i == (long) (argc-1)) |
| 1454 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1455 | break; |
| 1456 | } |
| 1457 | ThrowConvertException(OptionError,"UnrecognizedOption",option) |
| 1458 | } |
| 1459 | case 'g': |
| 1460 | { |
| 1461 | if (LocaleCompare("gamma",option+1) == 0) |
| 1462 | { |
| 1463 | i++; |
| 1464 | if (i == (long) (argc-1)) |
| 1465 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1466 | if (IsGeometry(argv[i]) == MagickFalse) |
| 1467 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 1468 | break; |
| 1469 | } |
| 1470 | if ((LocaleCompare("gaussian-blur",option+1) == 0) || |
| 1471 | (LocaleCompare("gaussian",option+1) == 0)) |
| 1472 | { |
| 1473 | i++; |
| 1474 | if (i == (long) (argc-1)) |
| 1475 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1476 | if (IsGeometry(argv[i]) == MagickFalse) |
| 1477 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 1478 | break; |
| 1479 | } |
| 1480 | if (LocaleCompare("geometry",option+1) == 0) |
| 1481 | { |
| 1482 | if (*option == '+') |
| 1483 | break; |
| 1484 | i++; |
| 1485 | if (i == (long) (argc-1)) |
| 1486 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1487 | if (IsGeometry(argv[i]) == MagickFalse) |
| 1488 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 1489 | break; |
| 1490 | } |
| 1491 | if (LocaleCompare("gravity",option+1) == 0) |
| 1492 | { |
| 1493 | long |
| 1494 | gravity; |
| 1495 | |
| 1496 | if (*option == '+') |
| 1497 | break; |
| 1498 | i++; |
| 1499 | if (i == (long) (argc-1)) |
| 1500 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1501 | gravity=ParseMagickOption(MagickGravityOptions,MagickFalse, |
| 1502 | argv[i]); |
| 1503 | if (gravity < 0) |
| 1504 | ThrowConvertException(OptionError,"UnrecognizedGravityType", |
| 1505 | argv[i]); |
| 1506 | break; |
| 1507 | } |
| 1508 | if (LocaleCompare("green-primary",option+1) == 0) |
| 1509 | { |
| 1510 | if (*option == '+') |
| 1511 | break; |
| 1512 | i++; |
| 1513 | if (i == (long) (argc-1)) |
| 1514 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1515 | if (IsGeometry(argv[i]) == MagickFalse) |
| 1516 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 1517 | break; |
| 1518 | } |
| 1519 | ThrowConvertException(OptionError,"UnrecognizedOption",option) |
| 1520 | } |
| 1521 | case 'h': |
| 1522 | { |
| 1523 | if (LocaleCompare("hald-clut",option+1) == 0) |
| 1524 | break; |
| 1525 | if ((LocaleCompare("help",option+1) == 0) || |
| 1526 | (LocaleCompare("-help",option+1) == 0)) |
| 1527 | return(ConvertUsage()); |
| 1528 | ThrowConvertException(OptionError,"UnrecognizedOption",option) |
| 1529 | } |
| 1530 | case 'i': |
| 1531 | { |
| 1532 | if (LocaleCompare("identify",option+1) == 0) |
| 1533 | break; |
| 1534 | if (LocaleCompare("ift",option+1) == 0) |
| 1535 | break; |
| 1536 | if (LocaleCompare("implode",option+1) == 0) |
| 1537 | { |
| 1538 | if (*option == '+') |
| 1539 | break; |
| 1540 | i++; |
| 1541 | if (i == (long) (argc-1)) |
| 1542 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1543 | if (IsGeometry(argv[i]) == MagickFalse) |
| 1544 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 1545 | break; |
| 1546 | } |
| 1547 | if (LocaleCompare("insert",option+1) == 0) |
| 1548 | { |
| 1549 | if (*option == '+') |
| 1550 | break; |
| 1551 | i++; |
| 1552 | if (i == (long) (argc-1)) |
| 1553 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1554 | if (IsGeometry(argv[i]) == MagickFalse) |
| 1555 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 1556 | break; |
| 1557 | } |
| 1558 | if (LocaleCompare("intent",option+1) == 0) |
| 1559 | { |
| 1560 | long |
| 1561 | intent; |
| 1562 | |
| 1563 | if (*option == '+') |
| 1564 | break; |
| 1565 | i++; |
| 1566 | if (i == (long) (argc-1)) |
| 1567 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1568 | intent=ParseMagickOption(MagickIntentOptions,MagickFalse, |
| 1569 | argv[i]); |
| 1570 | if (intent < 0) |
| 1571 | ThrowConvertException(OptionError,"UnrecognizedIntentType", |
| 1572 | argv[i]); |
| 1573 | break; |
| 1574 | } |
| 1575 | if (LocaleCompare("interlace",option+1) == 0) |
| 1576 | { |
| 1577 | long |
| 1578 | interlace; |
| 1579 | |
| 1580 | if (*option == '+') |
| 1581 | break; |
| 1582 | i++; |
| 1583 | if (i == (long) (argc-1)) |
| 1584 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1585 | interlace=ParseMagickOption(MagickInterlaceOptions,MagickFalse, |
| 1586 | argv[i]); |
| 1587 | if (interlace < 0) |
| 1588 | ThrowConvertException(OptionError,"UnrecognizedInterlaceType", |
| 1589 | argv[i]); |
| 1590 | break; |
| 1591 | } |
cristy | b32b90a | 2009-09-07 21:45:48 +0000 | [diff] [blame] | 1592 | if (LocaleCompare("interline-spacing",option+1) == 0) |
| 1593 | { |
| 1594 | if (*option == '+') |
| 1595 | break; |
| 1596 | i++; |
| 1597 | if (i == (long) (argc-1)) |
| 1598 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1599 | if (IsGeometry(argv[i]) == MagickFalse) |
| 1600 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 1601 | break; |
| 1602 | } |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1603 | if (LocaleCompare("interpolate",option+1) == 0) |
| 1604 | { |
| 1605 | long |
| 1606 | interpolate; |
| 1607 | |
| 1608 | if (*option == '+') |
| 1609 | break; |
| 1610 | i++; |
| 1611 | if (i == (long) argc) |
| 1612 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1613 | interpolate=ParseMagickOption(MagickInterpolateOptions,MagickFalse, |
| 1614 | argv[i]); |
| 1615 | if (interpolate < 0) |
| 1616 | ThrowConvertException(OptionError,"UnrecognizedInterpolateMethod", |
| 1617 | argv[i]); |
| 1618 | break; |
| 1619 | } |
| 1620 | if (LocaleCompare("interword-spacing",option+1) == 0) |
| 1621 | { |
| 1622 | if (*option == '+') |
| 1623 | break; |
| 1624 | i++; |
| 1625 | if (i == (long) (argc-1)) |
| 1626 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1627 | if (IsGeometry(argv[i]) == MagickFalse) |
| 1628 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 1629 | break; |
| 1630 | } |
| 1631 | ThrowConvertException(OptionError,"UnrecognizedOption",option) |
| 1632 | } |
| 1633 | case 'k': |
| 1634 | { |
| 1635 | if (LocaleCompare("kerning",option+1) == 0) |
| 1636 | { |
| 1637 | if (*option == '+') |
| 1638 | break; |
| 1639 | i++; |
| 1640 | if (i == (long) (argc-1)) |
| 1641 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1642 | if (IsGeometry(argv[i]) == MagickFalse) |
| 1643 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 1644 | break; |
| 1645 | } |
| 1646 | ThrowConvertException(OptionError,"UnrecognizedOption",option) |
| 1647 | } |
| 1648 | case 'l': |
| 1649 | { |
| 1650 | if (LocaleCompare("label",option+1) == 0) |
| 1651 | { |
| 1652 | if (*option == '+') |
| 1653 | break; |
| 1654 | i++; |
| 1655 | if (i == (long) argc) |
| 1656 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1657 | break; |
| 1658 | } |
| 1659 | if (LocaleCompare("lat",option+1) == 0) |
| 1660 | { |
| 1661 | if (*option == '+') |
| 1662 | break; |
| 1663 | i++; |
| 1664 | if (i == (long) (argc-1)) |
| 1665 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1666 | if (IsGeometry(argv[i]) == MagickFalse) |
| 1667 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 1668 | break; |
| 1669 | } |
| 1670 | if (LocaleCompare("layers",option+1) == 0) |
| 1671 | { |
| 1672 | long |
| 1673 | type; |
| 1674 | |
| 1675 | if (*option == '+') |
| 1676 | break; |
| 1677 | i++; |
| 1678 | if (i == (long) (argc-1)) |
| 1679 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1680 | type=ParseMagickOption(MagickLayerOptions,MagickFalse,argv[i]); |
| 1681 | if (type < 0) |
| 1682 | ThrowConvertException(OptionError,"UnrecognizedLayerMethod", |
| 1683 | argv[i]); |
| 1684 | break; |
| 1685 | } |
| 1686 | if (LocaleCompare("level",option+1) == 0) |
| 1687 | { |
| 1688 | i++; |
| 1689 | if (i == (long) (argc-1)) |
| 1690 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1691 | if (IsGeometry(argv[i]) == MagickFalse) |
| 1692 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 1693 | break; |
| 1694 | } |
| 1695 | if (LocaleCompare("level-colors",option+1) == 0) |
| 1696 | { |
| 1697 | i++; |
| 1698 | if (i == (long) (argc-1)) |
| 1699 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1700 | break; |
| 1701 | } |
| 1702 | if (LocaleCompare("linewidth",option+1) == 0) |
| 1703 | { |
| 1704 | if (*option == '+') |
| 1705 | break; |
| 1706 | i++; |
| 1707 | if (i == (long) (argc-1)) |
| 1708 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1709 | if (IsGeometry(argv[i]) == MagickFalse) |
| 1710 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 1711 | break; |
| 1712 | } |
| 1713 | if (LocaleCompare("liquid-rescale",option+1) == 0) |
| 1714 | { |
| 1715 | i++; |
| 1716 | if (i == (long) (argc-1)) |
| 1717 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1718 | if (IsGeometry(argv[i]) == MagickFalse) |
| 1719 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 1720 | break; |
| 1721 | } |
| 1722 | if (LocaleCompare("limit",option+1) == 0) |
| 1723 | { |
| 1724 | char |
| 1725 | *p; |
| 1726 | |
| 1727 | double |
| 1728 | value; |
| 1729 | |
| 1730 | long |
| 1731 | resource; |
| 1732 | |
| 1733 | if (*option == '+') |
| 1734 | break; |
| 1735 | i++; |
| 1736 | if (i == (long) argc) |
| 1737 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1738 | resource=ParseMagickOption(MagickResourceOptions,MagickFalse, |
| 1739 | argv[i]); |
| 1740 | if (resource < 0) |
| 1741 | ThrowConvertException(OptionError,"UnrecognizedResourceType", |
| 1742 | argv[i]); |
| 1743 | i++; |
| 1744 | if (i == (long) argc) |
| 1745 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1746 | value=strtod(argv[i],&p); |
| 1747 | if ((p == argv[i]) && (LocaleCompare("unlimited",argv[i]) != 0)) |
| 1748 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 1749 | break; |
| 1750 | } |
| 1751 | if (LocaleCompare("linear-stretch",option+1) == 0) |
| 1752 | { |
| 1753 | i++; |
| 1754 | if (i == (long) (argc-1)) |
| 1755 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1756 | if (IsGeometry(argv[i]) == MagickFalse) |
| 1757 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 1758 | break; |
| 1759 | } |
| 1760 | if (LocaleCompare("list",option+1) == 0) |
| 1761 | { |
| 1762 | long |
| 1763 | list; |
| 1764 | |
| 1765 | if (*option == '+') |
| 1766 | break; |
| 1767 | i++; |
| 1768 | if (i == (long) argc) |
| 1769 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1770 | list=ParseMagickOption(MagickListOptions,MagickFalse,argv[i]); |
| 1771 | if (list < 0) |
| 1772 | ThrowConvertException(OptionError,"UnrecognizedListType",argv[i]); |
| 1773 | (void) MogrifyImageInfo(image_info,(int) (i-j+1),(const char **) |
| 1774 | argv+j,exception); |
| 1775 | DestroyConvert(); |
| 1776 | return(MagickTrue); |
| 1777 | } |
| 1778 | if (LocaleCompare("log",option+1) == 0) |
| 1779 | { |
| 1780 | if (*option == '+') |
| 1781 | break; |
| 1782 | i++; |
| 1783 | if ((i == (long) argc) || |
| 1784 | (strchr(argv[i],'%') == (char *) NULL)) |
| 1785 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1786 | break; |
| 1787 | } |
| 1788 | if (LocaleCompare("loop",option+1) == 0) |
| 1789 | { |
| 1790 | if (*option == '+') |
| 1791 | break; |
| 1792 | i++; |
| 1793 | if (i == (long) (argc-1)) |
| 1794 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1795 | if (IsGeometry(argv[i]) == MagickFalse) |
| 1796 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 1797 | break; |
| 1798 | } |
| 1799 | ThrowConvertException(OptionError,"UnrecognizedOption",option) |
| 1800 | } |
| 1801 | case 'm': |
| 1802 | { |
| 1803 | if (LocaleCompare("map",option+1) == 0) |
| 1804 | { |
| 1805 | if (*option == '+') |
| 1806 | break; |
| 1807 | i++; |
| 1808 | if (i == (long) (argc-1)) |
| 1809 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1810 | break; |
| 1811 | } |
| 1812 | if (LocaleCompare("mask",option+1) == 0) |
| 1813 | { |
| 1814 | if (*option == '+') |
| 1815 | break; |
| 1816 | i++; |
| 1817 | if (i == (long) (argc-1)) |
| 1818 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1819 | break; |
| 1820 | } |
| 1821 | if (LocaleCompare("matte",option+1) == 0) |
| 1822 | break; |
| 1823 | if (LocaleCompare("mattecolor",option+1) == 0) |
| 1824 | { |
| 1825 | if (*option == '+') |
| 1826 | break; |
| 1827 | i++; |
| 1828 | if (i == (long) (argc-1)) |
| 1829 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1830 | break; |
| 1831 | } |
| 1832 | if (LocaleCompare("median",option+1) == 0) |
| 1833 | { |
| 1834 | if (*option == '+') |
| 1835 | break; |
| 1836 | i++; |
| 1837 | if (i == (long) (argc-1)) |
| 1838 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1839 | if (IsGeometry(argv[i]) == MagickFalse) |
| 1840 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 1841 | break; |
| 1842 | } |
| 1843 | if (LocaleCompare("modulate",option+1) == 0) |
| 1844 | { |
| 1845 | if (*option == '+') |
| 1846 | break; |
| 1847 | i++; |
| 1848 | if (i == (long) (argc-1)) |
| 1849 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1850 | if (IsGeometry(argv[i]) == MagickFalse) |
| 1851 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 1852 | break; |
| 1853 | } |
| 1854 | if (LocaleCompare("monitor",option+1) == 0) |
| 1855 | break; |
| 1856 | if (LocaleCompare("monochrome",option+1) == 0) |
| 1857 | break; |
| 1858 | if (LocaleCompare("morph",option+1) == 0) |
| 1859 | { |
| 1860 | if (*option == '+') |
| 1861 | break; |
| 1862 | i++; |
| 1863 | if (i == (long) (argc-1)) |
| 1864 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1865 | if (IsGeometry(argv[i]) == MagickFalse) |
| 1866 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 1867 | break; |
| 1868 | } |
| 1869 | if (LocaleCompare("mosaic",option+1) == 0) |
| 1870 | break; |
| 1871 | if (LocaleCompare("motion-blur",option+1) == 0) |
| 1872 | { |
| 1873 | if (*option == '+') |
| 1874 | break; |
| 1875 | i++; |
| 1876 | if (i == (long) (argc-1)) |
| 1877 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1878 | if (IsGeometry(argv[i]) == MagickFalse) |
| 1879 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 1880 | break; |
| 1881 | } |
| 1882 | ThrowConvertException(OptionError,"UnrecognizedOption",option) |
| 1883 | } |
| 1884 | case 'n': |
| 1885 | { |
| 1886 | if (LocaleCompare("negate",option+1) == 0) |
| 1887 | break; |
| 1888 | if (LocaleCompare("noise",option+1) == 0) |
| 1889 | { |
| 1890 | i++; |
| 1891 | if (i == (long) (argc-1)) |
| 1892 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1893 | if (*option == '+') |
| 1894 | { |
| 1895 | long |
| 1896 | noise; |
| 1897 | |
| 1898 | noise=ParseMagickOption(MagickNoiseOptions,MagickFalse,argv[i]); |
| 1899 | if (noise < 0) |
| 1900 | ThrowConvertException(OptionError,"UnrecognizedNoiseType", |
| 1901 | argv[i]); |
| 1902 | break; |
| 1903 | } |
| 1904 | if (IsGeometry(argv[i]) == MagickFalse) |
| 1905 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 1906 | break; |
| 1907 | } |
| 1908 | if (LocaleCompare("noop",option+1) == 0) |
| 1909 | break; |
| 1910 | if (LocaleCompare("normalize",option+1) == 0) |
| 1911 | break; |
| 1912 | ThrowConvertException(OptionError,"UnrecognizedOption",option) |
| 1913 | } |
| 1914 | case 'o': |
| 1915 | { |
| 1916 | if (LocaleCompare("opaque",option+1) == 0) |
| 1917 | { |
| 1918 | i++; |
| 1919 | if (i == (long) (argc-1)) |
| 1920 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1921 | break; |
| 1922 | } |
| 1923 | if (LocaleCompare("ordered-dither",option+1) == 0) |
| 1924 | { |
| 1925 | if (*option == '+') |
| 1926 | break; |
| 1927 | i++; |
| 1928 | if (i == (long) (argc-1)) |
| 1929 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1930 | break; |
| 1931 | } |
| 1932 | if (LocaleCompare("orient",option+1) == 0) |
| 1933 | { |
| 1934 | long |
| 1935 | orientation; |
| 1936 | |
| 1937 | if (*option == '+') |
| 1938 | break; |
| 1939 | i++; |
| 1940 | if (i == (long) (argc-1)) |
| 1941 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1942 | orientation=ParseMagickOption(MagickOrientationOptions, |
| 1943 | MagickFalse,argv[i]); |
| 1944 | if (orientation < 0) |
| 1945 | ThrowConvertException(OptionError,"UnrecognizedImageOrientation", |
| 1946 | argv[i]); |
| 1947 | break; |
| 1948 | } |
| 1949 | ThrowConvertException(OptionError,"UnrecognizedOption",argv[i]) |
| 1950 | } |
| 1951 | case 'p': |
| 1952 | { |
| 1953 | if (LocaleCompare("page",option+1) == 0) |
| 1954 | { |
| 1955 | if (*option == '+') |
| 1956 | break; |
| 1957 | i++; |
| 1958 | if (i == (long) argc) |
| 1959 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1960 | break; |
| 1961 | } |
| 1962 | if (LocaleCompare("paint",option+1) == 0) |
| 1963 | { |
| 1964 | if (*option == '+') |
| 1965 | break; |
| 1966 | i++; |
| 1967 | if (i == (long) (argc-1)) |
| 1968 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1969 | if (IsGeometry(argv[i]) == MagickFalse) |
| 1970 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 1971 | break; |
| 1972 | } |
| 1973 | if (LocaleCompare("ping",option+1) == 0) |
| 1974 | break; |
| 1975 | if (LocaleCompare("pointsize",option+1) == 0) |
| 1976 | { |
| 1977 | if (*option == '+') |
| 1978 | break; |
| 1979 | i++; |
| 1980 | if (i == (long) (argc-1)) |
| 1981 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1982 | if (IsGeometry(argv[i]) == MagickFalse) |
| 1983 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 1984 | break; |
| 1985 | } |
| 1986 | if (LocaleCompare("polaroid",option+1) == 0) |
| 1987 | { |
| 1988 | if (*option == '+') |
| 1989 | break; |
| 1990 | i++; |
| 1991 | if (i == (long) (argc-1)) |
| 1992 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 1993 | if (IsGeometry(argv[i]) == MagickFalse) |
| 1994 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 1995 | break; |
| 1996 | } |
| 1997 | if (LocaleCompare("posterize",option+1) == 0) |
| 1998 | { |
| 1999 | if (*option == '+') |
| 2000 | break; |
| 2001 | i++; |
| 2002 | if (i == (long) (argc-1)) |
| 2003 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2004 | if (IsGeometry(argv[i]) == MagickFalse) |
| 2005 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 2006 | break; |
| 2007 | } |
| 2008 | if (LocaleCompare("preview",option+1) == 0) |
| 2009 | { |
| 2010 | long |
| 2011 | preview; |
| 2012 | |
| 2013 | if (*option == '+') |
| 2014 | break; |
| 2015 | i++; |
| 2016 | if (i == (long) (argc-1)) |
| 2017 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2018 | preview=ParseMagickOption(MagickPreviewOptions,MagickFalse, |
| 2019 | argv[i]); |
| 2020 | if (preview < 0) |
| 2021 | ThrowConvertException(OptionError,"UnrecognizedPreviewType", |
| 2022 | argv[i]); |
| 2023 | break; |
| 2024 | } |
| 2025 | if (LocaleCompare("print",option+1) == 0) |
| 2026 | { |
| 2027 | if (*option == '+') |
| 2028 | break; |
| 2029 | i++; |
| 2030 | if (i == (long) (argc-1)) |
| 2031 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2032 | break; |
| 2033 | } |
| 2034 | if (LocaleCompare("process",option+1) == 0) |
| 2035 | { |
| 2036 | if (*option == '+') |
| 2037 | break; |
| 2038 | i++; |
| 2039 | if (i == (long) (argc-1)) |
| 2040 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2041 | break; |
| 2042 | } |
| 2043 | if (LocaleCompare("profile",option+1) == 0) |
| 2044 | { |
| 2045 | i++; |
| 2046 | if (i == (long) (argc-1)) |
| 2047 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2048 | break; |
| 2049 | } |
| 2050 | ThrowConvertException(OptionError,"UnrecognizedOption",option) |
| 2051 | } |
| 2052 | case 'q': |
| 2053 | { |
| 2054 | if (LocaleCompare("quality",option+1) == 0) |
| 2055 | { |
| 2056 | if (*option == '+') |
| 2057 | break; |
| 2058 | i++; |
| 2059 | if (i == (long) (argc-1)) |
| 2060 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2061 | if (IsGeometry(argv[i]) == MagickFalse) |
| 2062 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 2063 | break; |
| 2064 | } |
| 2065 | if (LocaleCompare("quantize",option+1) == 0) |
| 2066 | { |
| 2067 | long |
| 2068 | colorspace; |
| 2069 | |
| 2070 | if (*option == '+') |
| 2071 | break; |
| 2072 | i++; |
| 2073 | if (i == (long) (argc-1)) |
| 2074 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2075 | colorspace=ParseMagickOption(MagickColorspaceOptions, |
| 2076 | MagickFalse,argv[i]); |
| 2077 | if (colorspace < 0) |
| 2078 | ThrowConvertException(OptionError,"UnrecognizedColorspace", |
| 2079 | argv[i]); |
| 2080 | break; |
| 2081 | } |
| 2082 | if (LocaleCompare("quiet",option+1) == 0) |
| 2083 | break; |
| 2084 | ThrowConvertException(OptionError,"UnrecognizedOption",option) |
| 2085 | } |
| 2086 | case 'r': |
| 2087 | { |
| 2088 | if (LocaleCompare("radial-blur",option+1) == 0) |
| 2089 | { |
| 2090 | i++; |
| 2091 | if (i == (long) (argc-1)) |
| 2092 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2093 | if (IsGeometry(argv[i]) == MagickFalse) |
| 2094 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 2095 | break; |
| 2096 | } |
| 2097 | if (LocaleCompare("raise",option+1) == 0) |
| 2098 | { |
| 2099 | i++; |
| 2100 | if (i == (long) (argc-1)) |
| 2101 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2102 | if (IsGeometry(argv[i]) == MagickFalse) |
| 2103 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 2104 | break; |
| 2105 | } |
| 2106 | if (LocaleCompare("random-threshold",option+1) == 0) |
| 2107 | { |
| 2108 | if (*option == '+') |
| 2109 | break; |
| 2110 | i++; |
| 2111 | if (i == (long) (argc-1)) |
| 2112 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2113 | if (IsGeometry(argv[i]) == MagickFalse) |
| 2114 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 2115 | break; |
| 2116 | } |
| 2117 | if (LocaleCompare("recolor",option+1) == 0) |
| 2118 | { |
| 2119 | if (*option == '+') |
| 2120 | break; |
| 2121 | i++; |
| 2122 | if (i == (long) (argc-1)) |
| 2123 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2124 | if (IsGeometry(argv[i]) == MagickFalse) |
| 2125 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 2126 | break; |
| 2127 | } |
| 2128 | if (LocaleCompare("red-primary",option+1) == 0) |
| 2129 | { |
| 2130 | if (*option == '+') |
| 2131 | break; |
| 2132 | i++; |
| 2133 | if (i == (long) (argc-1)) |
| 2134 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2135 | if (IsGeometry(argv[i]) == MagickFalse) |
| 2136 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 2137 | break; |
| 2138 | } |
| 2139 | if (LocaleCompare("regard-warnings",option+1) == 0) |
| 2140 | break; |
| 2141 | if (LocaleCompare("region",option+1) == 0) |
| 2142 | { |
| 2143 | if (*option == '+') |
| 2144 | break; |
| 2145 | i++; |
| 2146 | if (i == (long) (argc-1)) |
| 2147 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2148 | if (IsGeometry(argv[i]) == MagickFalse) |
| 2149 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 2150 | break; |
| 2151 | } |
| 2152 | if (LocaleCompare("remap",option+1) == 0) |
| 2153 | { |
| 2154 | if (*option == '+') |
| 2155 | break; |
| 2156 | i++; |
| 2157 | if (i == (long) (argc-1)) |
| 2158 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2159 | break; |
| 2160 | } |
| 2161 | if (LocaleCompare("render",option+1) == 0) |
| 2162 | break; |
| 2163 | if (LocaleCompare("repage",option+1) == 0) |
| 2164 | { |
| 2165 | if (*option == '+') |
| 2166 | break; |
| 2167 | i++; |
| 2168 | if (i == (long) (argc-1)) |
| 2169 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2170 | if (IsGeometry(argv[i]) == MagickFalse) |
| 2171 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 2172 | break; |
| 2173 | } |
| 2174 | if (LocaleCompare("resample",option+1) == 0) |
| 2175 | { |
| 2176 | if (*option == '+') |
| 2177 | break; |
| 2178 | i++; |
| 2179 | if (i == (long) (argc-1)) |
| 2180 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2181 | if (IsGeometry(argv[i]) == MagickFalse) |
| 2182 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 2183 | break; |
| 2184 | } |
| 2185 | if (LocaleCompare("resize",option+1) == 0) |
| 2186 | { |
| 2187 | if (*option == '+') |
| 2188 | break; |
| 2189 | i++; |
| 2190 | if (i == (long) (argc-1)) |
| 2191 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2192 | if (IsGeometry(argv[i]) == MagickFalse) |
| 2193 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 2194 | break; |
| 2195 | } |
| 2196 | if (LocaleNCompare("respect-parentheses",option+1,17) == 0) |
| 2197 | { |
| 2198 | respect_parenthesis=(*option == '-') ? MagickTrue : MagickFalse; |
| 2199 | break; |
| 2200 | } |
| 2201 | if (LocaleCompare("reverse",option+1) == 0) |
| 2202 | break; |
| 2203 | if (LocaleCompare("roll",option+1) == 0) |
| 2204 | { |
| 2205 | if (*option == '+') |
| 2206 | break; |
| 2207 | i++; |
| 2208 | if (i == (long) (argc-1)) |
| 2209 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2210 | if (IsGeometry(argv[i]) == MagickFalse) |
| 2211 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 2212 | break; |
| 2213 | } |
| 2214 | if (LocaleCompare("rotate",option+1) == 0) |
| 2215 | { |
| 2216 | i++; |
| 2217 | if (i == (long) (argc-1)) |
| 2218 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2219 | if (IsGeometry(argv[i]) == MagickFalse) |
| 2220 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 2221 | break; |
| 2222 | } |
| 2223 | ThrowConvertException(OptionError,"UnrecognizedOption",option) |
| 2224 | } |
| 2225 | case 's': |
| 2226 | { |
| 2227 | if (LocaleCompare("sample",option+1) == 0) |
| 2228 | { |
| 2229 | if (*option == '+') |
| 2230 | break; |
| 2231 | i++; |
| 2232 | if (i == (long) (argc-1)) |
| 2233 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2234 | if (IsGeometry(argv[i]) == MagickFalse) |
| 2235 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 2236 | break; |
| 2237 | } |
| 2238 | if (LocaleCompare("sampling-factor",option+1) == 0) |
| 2239 | { |
| 2240 | if (*option == '+') |
| 2241 | break; |
| 2242 | i++; |
| 2243 | if (i == (long) (argc-1)) |
| 2244 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2245 | if (IsGeometry(argv[i]) == MagickFalse) |
| 2246 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 2247 | break; |
| 2248 | } |
| 2249 | if (LocaleCompare("scale",option+1) == 0) |
| 2250 | { |
| 2251 | if (*option == '+') |
| 2252 | break; |
| 2253 | i++; |
| 2254 | if (i == (long) (argc-1)) |
| 2255 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2256 | if (IsGeometry(argv[i]) == MagickFalse) |
| 2257 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 2258 | break; |
| 2259 | } |
| 2260 | if (LocaleCompare("scene",option+1) == 0) |
| 2261 | { |
| 2262 | if (*option == '+') |
| 2263 | break; |
| 2264 | i++; |
| 2265 | if (i == (long) (argc-1)) |
| 2266 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2267 | if (IsGeometry(argv[i]) == MagickFalse) |
| 2268 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 2269 | break; |
| 2270 | } |
| 2271 | if (LocaleCompare("seed",option+1) == 0) |
| 2272 | { |
| 2273 | if (*option == '+') |
| 2274 | break; |
| 2275 | i++; |
| 2276 | if (i == (long) (argc-1)) |
| 2277 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2278 | if (IsGeometry(argv[i]) == MagickFalse) |
| 2279 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 2280 | break; |
| 2281 | } |
| 2282 | if (LocaleCompare("segment",option+1) == 0) |
| 2283 | { |
| 2284 | if (*option == '+') |
| 2285 | break; |
| 2286 | i++; |
| 2287 | if (i == (long) (argc-1)) |
| 2288 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2289 | if (IsGeometry(argv[i]) == MagickFalse) |
| 2290 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 2291 | break; |
| 2292 | } |
| 2293 | if (LocaleCompare("selective-blur",option+1) == 0) |
| 2294 | { |
| 2295 | i++; |
| 2296 | if (i == (long) (argc-1)) |
| 2297 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2298 | if (IsGeometry(argv[i]) == MagickFalse) |
| 2299 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 2300 | break; |
| 2301 | } |
| 2302 | if (LocaleCompare("separate",option+1) == 0) |
| 2303 | break; |
| 2304 | if (LocaleCompare("sepia-tone",option+1) == 0) |
| 2305 | { |
| 2306 | if (*option == '+') |
| 2307 | break; |
| 2308 | i++; |
| 2309 | if (i == (long) (argc-1)) |
| 2310 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2311 | if (IsGeometry(argv[i]) == MagickFalse) |
| 2312 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 2313 | break; |
| 2314 | } |
| 2315 | if (LocaleCompare("set",option+1) == 0) |
| 2316 | { |
| 2317 | i++; |
| 2318 | if (i == (long) argc) |
| 2319 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2320 | if (*option == '+') |
| 2321 | break; |
| 2322 | i++; |
| 2323 | if (i == (long) argc) |
| 2324 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2325 | break; |
| 2326 | } |
| 2327 | if (LocaleCompare("shade",option+1) == 0) |
| 2328 | { |
| 2329 | i++; |
| 2330 | if (i == (long) (argc-1)) |
| 2331 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2332 | if (IsGeometry(argv[i]) == MagickFalse) |
| 2333 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 2334 | break; |
| 2335 | } |
| 2336 | if (LocaleCompare("shadow",option+1) == 0) |
| 2337 | { |
| 2338 | if (*option == '+') |
| 2339 | break; |
| 2340 | i++; |
| 2341 | if (i == (long) (argc-1)) |
| 2342 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2343 | if (IsGeometry(argv[i]) == MagickFalse) |
| 2344 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 2345 | break; |
| 2346 | } |
| 2347 | if (LocaleCompare("sharpen",option+1) == 0) |
| 2348 | { |
| 2349 | i++; |
| 2350 | if (i == (long) (argc-1)) |
| 2351 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2352 | if (IsGeometry(argv[i]) == MagickFalse) |
| 2353 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 2354 | break; |
| 2355 | } |
| 2356 | if (LocaleCompare("shave",option+1) == 0) |
| 2357 | { |
| 2358 | if (*option == '+') |
| 2359 | break; |
| 2360 | i++; |
| 2361 | if (i == (long) (argc-1)) |
| 2362 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2363 | if (IsGeometry(argv[i]) == MagickFalse) |
| 2364 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 2365 | break; |
| 2366 | } |
| 2367 | if (LocaleCompare("shear",option+1) == 0) |
| 2368 | { |
| 2369 | i++; |
| 2370 | if (i == (long) (argc-1)) |
| 2371 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2372 | if (IsGeometry(argv[i]) == MagickFalse) |
| 2373 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 2374 | break; |
| 2375 | } |
| 2376 | if (LocaleCompare("sigmoidal-contrast",option+1) == 0) |
| 2377 | { |
| 2378 | i++; |
| 2379 | if (i == (long) (argc-1)) |
| 2380 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2381 | if (IsGeometry(argv[i]) == MagickFalse) |
| 2382 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 2383 | break; |
| 2384 | } |
| 2385 | if (LocaleCompare("size",option+1) == 0) |
| 2386 | { |
| 2387 | if (*option == '+') |
| 2388 | break; |
| 2389 | i++; |
| 2390 | if (i == (long) (argc-1)) |
| 2391 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2392 | if (IsGeometry(argv[i]) == MagickFalse) |
| 2393 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 2394 | break; |
| 2395 | } |
| 2396 | if (LocaleCompare("sketch",option+1) == 0) |
| 2397 | { |
| 2398 | if (*option == '+') |
| 2399 | break; |
| 2400 | i++; |
| 2401 | if (i == (long) (argc-1)) |
| 2402 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2403 | if (IsGeometry(argv[i]) == MagickFalse) |
| 2404 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 2405 | break; |
| 2406 | } |
| 2407 | if (LocaleCompare("solarize",option+1) == 0) |
| 2408 | { |
| 2409 | if (*option == '+') |
| 2410 | break; |
| 2411 | i++; |
| 2412 | if (i == (long) (argc-1)) |
| 2413 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2414 | if (IsGeometry(argv[i]) == MagickFalse) |
| 2415 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 2416 | break; |
| 2417 | } |
| 2418 | if (LocaleCompare("sparse-color",option+1) == 0) |
| 2419 | { |
| 2420 | long |
| 2421 | op; |
| 2422 | |
| 2423 | i++; |
| 2424 | if (i == (long) argc) |
| 2425 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2426 | op=ParseMagickOption(MagickSparseColorOptions,MagickFalse,argv[i]); |
| 2427 | if (op < 0) |
| 2428 | ThrowConvertException(OptionError,"UnrecognizedSparseColorMethod", |
| 2429 | argv[i]); |
| 2430 | i++; |
| 2431 | if (i == (long) (argc-1)) |
| 2432 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2433 | break; |
| 2434 | } |
| 2435 | if (LocaleCompare("splice",option+1) == 0) |
| 2436 | { |
| 2437 | if (*option == '+') |
| 2438 | break; |
| 2439 | i++; |
| 2440 | if (i == (long) (argc-1)) |
| 2441 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2442 | if (IsGeometry(argv[i]) == MagickFalse) |
| 2443 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 2444 | break; |
| 2445 | } |
| 2446 | if (LocaleCompare("spread",option+1) == 0) |
| 2447 | { |
| 2448 | if (*option == '+') |
| 2449 | break; |
| 2450 | i++; |
| 2451 | if ((i == (long) (argc-1)) || |
| 2452 | (IsGeometry(argv[i]) == MagickFalse)) |
| 2453 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2454 | break; |
| 2455 | } |
| 2456 | if (LocaleCompare("stretch",option+1) == 0) |
| 2457 | { |
| 2458 | long |
| 2459 | stretch; |
| 2460 | |
| 2461 | if (*option == '+') |
| 2462 | break; |
| 2463 | i++; |
| 2464 | if (i == (long) (argc-1)) |
| 2465 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2466 | stretch=ParseMagickOption(MagickStretchOptions,MagickFalse, |
| 2467 | argv[i]); |
| 2468 | if (stretch < 0) |
| 2469 | ThrowConvertException(OptionError,"UnrecognizedStyleType", |
| 2470 | argv[i]); |
| 2471 | break; |
| 2472 | } |
| 2473 | if (LocaleCompare("strip",option+1) == 0) |
| 2474 | break; |
| 2475 | if (LocaleCompare("stroke",option+1) == 0) |
| 2476 | { |
| 2477 | if (*option == '+') |
| 2478 | break; |
| 2479 | i++; |
| 2480 | if (i == (long) (argc-1)) |
| 2481 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2482 | break; |
| 2483 | } |
| 2484 | if (LocaleCompare("strokewidth",option+1) == 0) |
| 2485 | { |
| 2486 | if (*option == '+') |
| 2487 | break; |
| 2488 | i++; |
| 2489 | if (i == (long) (argc-1)) |
| 2490 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2491 | if (IsGeometry(argv[i]) == MagickFalse) |
| 2492 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 2493 | break; |
| 2494 | } |
| 2495 | if (LocaleCompare("style",option+1) == 0) |
| 2496 | { |
| 2497 | long |
| 2498 | style; |
| 2499 | |
| 2500 | if (*option == '+') |
| 2501 | break; |
| 2502 | i++; |
| 2503 | if (i == (long) (argc-1)) |
| 2504 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2505 | style=ParseMagickOption(MagickStyleOptions,MagickFalse,argv[i]); |
| 2506 | if (style < 0) |
| 2507 | ThrowConvertException(OptionError,"UnrecognizedStyleType", |
| 2508 | argv[i]); |
| 2509 | break; |
| 2510 | } |
| 2511 | if (LocaleCompare("support",option+1) == 0) |
| 2512 | { |
| 2513 | i++; /* deprecated */ |
| 2514 | break; |
| 2515 | } |
| 2516 | if (LocaleCompare("swap",option+1) == 0) |
| 2517 | { |
| 2518 | if (*option == '+') |
| 2519 | break; |
| 2520 | i++; |
| 2521 | if (i == (long) (argc-1)) |
| 2522 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2523 | if (IsGeometry(argv[i]) == MagickFalse) |
| 2524 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 2525 | break; |
| 2526 | } |
| 2527 | if (LocaleCompare("swirl",option+1) == 0) |
| 2528 | { |
| 2529 | if (*option == '+') |
| 2530 | break; |
| 2531 | i++; |
| 2532 | if (i == (long) (argc-1)) |
| 2533 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2534 | if (IsGeometry(argv[i]) == MagickFalse) |
| 2535 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 2536 | break; |
| 2537 | } |
| 2538 | ThrowConvertException(OptionError,"UnrecognizedOption",option) |
| 2539 | } |
| 2540 | case 't': |
| 2541 | { |
| 2542 | if (LocaleCompare("taint",option+1) == 0) |
| 2543 | break; |
| 2544 | if (LocaleCompare("texture",option+1) == 0) |
| 2545 | { |
| 2546 | if (*option == '+') |
| 2547 | break; |
| 2548 | i++; |
| 2549 | if (i == (long) (argc-1)) |
| 2550 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2551 | break; |
| 2552 | } |
| 2553 | if (LocaleCompare("thumbnail",option+1) == 0) |
| 2554 | { |
| 2555 | if (*option == '+') |
| 2556 | break; |
| 2557 | i++; |
| 2558 | if (i == (long) (argc-1)) |
| 2559 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2560 | if (IsGeometry(argv[i]) == MagickFalse) |
| 2561 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 2562 | break; |
| 2563 | } |
| 2564 | if (LocaleCompare("threshold",option+1) == 0) |
| 2565 | { |
| 2566 | if (*option == '+') |
| 2567 | break; |
| 2568 | i++; |
| 2569 | if (i == (long) (argc-1)) |
| 2570 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2571 | if (IsGeometry(argv[i]) == MagickFalse) |
| 2572 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 2573 | break; |
| 2574 | } |
| 2575 | if (LocaleCompare("tile",option+1) == 0) |
| 2576 | { |
| 2577 | if (*option == '+') |
| 2578 | break; |
| 2579 | i++; |
| 2580 | if (i == (long) (argc-1)) |
| 2581 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2582 | break; |
| 2583 | } |
| 2584 | if (LocaleCompare("tile-offset",option+1) == 0) |
| 2585 | { |
| 2586 | if (*option == '+') |
| 2587 | break; |
| 2588 | i++; |
| 2589 | if (i == (long) (argc-1)) |
| 2590 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2591 | if (IsGeometry(argv[i]) == MagickFalse) |
| 2592 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 2593 | break; |
| 2594 | } |
| 2595 | if (LocaleCompare("tint",option+1) == 0) |
| 2596 | { |
| 2597 | if (*option == '+') |
| 2598 | break; |
| 2599 | i++; |
| 2600 | if (i == (long) (argc-1)) |
| 2601 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2602 | if (IsGeometry(argv[i]) == MagickFalse) |
| 2603 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 2604 | break; |
| 2605 | } |
| 2606 | if (LocaleCompare("transform",option+1) == 0) |
| 2607 | break; |
| 2608 | if (LocaleCompare("transparent",option+1) == 0) |
| 2609 | { |
| 2610 | i++; |
| 2611 | if (i == (long) (argc-1)) |
| 2612 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2613 | break; |
| 2614 | } |
| 2615 | if (LocaleCompare("transparent-color",option+1) == 0) |
| 2616 | { |
| 2617 | if (*option == '+') |
| 2618 | break; |
| 2619 | i++; |
| 2620 | if (i == (long) (argc-1)) |
| 2621 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2622 | break; |
| 2623 | } |
| 2624 | if (LocaleCompare("transpose",option+1) == 0) |
| 2625 | break; |
| 2626 | if (LocaleCompare("transverse",option+1) == 0) |
| 2627 | break; |
| 2628 | if (LocaleCompare("treedepth",option+1) == 0) |
| 2629 | { |
| 2630 | if (*option == '+') |
| 2631 | break; |
| 2632 | i++; |
| 2633 | if (i == (long) (argc-1)) |
| 2634 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2635 | if (IsGeometry(argv[i]) == MagickFalse) |
| 2636 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 2637 | break; |
| 2638 | } |
| 2639 | if (LocaleCompare("trim",option+1) == 0) |
| 2640 | break; |
| 2641 | if (LocaleCompare("type",option+1) == 0) |
| 2642 | { |
| 2643 | long |
| 2644 | type; |
| 2645 | |
| 2646 | if (*option == '+') |
| 2647 | break; |
| 2648 | i++; |
| 2649 | if (i == (long) (argc-1)) |
| 2650 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2651 | type=ParseMagickOption(MagickTypeOptions,MagickFalse,argv[i]); |
| 2652 | if (type < 0) |
| 2653 | ThrowConvertException(OptionError,"UnrecognizedImageType", |
| 2654 | argv[i]); |
| 2655 | break; |
| 2656 | } |
| 2657 | ThrowConvertException(OptionError,"UnrecognizedOption",option) |
| 2658 | } |
| 2659 | case 'u': |
| 2660 | { |
| 2661 | if (LocaleCompare("undercolor",option+1) == 0) |
| 2662 | { |
| 2663 | if (*option == '+') |
| 2664 | break; |
| 2665 | i++; |
| 2666 | if (i == (long) (argc-1)) |
| 2667 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2668 | break; |
| 2669 | } |
| 2670 | if (LocaleCompare("unique-colors",option+1) == 0) |
| 2671 | break; |
| 2672 | if (LocaleCompare("units",option+1) == 0) |
| 2673 | { |
| 2674 | long |
| 2675 | units; |
| 2676 | |
| 2677 | if (*option == '+') |
| 2678 | break; |
| 2679 | i++; |
| 2680 | if (i == (long) (argc-1)) |
| 2681 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2682 | units=ParseMagickOption(MagickResolutionOptions,MagickFalse, |
| 2683 | argv[i]); |
| 2684 | if (units < 0) |
| 2685 | ThrowConvertException(OptionError,"UnrecognizedUnitsType", |
| 2686 | argv[i]); |
| 2687 | break; |
| 2688 | } |
| 2689 | if (LocaleCompare("unsharp",option+1) == 0) |
| 2690 | { |
| 2691 | if (*option == '+') |
| 2692 | break; |
| 2693 | i++; |
| 2694 | if (i == (long) (argc-1)) |
| 2695 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2696 | if (IsGeometry(argv[i]) == MagickFalse) |
| 2697 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 2698 | break; |
| 2699 | } |
| 2700 | ThrowConvertException(OptionError,"UnrecognizedOption",option) |
| 2701 | } |
| 2702 | case 'v': |
| 2703 | { |
| 2704 | if (LocaleCompare("verbose",option+1) == 0) |
| 2705 | break; |
| 2706 | if ((LocaleCompare("version",option+1) == 0) || |
| 2707 | (LocaleCompare("-version",option+1) == 0)) |
| 2708 | { |
| 2709 | (void) fprintf(stdout,"Version: %s\n", |
| 2710 | GetMagickVersion((unsigned long *) NULL)); |
| 2711 | (void) fprintf(stdout,"Copyright: %s\n\n",GetMagickCopyright()); |
| 2712 | break; |
| 2713 | } |
| 2714 | if (LocaleCompare("view",option+1) == 0) |
| 2715 | { |
| 2716 | if (*option == '+') |
| 2717 | break; |
| 2718 | i++; |
| 2719 | if (i == (long) (argc-1)) |
| 2720 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2721 | break; |
| 2722 | } |
| 2723 | if (LocaleCompare("vignette",option+1) == 0) |
| 2724 | { |
| 2725 | if (*option == '+') |
| 2726 | break; |
| 2727 | i++; |
| 2728 | if (i == (long) (argc-1)) |
| 2729 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2730 | if (IsGeometry(argv[i]) == MagickFalse) |
| 2731 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 2732 | break; |
| 2733 | } |
| 2734 | if (LocaleCompare("virtual-pixel",option+1) == 0) |
| 2735 | { |
| 2736 | long |
| 2737 | method; |
| 2738 | |
| 2739 | if (*option == '+') |
| 2740 | break; |
| 2741 | i++; |
| 2742 | if (i == (long) (argc-1)) |
| 2743 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2744 | method=ParseMagickOption(MagickVirtualPixelOptions,MagickFalse, |
| 2745 | argv[i]); |
| 2746 | if (method < 0) |
| 2747 | ThrowConvertException(OptionError, |
| 2748 | "UnrecognizedVirtualPixelMethod",argv[i]); |
| 2749 | break; |
| 2750 | } |
| 2751 | ThrowConvertException(OptionError,"UnrecognizedOption",option) |
| 2752 | } |
| 2753 | case 'w': |
| 2754 | { |
| 2755 | if (LocaleCompare("wave",option+1) == 0) |
| 2756 | { |
| 2757 | i++; |
| 2758 | if (i == (long) (argc-1)) |
| 2759 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2760 | if (IsGeometry(argv[i]) == MagickFalse) |
| 2761 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 2762 | break; |
| 2763 | } |
| 2764 | if (LocaleCompare("weight",option+1) == 0) |
| 2765 | { |
| 2766 | if (*option == '+') |
| 2767 | break; |
| 2768 | i++; |
| 2769 | if (i == (long) (argc-1)) |
| 2770 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2771 | break; |
| 2772 | } |
| 2773 | if (LocaleCompare("white-point",option+1) == 0) |
| 2774 | { |
| 2775 | if (*option == '+') |
| 2776 | break; |
| 2777 | i++; |
| 2778 | if (i == (long) (argc-1)) |
| 2779 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2780 | if (IsGeometry(argv[i]) == MagickFalse) |
| 2781 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 2782 | break; |
| 2783 | } |
| 2784 | if (LocaleCompare("white-threshold",option+1) == 0) |
| 2785 | { |
| 2786 | if (*option == '+') |
| 2787 | break; |
| 2788 | i++; |
| 2789 | if (i == (long) (argc-1)) |
| 2790 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2791 | if (IsGeometry(argv[i]) == MagickFalse) |
| 2792 | ThrowConvertInvalidArgumentException(option,argv[i]); |
| 2793 | break; |
| 2794 | } |
| 2795 | if (LocaleCompare("write",option+1) == 0) |
| 2796 | { |
| 2797 | i++; |
| 2798 | if (i == (long) (argc-1)) |
| 2799 | ThrowConvertException(OptionError,"MissingArgument",option); |
| 2800 | break; |
| 2801 | } |
| 2802 | ThrowConvertException(OptionError,"UnrecognizedOption",option) |
| 2803 | } |
| 2804 | case '?': |
| 2805 | break; |
| 2806 | default: |
| 2807 | ThrowConvertException(OptionError,"UnrecognizedOption",option) |
| 2808 | } |
| 2809 | fire=ParseMagickOption(MagickImageListOptions,MagickFalse,option+1) < 0 ? |
| 2810 | MagickFalse : MagickTrue; |
| 2811 | if (fire != MagickFalse) |
| 2812 | FireImageStack(MagickTrue,MagickTrue,MagickTrue); |
| 2813 | } |
| 2814 | if (k != 0) |
| 2815 | ThrowConvertException(OptionError,"UnbalancedParenthesis",argv[i]); |
| 2816 | if (i-- != (long) (argc-1)) |
| 2817 | ThrowConvertException(OptionError,"MissingAnImageFilename",argv[argc-1]); |
| 2818 | if (image == (Image *) NULL) |
| 2819 | ThrowConvertException(OptionError,"MissingAnImageFilename",argv[argc-1]); |
| 2820 | FinalizeImageSettings(image_info,image,MagickTrue); |
cristy | 94f2007 | 2009-09-12 02:12:36 +0000 | [diff] [blame] | 2821 | if (image == (Image *) NULL) |
| 2822 | ThrowConvertException(OptionError,"MissingAnImageFilename",argv[argc-1]); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 2823 | status&=WriteImages(image_info,image,argv[argc-1],exception); |
| 2824 | if (metadata != (char **) NULL) |
| 2825 | { |
| 2826 | char |
| 2827 | *text; |
| 2828 | |
| 2829 | text=InterpretImageProperties(image_info,image,format); |
| 2830 | if (text == (char *) NULL) |
| 2831 | ThrowConvertException(ResourceLimitError,"MemoryAllocationFailed", |
| 2832 | GetExceptionMessage(errno)); |
| 2833 | (void) ConcatenateString(&(*metadata),text); |
| 2834 | text=DestroyString(text); |
| 2835 | } |
| 2836 | DestroyConvert(); |
| 2837 | return(status != 0 ? MagickTrue : MagickFalse); |
| 2838 | } |