| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1 | /* |
| 2 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 3 | % % |
| 4 | % % |
| 5 | % % |
| 6 | % IIIII DDDD EEEEE N N TTTTT IIIII FFFFF Y Y % |
| 7 | % I D D E NN N T I F Y Y % |
| 8 | % I D D EEE N N N T I FFF Y % |
| 9 | % I D D E N NN T I F Y % |
| 10 | % IIIII DDDD EEEEE N N T IIIII F Y % |
| 11 | % % |
| 12 | % % |
| 13 | % Identify an Image Format and Characteristics. % |
| 14 | % % |
| 15 | % Software Design % |
| 16 | % John Cristy % |
| 17 | % September 1994 % |
| 18 | % % |
| 19 | % % |
| cristy | 7e41fe8 | 2010-12-04 23:12:08 +0000 | [diff] [blame] | 20 | % Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization % |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 21 | % dedicated to making software imaging solutions freely available. % |
| 22 | % % |
| 23 | % You may not use this file except in compliance with the License. You may % |
| 24 | % obtain a copy of the License at % |
| 25 | % % |
| 26 | % http://www.imagemagick.org/script/license.php % |
| 27 | % % |
| 28 | % Unless required by applicable law or agreed to in writing, software % |
| 29 | % distributed under the License is distributed on an "AS IS" BASIS, % |
| 30 | % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. % |
| 31 | % See the License for the specific language governing permissions and % |
| 32 | % limitations under the License. % |
| 33 | % % |
| 34 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 35 | % |
| 36 | % The identify program describes the format and characteristics of one or more |
| 37 | % image files. It also reports if an image is incomplete or corrupt. The |
| 38 | % information returned includes the image number, the file name, the width and |
| 39 | % height of the image, whether the image is colormapped or not, the number of |
| 40 | % colors in the image, the number of bytes in the image, the format of the |
| 41 | % image (JPEG, PNM, etc.), and finally the number of seconds it took to read |
| 42 | % and process the image. Many more attributes are available with the verbose |
| 43 | % option. |
| 44 | % |
| 45 | */ |
| 46 | |
| 47 | /* |
| 48 | Include declarations. |
| 49 | */ |
| 50 | #include "wand/studio.h" |
| 51 | #include "wand/MagickWand.h" |
| 52 | #include "wand/mogrify-private.h" |
| 53 | |
| 54 | /* |
| 55 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 56 | % % |
| 57 | % % |
| 58 | % % |
| 59 | + I d e n t i f y I m a g e C o m m a n d % |
| 60 | % % |
| 61 | % % |
| 62 | % % |
| 63 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 64 | % |
| 65 | % IdentifyImageCommand() describes the format and characteristics of one or |
| 66 | % more image files. It will also report if an image is incomplete or corrupt. |
| 67 | % The information displayed includes the scene number, the file name, the |
| 68 | % width and height of the image, whether the image is colormapped or not, |
| 69 | % the number of colors in the image, the number of bytes in the image, the |
| 70 | % format of the image (JPEG, PNM, etc.), and finally the number of seconds |
| 71 | % it took to read and process the image. |
| 72 | % |
| 73 | % The format of the IdentifyImageCommand method is: |
| 74 | % |
| 75 | % MagickBooleanType IdentifyImageCommand(ImageInfo *image_info,int argc, |
| 76 | % char **argv,char **metadata,ExceptionInfo *exception) |
| 77 | % |
| 78 | % A description of each parameter follows: |
| 79 | % |
| 80 | % o image_info: the image info. |
| 81 | % |
| 82 | % o argc: the number of elements in the argument vector. |
| 83 | % |
| 84 | % o argv: A text array containing the command line arguments. |
| 85 | % |
| 86 | % o metadata: any metadata is returned here. |
| 87 | % |
| 88 | % o exception: return any errors or warnings in this structure. |
| 89 | % |
| 90 | */ |
| 91 | |
| 92 | static MagickBooleanType IdentifyUsage(void) |
| 93 | { |
| 94 | const char |
| 95 | **p; |
| 96 | |
| 97 | static const char |
| 98 | *miscellaneous[]= |
| 99 | { |
| 100 | "-debug events display copious debugging information", |
| 101 | "-help print program options", |
| 102 | "-list type print a list of supported option arguments", |
| 103 | "-log format format of debugging information", |
| 104 | "-version print version information", |
| 105 | (char *) NULL |
| 106 | }, |
| cristy | e48c6a9 | 2010-02-01 01:25:42 +0000 | [diff] [blame] | 107 | *operators[]= |
| 108 | { |
| 109 | "-negate replace every pixel with its complementary color ", |
| 110 | (char *) NULL |
| 111 | }, |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 112 | *settings[]= |
| 113 | { |
| 114 | "-alpha option on, activate, off, deactivate, set, opaque, copy", |
| 115 | " transparent, extract, background, or shape", |
| 116 | "-antialias remove pixel-aliasing", |
| 117 | "-authenticate password", |
| 118 | " decipher image with this password", |
| 119 | "-channel type apply option to select image channels", |
| 120 | "-colorspace type alternate image colorspace", |
| 121 | "-crop geometry cut out a rectangular region of the image", |
| 122 | "-define format:option", |
| 123 | " define one or more image format options", |
| 124 | "-density geometry horizontal and vertical density of the image", |
| 125 | "-depth value image depth", |
| 126 | "-extract geometry extract area from image", |
| cristy | 02d5b4f | 2010-02-01 01:08:27 +0000 | [diff] [blame] | 127 | "-features distance display image features (e.g. contrast, correlation)", |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 128 | "-format \"string\" output formatted image characteristics", |
| 129 | "-fuzz distance colors within this distance are considered equal", |
| cristy | cd483f1 | 2010-01-26 15:30:08 +0000 | [diff] [blame] | 130 | "-gamma value of gamma correction", |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 131 | "-interlace type type of image interlacing scheme", |
| 132 | "-interpolate method pixel color interpolation method", |
| 133 | "-limit type value pixel cache resource limit", |
| 134 | "-monitor monitor progress", |
| 135 | "-ping efficiently determine image attributes", |
| 136 | "-quiet suppress all warning messages", |
| 137 | "-regard-warnings pay attention to warning messages", |
| 138 | "-respect-parentheses settings remain in effect until parenthesis boundary", |
| 139 | "-sampling-factor geometry", |
| 140 | " horizontal and vertical sampling factor", |
| 141 | "-seed value seed a new sequence of pseudo-random numbers", |
| 142 | "-set attribute value set an image attribute", |
| 143 | "-size geometry width and height of image", |
| 144 | "-strip strip image of all profiles and comments", |
| cristy | 045bd90 | 2010-01-30 18:56:24 +0000 | [diff] [blame] | 145 | "-unique display the number of unique colors in the image", |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 146 | "-units type the units of image resolution", |
| 147 | "-verbose print detailed information about the image", |
| 148 | "-virtual-pixel method", |
| 149 | " virtual pixel access method", |
| 150 | (char *) NULL |
| 151 | }; |
| 152 | |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 153 | (void) printf("Version: %s\n",GetMagickVersion((size_t *) NULL)); |
| cristy | 610b2e2 | 2009-10-22 14:59:43 +0000 | [diff] [blame] | 154 | (void) printf("Copyright: %s\n",GetMagickCopyright()); |
| 155 | (void) printf("Features: %s\n\n",GetMagickFeatures()); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 156 | (void) printf("Usage: %s [options ...] file [ [options ...] " |
| 157 | "file ... ]\n",GetClientName()); |
| 158 | (void) printf("\nImage Settings:\n"); |
| 159 | for (p=settings; *p != (char *) NULL; p++) |
| 160 | (void) printf(" %s\n",*p); |
| cristy | e48c6a9 | 2010-02-01 01:25:42 +0000 | [diff] [blame] | 161 | (void) printf("\nImage Operators:\n"); |
| 162 | for (p=operators; *p != (char *) NULL; p++) |
| 163 | (void) printf(" %s\n",*p); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 164 | (void) printf("\nMiscellaneous Options:\n"); |
| 165 | for (p=miscellaneous; *p != (char *) NULL; p++) |
| 166 | (void) printf(" %s\n",*p); |
| 167 | (void) printf( |
| 168 | "\nBy default, the image format of `file' is determined by its magic\n"); |
| 169 | (void) printf( |
| 170 | "number. To specify a particular image format, precede the filename\n"); |
| 171 | (void) printf( |
| 172 | "with an image format name and a colon (i.e. ps:image) or specify the\n"); |
| 173 | (void) printf( |
| 174 | "image type as the filename suffix (i.e. image.ps). Specify 'file' as\n"); |
| 175 | (void) printf("'-' for standard input or output.\n"); |
| 176 | return(MagickFalse); |
| 177 | } |
| 178 | |
| 179 | WandExport MagickBooleanType IdentifyImageCommand(ImageInfo *image_info, |
| 180 | int argc,char **argv,char **metadata,ExceptionInfo *exception) |
| 181 | { |
| 182 | #define DestroyIdentify() \ |
| 183 | { \ |
| 184 | DestroyImageStack(); \ |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 185 | for (i=0; i < (ssize_t) argc; i++) \ |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 186 | argv[i]=DestroyString(argv[i]); \ |
| 187 | argv=(char **) RelinquishMagickMemory(argv); \ |
| 188 | } |
| 189 | #define ThrowIdentifyException(asperity,tag,option) \ |
| 190 | { \ |
| 191 | (void) ThrowMagickException(exception,GetMagickModule(),asperity,tag,"`%s'", \ |
| 192 | option); \ |
| 193 | DestroyIdentify(); \ |
| 194 | return(MagickFalse); \ |
| 195 | } |
| 196 | #define ThrowIdentifyInvalidArgumentException(option,argument) \ |
| 197 | { \ |
| 198 | (void) ThrowMagickException(exception,GetMagickModule(),OptionError, \ |
| 199 | "InvalidArgument","`%s': %s",option,argument); \ |
| 200 | DestroyIdentify(); \ |
| 201 | return(MagickFalse); \ |
| 202 | } |
| 203 | |
| 204 | const char |
| 205 | *format, |
| 206 | *option; |
| 207 | |
| 208 | Image |
| 209 | *image; |
| 210 | |
| 211 | ImageStack |
| 212 | image_stack[MaxImageStackDepth+1]; |
| 213 | |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 214 | MagickBooleanType |
| 215 | fire, |
| cristy | ebbcfea | 2011-02-25 02:43:54 +0000 | [diff] [blame] | 216 | pend, |
| 217 | respect_parenthesis; |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 218 | |
| 219 | MagickStatusType |
| 220 | status; |
| 221 | |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 222 | register ssize_t |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 223 | i; |
| 224 | |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 225 | size_t |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 226 | count; |
| 227 | |
| cristy | 9d314ff | 2011-03-09 01:30:28 +0000 | [diff] [blame] | 228 | ssize_t |
| 229 | j, |
| 230 | k; |
| 231 | |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 232 | /* |
| 233 | Set defaults. |
| 234 | */ |
| 235 | assert(image_info != (ImageInfo *) NULL); |
| 236 | assert(image_info->signature == MagickSignature); |
| 237 | if (image_info->debug != MagickFalse) |
| 238 | (void) LogMagickEvent(TraceEvent,GetMagickModule(),"..."); |
| 239 | assert(exception != (ExceptionInfo *) NULL); |
| 240 | if (argc == 2) |
| 241 | { |
| 242 | option=argv[1]; |
| 243 | if ((LocaleCompare("version",option+1) == 0) || |
| 244 | (LocaleCompare("-version",option+1) == 0)) |
| 245 | { |
| cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame^] | 246 | (void) FormatLocaleFile(stdout,"Version: %s\n", |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 247 | GetMagickVersion((size_t *) NULL)); |
| cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame^] | 248 | (void) FormatLocaleFile(stdout,"Copyright: %s\n",GetMagickCopyright()); |
| 249 | (void) FormatLocaleFile(stdout,"Features: %s\n\n",GetMagickFeatures()); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 250 | return(MagickFalse); |
| 251 | } |
| 252 | } |
| 253 | if (argc < 2) |
| cristy | 13e61a1 | 2010-02-04 20:19:00 +0000 | [diff] [blame] | 254 | return(IdentifyUsage()); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 255 | count=0; |
| 256 | format=NULL; |
| 257 | j=1; |
| 258 | k=0; |
| 259 | NewImageStack(); |
| 260 | option=(char *) NULL; |
| 261 | pend=MagickFalse; |
| cristy | ebbcfea | 2011-02-25 02:43:54 +0000 | [diff] [blame] | 262 | respect_parenthesis=MagickFalse; |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 263 | status=MagickTrue; |
| 264 | /* |
| 265 | Identify an image. |
| 266 | */ |
| 267 | ReadCommandlLine(argc,&argv); |
| 268 | status=ExpandFilenames(&argc,&argv); |
| 269 | if (status == MagickFalse) |
| 270 | ThrowIdentifyException(ResourceLimitError,"MemoryAllocationFailed", |
| 271 | GetExceptionMessage(errno)); |
| 272 | image_info->ping=MagickTrue; |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 273 | for (i=1; i < (ssize_t) argc; i++) |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 274 | { |
| 275 | option=argv[i]; |
| 276 | if (LocaleCompare(option,"(") == 0) |
| 277 | { |
| 278 | FireImageStack(MagickFalse,MagickTrue,pend); |
| 279 | if (k == MaxImageStackDepth) |
| 280 | ThrowIdentifyException(OptionError,"ParenthesisNestedTooDeeply", |
| 281 | option); |
| 282 | PushImageStack(); |
| 283 | continue; |
| 284 | } |
| 285 | if (LocaleCompare(option,")") == 0) |
| 286 | { |
| 287 | FireImageStack(MagickFalse,MagickTrue,MagickTrue); |
| 288 | if (k == 0) |
| 289 | ThrowIdentifyException(OptionError,"UnableToParseExpression",option); |
| 290 | PopImageStack(); |
| 291 | continue; |
| 292 | } |
| cristy | 042ee78 | 2011-04-22 18:48:30 +0000 | [diff] [blame] | 293 | if (IsCommandOption(option) == MagickFalse) |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 294 | { |
| 295 | char |
| 296 | *filename; |
| 297 | |
| 298 | Image |
| 299 | *images; |
| 300 | |
| 301 | ImageInfo |
| 302 | *identify_info; |
| 303 | |
| 304 | /* |
| 305 | Read input image. |
| 306 | */ |
| 307 | FireImageStack(MagickFalse,MagickFalse,pend); |
| 308 | identify_info=CloneImageInfo(image_info); |
| 309 | identify_info->verbose=MagickFalse; |
| 310 | filename=argv[i]; |
| cristy | cee9711 | 2010-05-28 00:44:52 +0000 | [diff] [blame] | 311 | if ((LocaleCompare(filename,"--") == 0) && (i < (ssize_t) (argc-1))) |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 312 | filename=argv[++i]; |
| 313 | (void) CopyMagickString(identify_info->filename,filename,MaxTextExtent); |
| 314 | if (identify_info->ping != MagickFalse) |
| 315 | images=PingImages(identify_info,exception); |
| 316 | else |
| 317 | images=ReadImages(identify_info,exception); |
| 318 | identify_info=DestroyImageInfo(identify_info); |
| 319 | status&=(images != (Image *) NULL) && |
| 320 | (exception->severity < ErrorException); |
| 321 | if (images == (Image *) NULL) |
| 322 | continue; |
| 323 | AppendImageStack(images); |
| 324 | FinalizeImageSettings(image_info,image,MagickFalse); |
| 325 | for ( ; image != (Image *) NULL; image=GetNextImageInList(image)) |
| 326 | { |
| 327 | if (image->scene == 0) |
| 328 | image->scene=count++; |
| 329 | if (format == (char *) NULL) |
| 330 | { |
| 331 | (void) IdentifyImage(image,stdout,image_info->verbose); |
| 332 | continue; |
| 333 | } |
| 334 | if (metadata != (char **) NULL) |
| 335 | { |
| 336 | char |
| 337 | *text; |
| 338 | |
| 339 | text=InterpretImageProperties(image_info,image,format); |
| 340 | if (text == (char *) NULL) |
| 341 | ThrowIdentifyException(ResourceLimitError, |
| 342 | "MemoryAllocationFailed",GetExceptionMessage(errno)); |
| 343 | (void) ConcatenateString(&(*metadata),text); |
| 344 | text=DestroyString(text); |
| 345 | if (LocaleCompare(format,"%n") == 0) |
| 346 | break; |
| 347 | } |
| 348 | } |
| 349 | RemoveAllImageStack(); |
| 350 | continue; |
| 351 | } |
| 352 | pend=image != (Image *) NULL ? MagickTrue : MagickFalse; |
| 353 | switch (*(option+1)) |
| 354 | { |
| 355 | case 'a': |
| 356 | { |
| 357 | if (LocaleCompare("alpha",option+1) == 0) |
| 358 | { |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 359 | ssize_t |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 360 | type; |
| 361 | |
| 362 | if (*option == '+') |
| 363 | break; |
| 364 | i++; |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 365 | if (i == (ssize_t) argc) |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 366 | ThrowIdentifyException(OptionError,"MissingArgument",option); |
| cristy | 042ee78 | 2011-04-22 18:48:30 +0000 | [diff] [blame] | 367 | type=ParseCommandOption(MagickAlphaOptions,MagickFalse,argv[i]); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 368 | if (type < 0) |
| 369 | ThrowIdentifyException(OptionError,"UnrecognizedAlphaChannelType", |
| 370 | argv[i]); |
| 371 | break; |
| 372 | } |
| 373 | if (LocaleCompare("antialias",option+1) == 0) |
| 374 | break; |
| 375 | if (LocaleCompare("authenticate",option+1) == 0) |
| 376 | { |
| 377 | if (*option == '+') |
| 378 | break; |
| 379 | i++; |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 380 | if (i == (ssize_t) (argc-1)) |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 381 | ThrowIdentifyException(OptionError,"MissingArgument",option); |
| 382 | break; |
| 383 | } |
| 384 | ThrowIdentifyException(OptionError,"UnrecognizedOption",option) |
| 385 | } |
| 386 | case 'c': |
| 387 | { |
| 388 | if (LocaleCompare("cache",option+1) == 0) |
| 389 | { |
| 390 | if (*option == '+') |
| 391 | break; |
| 392 | i++; |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 393 | if (i == (ssize_t) argc) |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 394 | ThrowIdentifyException(OptionError,"MissingArgument",option); |
| 395 | if (IsGeometry(argv[i]) == MagickFalse) |
| 396 | ThrowIdentifyInvalidArgumentException(option,argv[i]); |
| 397 | break; |
| 398 | } |
| 399 | if (LocaleCompare("channel",option+1) == 0) |
| 400 | { |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 401 | ssize_t |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 402 | channel; |
| 403 | |
| 404 | if (*option == '+') |
| 405 | break; |
| 406 | i++; |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 407 | if (i == (ssize_t) (argc-1)) |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 408 | ThrowIdentifyException(OptionError,"MissingArgument",option); |
| 409 | channel=ParseChannelOption(argv[i]); |
| 410 | if (channel < 0) |
| 411 | ThrowIdentifyException(OptionError,"UnrecognizedChannelType", |
| 412 | argv[i]); |
| 413 | break; |
| 414 | } |
| 415 | if (LocaleCompare("colorspace",option+1) == 0) |
| 416 | { |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 417 | ssize_t |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 418 | colorspace; |
| 419 | |
| 420 | if (*option == '+') |
| 421 | break; |
| 422 | i++; |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 423 | if (i == (ssize_t) (argc-1)) |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 424 | ThrowIdentifyException(OptionError,"MissingArgument",option); |
| cristy | 042ee78 | 2011-04-22 18:48:30 +0000 | [diff] [blame] | 425 | colorspace=ParseCommandOption(MagickColorspaceOptions, |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 426 | MagickFalse,argv[i]); |
| 427 | if (colorspace < 0) |
| 428 | ThrowIdentifyException(OptionError,"UnrecognizedColorspace", |
| 429 | argv[i]); |
| 430 | break; |
| 431 | } |
| 432 | if (LocaleCompare("crop",option+1) == 0) |
| 433 | { |
| 434 | if (*option == '+') |
| 435 | break; |
| 436 | i++; |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 437 | if (i == (ssize_t) (argc-1)) |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 438 | ThrowIdentifyException(OptionError,"MissingArgument",option); |
| 439 | if (IsGeometry(argv[i]) == MagickFalse) |
| 440 | ThrowIdentifyInvalidArgumentException(option,argv[i]); |
| 441 | image_info->ping=MagickFalse; |
| 442 | break; |
| 443 | } |
| cristy | 2287975 | 2009-10-25 23:55:40 +0000 | [diff] [blame] | 444 | if (LocaleCompare("concurrent",option+1) == 0) |
| 445 | break; |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 446 | ThrowIdentifyException(OptionError,"UnrecognizedOption",option) |
| 447 | } |
| 448 | case 'd': |
| 449 | { |
| 450 | if (LocaleCompare("debug",option+1) == 0) |
| 451 | { |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 452 | ssize_t |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 453 | event; |
| 454 | |
| 455 | if (*option == '+') |
| 456 | break; |
| 457 | i++; |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 458 | if (i == (ssize_t) argc) |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 459 | ThrowIdentifyException(OptionError,"MissingArgument",option); |
| cristy | 042ee78 | 2011-04-22 18:48:30 +0000 | [diff] [blame] | 460 | event=ParseCommandOption(MagickLogEventOptions,MagickFalse,argv[i]); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 461 | if (event < 0) |
| 462 | ThrowIdentifyException(OptionError,"UnrecognizedEventType", |
| 463 | argv[i]); |
| 464 | (void) SetLogEventMask(argv[i]); |
| 465 | break; |
| 466 | } |
| 467 | if (LocaleCompare("define",option+1) == 0) |
| 468 | { |
| 469 | i++; |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 470 | if (i == (ssize_t) argc) |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 471 | ThrowIdentifyException(OptionError,"MissingArgument",option); |
| 472 | if (*option == '+') |
| 473 | { |
| 474 | const char |
| 475 | *define; |
| 476 | |
| 477 | define=GetImageOption(image_info,argv[i]); |
| 478 | if (define == (const char *) NULL) |
| 479 | ThrowIdentifyException(OptionError,"NoSuchOption",argv[i]); |
| 480 | break; |
| 481 | } |
| 482 | break; |
| 483 | } |
| 484 | if (LocaleCompare("density",option+1) == 0) |
| 485 | { |
| 486 | if (*option == '+') |
| 487 | break; |
| 488 | i++; |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 489 | if (i == (ssize_t) argc) |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 490 | ThrowIdentifyException(OptionError,"MissingArgument",option); |
| 491 | if (IsGeometry(argv[i]) == MagickFalse) |
| 492 | ThrowIdentifyInvalidArgumentException(option,argv[i]); |
| 493 | break; |
| 494 | } |
| 495 | if (LocaleCompare("depth",option+1) == 0) |
| 496 | { |
| 497 | if (*option == '+') |
| 498 | break; |
| 499 | i++; |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 500 | if (i == (ssize_t) argc) |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 501 | ThrowIdentifyException(OptionError,"MissingArgument",option); |
| 502 | if (IsGeometry(argv[i]) == MagickFalse) |
| 503 | ThrowIdentifyInvalidArgumentException(option,argv[i]); |
| 504 | break; |
| 505 | } |
| cristy | 2287975 | 2009-10-25 23:55:40 +0000 | [diff] [blame] | 506 | if (LocaleCompare("duration",option+1) == 0) |
| 507 | { |
| 508 | if (*option == '+') |
| 509 | break; |
| 510 | i++; |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 511 | if (i == (ssize_t) (argc-1)) |
| cristy | 2287975 | 2009-10-25 23:55:40 +0000 | [diff] [blame] | 512 | ThrowIdentifyException(OptionError,"MissingArgument",option); |
| 513 | if (IsGeometry(argv[i]) == MagickFalse) |
| 514 | ThrowIdentifyInvalidArgumentException(option,argv[i]); |
| 515 | break; |
| 516 | } |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 517 | ThrowIdentifyException(OptionError,"UnrecognizedOption",option) |
| 518 | } |
| 519 | case 'f': |
| 520 | { |
| cristy | 549a37e | 2010-01-26 15:24:15 +0000 | [diff] [blame] | 521 | if (LocaleCompare("features",option+1) == 0) |
| cristy | cd483f1 | 2010-01-26 15:30:08 +0000 | [diff] [blame] | 522 | { |
| 523 | if (*option == '+') |
| 524 | break; |
| 525 | i++; |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 526 | if (i == (ssize_t) (argc-1)) |
| cristy | cd483f1 | 2010-01-26 15:30:08 +0000 | [diff] [blame] | 527 | ThrowIdentifyException(OptionError,"MissingArgument",option); |
| 528 | if (IsGeometry(argv[i]) == MagickFalse) |
| 529 | ThrowIdentifyInvalidArgumentException(option,argv[i]); |
| 530 | break; |
| 531 | } |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 532 | if (LocaleCompare("format",option+1) == 0) |
| 533 | { |
| 534 | format=(char *) NULL; |
| 535 | if (*option == '+') |
| 536 | break; |
| 537 | i++; |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 538 | if (i == (ssize_t) argc) |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 539 | ThrowIdentifyException(OptionError,"MissingArgument",option); |
| 540 | format=argv[i]; |
| 541 | break; |
| 542 | } |
| 543 | if (LocaleCompare("fuzz",option+1) == 0) |
| 544 | { |
| 545 | if (*option == '+') |
| 546 | break; |
| 547 | i++; |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 548 | if (i == (ssize_t) (argc-1)) |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 549 | ThrowIdentifyException(OptionError,"MissingArgument",option); |
| 550 | if (IsGeometry(argv[i]) == MagickFalse) |
| 551 | ThrowIdentifyInvalidArgumentException(option,argv[i]); |
| 552 | break; |
| 553 | } |
| 554 | ThrowIdentifyException(OptionError,"UnrecognizedOption",option) |
| 555 | } |
| 556 | case 'g': |
| 557 | { |
| 558 | if (LocaleCompare("gamma",option+1) == 0) |
| 559 | { |
| 560 | i++; |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 561 | if (i == (ssize_t) (argc-1)) |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 562 | ThrowIdentifyException(OptionError,"MissingArgument",option); |
| 563 | if (IsGeometry(argv[i]) == MagickFalse) |
| 564 | ThrowIdentifyInvalidArgumentException(option,argv[i]); |
| 565 | break; |
| 566 | } |
| 567 | ThrowIdentifyException(OptionError,"UnrecognizedOption",option) |
| 568 | } |
| 569 | case 'h': |
| 570 | { |
| 571 | if ((LocaleCompare("help",option+1) == 0) || |
| 572 | (LocaleCompare("-help",option+1) == 0)) |
| 573 | return(IdentifyUsage()); |
| 574 | ThrowIdentifyException(OptionError,"UnrecognizedOption",option) |
| 575 | } |
| 576 | case 'i': |
| 577 | { |
| 578 | if (LocaleCompare("interlace",option+1) == 0) |
| 579 | { |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 580 | ssize_t |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 581 | interlace; |
| 582 | |
| 583 | if (*option == '+') |
| 584 | break; |
| 585 | i++; |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 586 | if (i == (ssize_t) argc) |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 587 | ThrowIdentifyException(OptionError,"MissingArgument",option); |
| cristy | 042ee78 | 2011-04-22 18:48:30 +0000 | [diff] [blame] | 588 | interlace=ParseCommandOption(MagickInterlaceOptions,MagickFalse, |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 589 | argv[i]); |
| 590 | if (interlace < 0) |
| 591 | ThrowIdentifyException(OptionError, |
| 592 | "UnrecognizedInterlaceType",argv[i]); |
| 593 | break; |
| 594 | } |
| 595 | if (LocaleCompare("interpolate",option+1) == 0) |
| 596 | { |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 597 | ssize_t |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 598 | interpolate; |
| 599 | |
| 600 | if (*option == '+') |
| 601 | break; |
| 602 | i++; |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 603 | if (i == (ssize_t) argc) |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 604 | ThrowIdentifyException(OptionError,"MissingArgument",option); |
| cristy | 042ee78 | 2011-04-22 18:48:30 +0000 | [diff] [blame] | 605 | interpolate=ParseCommandOption(MagickInterpolateOptions,MagickFalse, |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 606 | argv[i]); |
| 607 | if (interpolate < 0) |
| 608 | ThrowIdentifyException(OptionError, |
| 609 | "UnrecognizedInterpolateMethod",argv[i]); |
| 610 | break; |
| 611 | } |
| 612 | ThrowIdentifyException(OptionError,"UnrecognizedOption",option) |
| 613 | } |
| 614 | case 'l': |
| 615 | { |
| 616 | if (LocaleCompare("limit",option+1) == 0) |
| 617 | { |
| 618 | char |
| 619 | *p; |
| 620 | |
| 621 | double |
| 622 | value; |
| 623 | |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 624 | ssize_t |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 625 | resource; |
| 626 | |
| 627 | if (*option == '+') |
| 628 | break; |
| 629 | i++; |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 630 | if (i == (ssize_t) argc) |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 631 | ThrowIdentifyException(OptionError,"MissingArgument",option); |
| cristy | 042ee78 | 2011-04-22 18:48:30 +0000 | [diff] [blame] | 632 | resource=ParseCommandOption(MagickResourceOptions,MagickFalse, |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 633 | argv[i]); |
| 634 | if (resource < 0) |
| 635 | ThrowIdentifyException(OptionError,"UnrecognizedResourceType", |
| 636 | argv[i]); |
| 637 | i++; |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 638 | if (i == (ssize_t) argc) |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 639 | ThrowIdentifyException(OptionError,"MissingArgument",option); |
| cristy | b51dff5 | 2011-05-19 16:55:47 +0000 | [diff] [blame^] | 640 | value=LocaleToDouble(argv[i],&p); |
| cristy | da16f16 | 2011-02-19 23:52:17 +0000 | [diff] [blame] | 641 | (void) value; |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 642 | if ((p == argv[i]) && (LocaleCompare("unlimited",argv[i]) != 0)) |
| 643 | ThrowIdentifyInvalidArgumentException(option,argv[i]); |
| 644 | break; |
| 645 | } |
| 646 | if (LocaleCompare("list",option+1) == 0) |
| 647 | { |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 648 | ssize_t |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 649 | list; |
| 650 | |
| 651 | if (*option == '+') |
| 652 | break; |
| 653 | i++; |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 654 | if (i == (ssize_t) argc) |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 655 | ThrowIdentifyException(OptionError,"MissingArgument",option); |
| cristy | 042ee78 | 2011-04-22 18:48:30 +0000 | [diff] [blame] | 656 | list=ParseCommandOption(MagickListOptions,MagickFalse,argv[i]); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 657 | if (list < 0) |
| 658 | ThrowIdentifyException(OptionError,"UnrecognizedListType", |
| 659 | argv[i]); |
| cristy | aeb2cbc | 2010-05-07 13:28:58 +0000 | [diff] [blame] | 660 | status=MogrifyImageInfo(image_info,(int) (i-j+1),(const char **) |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 661 | argv+j,exception); |
| 662 | DestroyIdentify(); |
| cristy | aeb2cbc | 2010-05-07 13:28:58 +0000 | [diff] [blame] | 663 | return(status != 0 ? MagickFalse : MagickTrue); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 664 | } |
| 665 | if (LocaleCompare("log",option+1) == 0) |
| 666 | { |
| 667 | if (*option == '+') |
| 668 | break; |
| 669 | i++; |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 670 | if ((i == (ssize_t) argc) || |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 671 | (strchr(argv[i],'%') == (char *) NULL)) |
| 672 | ThrowIdentifyException(OptionError,"MissingArgument",option); |
| 673 | break; |
| 674 | } |
| 675 | ThrowIdentifyException(OptionError,"UnrecognizedOption",option) |
| 676 | } |
| 677 | case 'm': |
| 678 | { |
| 679 | if (LocaleCompare("matte",option+1) == 0) |
| 680 | break; |
| 681 | if (LocaleCompare("monitor",option+1) == 0) |
| 682 | break; |
| 683 | ThrowIdentifyException(OptionError,"UnrecognizedOption",option) |
| 684 | } |
| cristy | e48c6a9 | 2010-02-01 01:25:42 +0000 | [diff] [blame] | 685 | case 'n': |
| 686 | { |
| 687 | if (LocaleCompare("negate",option+1) == 0) |
| 688 | break; |
| 689 | ThrowIdentifyException(OptionError,"UnrecognizedOption",option) |
| 690 | } |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 691 | case 'p': |
| 692 | { |
| 693 | if (LocaleCompare("ping",option+1) == 0) |
| 694 | break; |
| 695 | ThrowIdentifyException(OptionError,"UnrecognizedOption",option) |
| 696 | } |
| 697 | case 'q': |
| 698 | { |
| 699 | if (LocaleCompare("quiet",option+1) == 0) |
| 700 | break; |
| 701 | ThrowIdentifyException(OptionError,"UnrecognizedOption",option) |
| 702 | } |
| 703 | case 'r': |
| 704 | { |
| 705 | if (LocaleCompare("regard-warnings",option+1) == 0) |
| 706 | break; |
| 707 | if (LocaleNCompare("respect-parentheses",option+1,17) == 0) |
| 708 | { |
| 709 | respect_parenthesis=(*option == '-') ? MagickTrue : MagickFalse; |
| 710 | break; |
| 711 | } |
| 712 | ThrowIdentifyException(OptionError,"UnrecognizedOption",option) |
| 713 | } |
| 714 | case 's': |
| 715 | { |
| 716 | if (LocaleCompare("sampling-factor",option+1) == 0) |
| 717 | { |
| 718 | if (*option == '+') |
| 719 | break; |
| 720 | i++; |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 721 | if (i == (ssize_t) argc) |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 722 | ThrowIdentifyException(OptionError,"MissingArgument",option); |
| 723 | if (IsGeometry(argv[i]) == MagickFalse) |
| 724 | ThrowIdentifyInvalidArgumentException(option,argv[i]); |
| 725 | break; |
| 726 | } |
| 727 | if (LocaleCompare("seed",option+1) == 0) |
| 728 | { |
| 729 | if (*option == '+') |
| 730 | break; |
| 731 | i++; |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 732 | if (i == (ssize_t) (argc-1)) |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 733 | ThrowIdentifyException(OptionError,"MissingArgument",option); |
| 734 | if (IsGeometry(argv[i]) == MagickFalse) |
| 735 | ThrowIdentifyInvalidArgumentException(option,argv[i]); |
| 736 | break; |
| 737 | } |
| 738 | if (LocaleCompare("set",option+1) == 0) |
| 739 | { |
| 740 | i++; |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 741 | if (i == (ssize_t) argc) |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 742 | ThrowIdentifyException(OptionError,"MissingArgument",option); |
| 743 | if (*option == '+') |
| 744 | break; |
| 745 | i++; |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 746 | if (i == (ssize_t) argc) |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 747 | ThrowIdentifyException(OptionError,"MissingArgument",option); |
| 748 | break; |
| 749 | } |
| 750 | if (LocaleCompare("size",option+1) == 0) |
| 751 | { |
| 752 | if (*option == '+') |
| 753 | break; |
| 754 | i++; |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 755 | if (i == (ssize_t) argc) |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 756 | ThrowIdentifyException(OptionError,"MissingArgument",option); |
| 757 | if (IsGeometry(argv[i]) == MagickFalse) |
| 758 | ThrowIdentifyInvalidArgumentException(option,argv[i]); |
| 759 | break; |
| 760 | } |
| 761 | if (LocaleCompare("strip",option+1) == 0) |
| 762 | break; |
| 763 | if (LocaleCompare("support",option+1) == 0) |
| 764 | { |
| 765 | if (*option == '+') |
| 766 | break; |
| 767 | i++; |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 768 | if (i == (ssize_t) argc) |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 769 | ThrowIdentifyException(OptionError,"MissingArgument",option); |
| 770 | if (IsGeometry(argv[i]) == MagickFalse) |
| 771 | ThrowIdentifyInvalidArgumentException(option,argv[i]); |
| 772 | break; |
| 773 | } |
| 774 | ThrowIdentifyException(OptionError,"UnrecognizedOption",option) |
| 775 | } |
| 776 | case 'u': |
| 777 | { |
| cristy | 045bd90 | 2010-01-30 18:56:24 +0000 | [diff] [blame] | 778 | if (LocaleCompare("unique",option+1) == 0) |
| 779 | break; |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 780 | if (LocaleCompare("units",option+1) == 0) |
| 781 | { |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 782 | ssize_t |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 783 | units; |
| 784 | |
| 785 | if (*option == '+') |
| 786 | break; |
| 787 | i++; |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 788 | if (i == (ssize_t) (argc-1)) |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 789 | ThrowIdentifyException(OptionError,"MissingArgument",option); |
| cristy | 042ee78 | 2011-04-22 18:48:30 +0000 | [diff] [blame] | 790 | units=ParseCommandOption(MagickResolutionOptions,MagickFalse, |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 791 | argv[i]); |
| 792 | if (units < 0) |
| 793 | ThrowIdentifyException(OptionError,"UnrecognizedUnitsType", |
| 794 | argv[i]); |
| 795 | break; |
| 796 | } |
| 797 | ThrowIdentifyException(OptionError,"UnrecognizedOption",option) |
| 798 | } |
| 799 | case 'v': |
| 800 | { |
| 801 | if (LocaleCompare("verbose",option+1) == 0) |
| 802 | break; |
| 803 | if (LocaleCompare("virtual-pixel",option+1) == 0) |
| 804 | { |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 805 | ssize_t |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 806 | method; |
| 807 | |
| 808 | if (*option == '+') |
| 809 | break; |
| 810 | i++; |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 811 | if (i == (ssize_t) (argc-1)) |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 812 | ThrowIdentifyException(OptionError,"MissingArgument",option); |
| cristy | 042ee78 | 2011-04-22 18:48:30 +0000 | [diff] [blame] | 813 | method=ParseCommandOption(MagickVirtualPixelOptions,MagickFalse, |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 814 | argv[i]); |
| 815 | if (method < 0) |
| 816 | ThrowIdentifyException(OptionError, |
| 817 | "UnrecognizedVirtualPixelMethod",argv[i]); |
| 818 | break; |
| 819 | } |
| 820 | ThrowIdentifyException(OptionError,"UnrecognizedOption",option) |
| 821 | } |
| 822 | case '?': |
| 823 | break; |
| 824 | default: |
| 825 | ThrowIdentifyException(OptionError,"UnrecognizedOption",option) |
| 826 | } |
| cristy | 042ee78 | 2011-04-22 18:48:30 +0000 | [diff] [blame] | 827 | fire=(GetCommandOptionFlags(MagickCommandOptions,MagickFalse,option) & |
| 828 | FireOptionFlag) == 0 ? MagickFalse : MagickTrue; |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 829 | if (fire != MagickFalse) |
| 830 | FireImageStack(MagickFalse,MagickTrue,MagickTrue); |
| 831 | } |
| 832 | if (k != 0) |
| 833 | ThrowIdentifyException(OptionError,"UnbalancedParenthesis",argv[i]); |
| cristy | cee9711 | 2010-05-28 00:44:52 +0000 | [diff] [blame] | 834 | if (i != (ssize_t) argc) |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 835 | ThrowIdentifyException(OptionError,"MissingAnImageFilename",argv[i]); |
| 836 | DestroyIdentify(); |
| 837 | return(status != 0 ? MagickTrue : MagickFalse); |
| 838 | } |