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