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