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