|
MagickWand
6.7.5
|
00001 /* 00002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 00003 % % 00004 % % 00005 % % 00006 % IIIII DDDD EEEEE N N TTTTT IIIII FFFFF Y Y % 00007 % I D D E NN N T I F Y Y % 00008 % I D D EEE N N N T I FFF Y % 00009 % I D D E N NN T I F Y % 00010 % IIIII DDDD EEEEE N N T IIIII F Y % 00011 % % 00012 % % 00013 % Identify an Image Format and Characteristics. % 00014 % % 00015 % Software Design % 00016 % John Cristy % 00017 % September 1994 % 00018 % % 00019 % % 00020 % Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization % 00021 % dedicated to making software imaging solutions freely available. % 00022 % % 00023 % You may not use this file except in compliance with the License. You may % 00024 % obtain a copy of the License at % 00025 % % 00026 % http://www.imagemagick.org/script/license.php % 00027 % % 00028 % Unless required by applicable law or agreed to in writing, software % 00029 % distributed under the License is distributed on an "AS IS" BASIS, % 00030 % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. % 00031 % See the License for the specific language governing permissions and % 00032 % limitations under the License. % 00033 % % 00034 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 00035 % 00036 % The identify program describes the format and characteristics of one or more 00037 % image files. It also reports if an image is incomplete or corrupt. The 00038 % information returned includes the image number, the file name, the width and 00039 % height of the image, whether the image is colormapped or not, the number of 00040 % colors in the image, the number of bytes in the image, the format of the 00041 % image (JPEG, PNM, etc.), and finally the number of seconds it took to read 00042 % and process the image. Many more attributes are available with the verbose 00043 % option. 00044 % 00045 */ 00046 00047 /* 00048 Include declarations. 00049 */ 00050 #include "MagickWand/studio.h" 00051 #include "MagickWand/MagickWand.h" 00052 #include "MagickWand/mogrify-private.h" 00053 #include "MagickCore/string-private.h" 00054 00055 /* 00056 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 00057 % % 00058 % % 00059 % % 00060 + I d e n t i f y I m a g e C o m m a n d % 00061 % % 00062 % % 00063 % % 00064 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 00065 % 00066 % IdentifyImageCommand() describes the format and characteristics of one or 00067 % more image files. It will also report if an image is incomplete or corrupt. 00068 % The information displayed includes the scene number, the file name, the 00069 % width and height of the image, whether the image is colormapped or not, 00070 % the number of colors in the image, the number of bytes in the image, the 00071 % format of the image (JPEG, PNM, etc.), and finally the number of seconds 00072 % it took to read and process the image. 00073 % 00074 % The format of the IdentifyImageCommand method is: 00075 % 00076 % MagickBooleanType IdentifyImageCommand(ImageInfo *image_info,int argc, 00077 % char **argv,char **metadata,ExceptionInfo *exception) 00078 % 00079 % A description of each parameter follows: 00080 % 00081 % o image_info: the image info. 00082 % 00083 % o argc: the number of elements in the argument vector. 00084 % 00085 % o argv: A text array containing the command line arguments. 00086 % 00087 % o metadata: any metadata is returned here. 00088 % 00089 % o exception: return any errors or warnings in this structure. 00090 % 00091 */ 00092 00093 static MagickBooleanType IdentifyUsage(void) 00094 { 00095 const char 00096 **p; 00097 00098 static const char 00099 *miscellaneous[]= 00100 { 00101 "-debug events display copious debugging information", 00102 "-help print program options", 00103 "-list type print a list of supported option arguments", 00104 "-log format format of debugging information", 00105 "-version print version information", 00106 (char *) NULL 00107 }, 00108 *operators[]= 00109 { 00110 "-negate replace every pixel with its complementary color ", 00111 (char *) NULL 00112 }, 00113 *settings[]= 00114 { 00115 "-alpha option on, activate, off, deactivate, set, opaque, copy", 00116 " transparent, extract, background, or shape", 00117 "-antialias remove pixel-aliasing", 00118 "-authenticate password", 00119 " decipher image with this password", 00120 "-channel type apply option to select image channels", 00121 "-colorspace type alternate image colorspace", 00122 "-crop geometry cut out a rectangular region of the image", 00123 "-define format:option", 00124 " define one or more image format options", 00125 "-density geometry horizontal and vertical density of the image", 00126 "-depth value image depth", 00127 "-extract geometry extract area from image", 00128 "-features distance display image features (e.g. contrast, correlation)", 00129 "-format \"string\" output formatted image characteristics", 00130 "-fuzz distance colors within this distance are considered equal", 00131 "-gamma value of gamma correction", 00132 "-interlace type type of image interlacing scheme", 00133 "-interpolate method pixel color interpolation method", 00134 "-limit type value pixel cache resource limit", 00135 "-monitor monitor progress", 00136 "-ping efficiently determine image attributes", 00137 "-quiet suppress all warning messages", 00138 "-regard-warnings pay attention to warning messages", 00139 "-respect-parentheses settings remain in effect until parenthesis boundary", 00140 "-sampling-factor geometry", 00141 " horizontal and vertical sampling factor", 00142 "-seed value seed a new sequence of pseudo-random numbers", 00143 "-set attribute value set an image attribute", 00144 "-size geometry width and height of image", 00145 "-strip strip image of all profiles and comments", 00146 "-unique display the number of unique colors in the image", 00147 "-units type the units of image resolution", 00148 "-verbose print detailed information about the image", 00149 "-virtual-pixel method", 00150 " virtual pixel access method", 00151 (char *) NULL 00152 }; 00153 00154 (void) printf("Version: %s\n",GetMagickVersion((size_t *) NULL)); 00155 (void) printf("Copyright: %s\n",GetMagickCopyright()); 00156 (void) printf("Features: %s\n\n",GetMagickFeatures()); 00157 (void) printf("Usage: %s [options ...] file [ [options ...] " 00158 "file ... ]\n",GetClientName()); 00159 (void) printf("\nImage Settings:\n"); 00160 for (p=settings; *p != (char *) NULL; p++) 00161 (void) printf(" %s\n",*p); 00162 (void) printf("\nImage Operators:\n"); 00163 for (p=operators; *p != (char *) NULL; p++) 00164 (void) printf(" %s\n",*p); 00165 (void) printf("\nMiscellaneous Options:\n"); 00166 for (p=miscellaneous; *p != (char *) NULL; p++) 00167 (void) printf(" %s\n",*p); 00168 (void) printf( 00169 "\nBy default, the image format of `file' is determined by its magic\n"); 00170 (void) printf( 00171 "number. To specify a particular image format, precede the filename\n"); 00172 (void) printf( 00173 "with an image format name and a colon (i.e. ps:image) or specify the\n"); 00174 (void) printf( 00175 "image type as the filename suffix (i.e. image.ps). Specify 'file' as\n"); 00176 (void) printf("'-' for standard input or output.\n"); 00177 return(MagickFalse); 00178 } 00179 00180 WandExport MagickBooleanType IdentifyImageCommand(ImageInfo *image_info, 00181 int argc,char **argv,char **metadata,ExceptionInfo *exception) 00182 { 00183 #define DestroyIdentify() \ 00184 { \ 00185 DestroyImageStack(); \ 00186 for (i=0; i < (ssize_t) argc; i++) \ 00187 argv[i]=DestroyString(argv[i]); \ 00188 argv=(char **) RelinquishMagickMemory(argv); \ 00189 } 00190 #define ThrowIdentifyException(asperity,tag,option) \ 00191 { \ 00192 (void) ThrowMagickException(exception,GetMagickModule(),asperity,tag,"`%s'", \ 00193 option); \ 00194 DestroyIdentify(); \ 00195 return(MagickFalse); \ 00196 } 00197 #define ThrowIdentifyInvalidArgumentException(option,argument) \ 00198 { \ 00199 (void) ThrowMagickException(exception,GetMagickModule(),OptionError, \ 00200 "InvalidArgument","`%s': %s",option,argument); \ 00201 DestroyIdentify(); \ 00202 return(MagickFalse); \ 00203 } 00204 00205 const char 00206 *format, 00207 *option; 00208 00209 Image 00210 *image; 00211 00212 ImageStack 00213 image_stack[MaxImageStackDepth+1]; 00214 00215 MagickBooleanType 00216 fire, 00217 pend, 00218 respect_parenthesis; 00219 00220 MagickStatusType 00221 status; 00222 00223 register ssize_t 00224 i; 00225 00226 size_t 00227 count; 00228 00229 ssize_t 00230 j, 00231 k; 00232 00233 /* 00234 Set defaults. 00235 */ 00236 assert(image_info != (ImageInfo *) NULL); 00237 assert(image_info->signature == MagickSignature); 00238 if (image_info->debug != MagickFalse) 00239 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"..."); 00240 assert(exception != (ExceptionInfo *) NULL); 00241 if (argc == 2) 00242 { 00243 option=argv[1]; 00244 if ((LocaleCompare("version",option+1) == 0) || 00245 (LocaleCompare("-version",option+1) == 0)) 00246 { 00247 (void) FormatLocaleFile(stdout,"Version: %s\n", 00248 GetMagickVersion((size_t *) NULL)); 00249 (void) FormatLocaleFile(stdout,"Copyright: %s\n", 00250 GetMagickCopyright()); 00251 (void) FormatLocaleFile(stdout,"Features: %s\n\n", 00252 GetMagickFeatures()); 00253 return(MagickFalse); 00254 } 00255 } 00256 if (argc < 2) 00257 return(IdentifyUsage()); 00258 count=0; 00259 format=NULL; 00260 j=1; 00261 k=0; 00262 NewImageStack(); 00263 option=(char *) NULL; 00264 pend=MagickFalse; 00265 respect_parenthesis=MagickFalse; 00266 status=MagickTrue; 00267 /* 00268 Identify an image. 00269 */ 00270 ReadCommandlLine(argc,&argv); 00271 status=ExpandFilenames(&argc,&argv); 00272 if (status == MagickFalse) 00273 ThrowIdentifyException(ResourceLimitError,"MemoryAllocationFailed", 00274 GetExceptionMessage(errno)); 00275 image_info->ping=MagickTrue; 00276 for (i=1; i < (ssize_t) argc; i++) 00277 { 00278 option=argv[i]; 00279 if (LocaleCompare(option,"(") == 0) 00280 { 00281 FireImageStack(MagickFalse,MagickTrue,pend); 00282 if (k == MaxImageStackDepth) 00283 ThrowIdentifyException(OptionError,"ParenthesisNestedTooDeeply", 00284 option); 00285 PushImageStack(); 00286 continue; 00287 } 00288 if (LocaleCompare(option,")") == 0) 00289 { 00290 FireImageStack(MagickFalse,MagickTrue,MagickTrue); 00291 if (k == 0) 00292 ThrowIdentifyException(OptionError,"UnableToParseExpression",option); 00293 PopImageStack(); 00294 continue; 00295 } 00296 if (IsCommandOption(option) == MagickFalse) 00297 { 00298 char 00299 *filename; 00300 00301 Image 00302 *images; 00303 00304 ImageInfo 00305 *identify_info; 00306 00307 /* 00308 Read input image. 00309 */ 00310 FireImageStack(MagickFalse,MagickFalse,pend); 00311 identify_info=CloneImageInfo(image_info); 00312 identify_info->verbose=MagickFalse; 00313 filename=argv[i]; 00314 if ((LocaleCompare(filename,"--") == 0) && (i < (ssize_t) (argc-1))) 00315 filename=argv[++i]; 00316 (void) CopyMagickString(identify_info->filename,filename,MaxTextExtent); 00317 if (identify_info->ping != MagickFalse) 00318 images=PingImages(identify_info,exception); 00319 else 00320 images=ReadImages(identify_info,exception); 00321 identify_info=DestroyImageInfo(identify_info); 00322 status&=(images != (Image *) NULL) && 00323 (exception->severity < ErrorException); 00324 if (images == (Image *) NULL) 00325 continue; 00326 AppendImageStack(images); 00327 FinalizeImageSettings(image_info,image,MagickFalse); 00328 for ( ; image != (Image *) NULL; image=GetNextImageInList(image)) 00329 { 00330 if (image->scene == 0) 00331 image->scene=count++; 00332 if (format == (char *) NULL) 00333 { 00334 (void) IdentifyImage(image,stdout,image_info->verbose,exception); 00335 continue; 00336 } 00337 if (metadata != (char **) NULL) 00338 { 00339 char 00340 *text; 00341 00342 text=InterpretImageProperties(image_info,image,format,exception); 00343 if (text == (char *) NULL) 00344 ThrowIdentifyException(ResourceLimitError, 00345 "MemoryAllocationFailed",GetExceptionMessage(errno)); 00346 (void) ConcatenateString(&(*metadata),text); 00347 text=DestroyString(text); 00348 if (LocaleCompare(format,"%n") == 0) 00349 break; 00350 } 00351 } 00352 RemoveAllImageStack(); 00353 continue; 00354 } 00355 pend=image != (Image *) NULL ? MagickTrue : MagickFalse; 00356 switch (*(option+1)) 00357 { 00358 case 'a': 00359 { 00360 if (LocaleCompare("alpha",option+1) == 0) 00361 { 00362 ssize_t 00363 type; 00364 00365 if (*option == '+') 00366 break; 00367 i++; 00368 if (i == (ssize_t) argc) 00369 ThrowIdentifyException(OptionError,"MissingArgument",option); 00370 type=ParseCommandOption(MagickAlphaOptions,MagickFalse,argv[i]); 00371 if (type < 0) 00372 ThrowIdentifyException(OptionError,"UnrecognizedAlphaChannelType", 00373 argv[i]); 00374 break; 00375 } 00376 if (LocaleCompare("antialias",option+1) == 0) 00377 break; 00378 if (LocaleCompare("authenticate",option+1) == 0) 00379 { 00380 if (*option == '+') 00381 break; 00382 i++; 00383 if (i == (ssize_t) (argc-1)) 00384 ThrowIdentifyException(OptionError,"MissingArgument",option); 00385 break; 00386 } 00387 ThrowIdentifyException(OptionError,"UnrecognizedOption",option) 00388 } 00389 case 'c': 00390 { 00391 if (LocaleCompare("cache",option+1) == 0) 00392 { 00393 if (*option == '+') 00394 break; 00395 i++; 00396 if (i == (ssize_t) argc) 00397 ThrowIdentifyException(OptionError,"MissingArgument",option); 00398 if (IsGeometry(argv[i]) == MagickFalse) 00399 ThrowIdentifyInvalidArgumentException(option,argv[i]); 00400 break; 00401 } 00402 if (LocaleCompare("channel",option+1) == 0) 00403 { 00404 ssize_t 00405 channel; 00406 00407 if (*option == '+') 00408 break; 00409 i++; 00410 if (i == (ssize_t) (argc-1)) 00411 ThrowIdentifyException(OptionError,"MissingArgument",option); 00412 channel=ParseChannelOption(argv[i]); 00413 if (channel < 0) 00414 ThrowIdentifyException(OptionError,"UnrecognizedChannelType", 00415 argv[i]); 00416 break; 00417 } 00418 if (LocaleCompare("colorspace",option+1) == 0) 00419 { 00420 ssize_t 00421 colorspace; 00422 00423 if (*option == '+') 00424 break; 00425 i++; 00426 if (i == (ssize_t) (argc-1)) 00427 ThrowIdentifyException(OptionError,"MissingArgument",option); 00428 colorspace=ParseCommandOption(MagickColorspaceOptions, 00429 MagickFalse,argv[i]); 00430 if (colorspace < 0) 00431 ThrowIdentifyException(OptionError,"UnrecognizedColorspace", 00432 argv[i]); 00433 break; 00434 } 00435 if (LocaleCompare("crop",option+1) == 0) 00436 { 00437 if (*option == '+') 00438 break; 00439 i++; 00440 if (i == (ssize_t) (argc-1)) 00441 ThrowIdentifyException(OptionError,"MissingArgument",option); 00442 if (IsGeometry(argv[i]) == MagickFalse) 00443 ThrowIdentifyInvalidArgumentException(option,argv[i]); 00444 image_info->ping=MagickFalse; 00445 break; 00446 } 00447 if (LocaleCompare("concurrent",option+1) == 0) 00448 break; 00449 ThrowIdentifyException(OptionError,"UnrecognizedOption",option) 00450 } 00451 case 'd': 00452 { 00453 if (LocaleCompare("debug",option+1) == 0) 00454 { 00455 ssize_t 00456 event; 00457 00458 if (*option == '+') 00459 break; 00460 i++; 00461 if (i == (ssize_t) argc) 00462 ThrowIdentifyException(OptionError,"MissingArgument",option); 00463 event=ParseCommandOption(MagickLogEventOptions,MagickFalse,argv[i]); 00464 if (event < 0) 00465 ThrowIdentifyException(OptionError,"UnrecognizedEventType", 00466 argv[i]); 00467 (void) SetLogEventMask(argv[i]); 00468 break; 00469 } 00470 if (LocaleCompare("define",option+1) == 0) 00471 { 00472 i++; 00473 if (i == (ssize_t) argc) 00474 ThrowIdentifyException(OptionError,"MissingArgument",option); 00475 if (*option == '+') 00476 { 00477 const char 00478 *define; 00479 00480 define=GetImageOption(image_info,argv[i]); 00481 if (define == (const char *) NULL) 00482 ThrowIdentifyException(OptionError,"NoSuchOption",argv[i]); 00483 break; 00484 } 00485 break; 00486 } 00487 if (LocaleCompare("density",option+1) == 0) 00488 { 00489 if (*option == '+') 00490 break; 00491 i++; 00492 if (i == (ssize_t) argc) 00493 ThrowIdentifyException(OptionError,"MissingArgument",option); 00494 if (IsGeometry(argv[i]) == MagickFalse) 00495 ThrowIdentifyInvalidArgumentException(option,argv[i]); 00496 break; 00497 } 00498 if (LocaleCompare("depth",option+1) == 0) 00499 { 00500 if (*option == '+') 00501 break; 00502 i++; 00503 if (i == (ssize_t) argc) 00504 ThrowIdentifyException(OptionError,"MissingArgument",option); 00505 if (IsGeometry(argv[i]) == MagickFalse) 00506 ThrowIdentifyInvalidArgumentException(option,argv[i]); 00507 break; 00508 } 00509 if (LocaleCompare("duration",option+1) == 0) 00510 { 00511 if (*option == '+') 00512 break; 00513 i++; 00514 if (i == (ssize_t) (argc-1)) 00515 ThrowIdentifyException(OptionError,"MissingArgument",option); 00516 if (IsGeometry(argv[i]) == MagickFalse) 00517 ThrowIdentifyInvalidArgumentException(option,argv[i]); 00518 break; 00519 } 00520 ThrowIdentifyException(OptionError,"UnrecognizedOption",option) 00521 } 00522 case 'f': 00523 { 00524 if (LocaleCompare("features",option+1) == 0) 00525 { 00526 if (*option == '+') 00527 break; 00528 i++; 00529 if (i == (ssize_t) (argc-1)) 00530 ThrowIdentifyException(OptionError,"MissingArgument",option); 00531 if (IsGeometry(argv[i]) == MagickFalse) 00532 ThrowIdentifyInvalidArgumentException(option,argv[i]); 00533 break; 00534 } 00535 if (LocaleCompare("format",option+1) == 0) 00536 { 00537 format=(char *) NULL; 00538 if (*option == '+') 00539 break; 00540 i++; 00541 if (i == (ssize_t) argc) 00542 ThrowIdentifyException(OptionError,"MissingArgument",option); 00543 format=argv[i]; 00544 break; 00545 } 00546 if (LocaleCompare("fuzz",option+1) == 0) 00547 { 00548 if (*option == '+') 00549 break; 00550 i++; 00551 if (i == (ssize_t) (argc-1)) 00552 ThrowIdentifyException(OptionError,"MissingArgument",option); 00553 if (IsGeometry(argv[i]) == MagickFalse) 00554 ThrowIdentifyInvalidArgumentException(option,argv[i]); 00555 break; 00556 } 00557 ThrowIdentifyException(OptionError,"UnrecognizedOption",option) 00558 } 00559 case 'g': 00560 { 00561 if (LocaleCompare("gamma",option+1) == 0) 00562 { 00563 i++; 00564 if (i == (ssize_t) (argc-1)) 00565 ThrowIdentifyException(OptionError,"MissingArgument",option); 00566 if (IsGeometry(argv[i]) == MagickFalse) 00567 ThrowIdentifyInvalidArgumentException(option,argv[i]); 00568 break; 00569 } 00570 ThrowIdentifyException(OptionError,"UnrecognizedOption",option) 00571 } 00572 case 'h': 00573 { 00574 if ((LocaleCompare("help",option+1) == 0) || 00575 (LocaleCompare("-help",option+1) == 0)) 00576 return(IdentifyUsage()); 00577 ThrowIdentifyException(OptionError,"UnrecognizedOption",option) 00578 } 00579 case 'i': 00580 { 00581 if (LocaleCompare("interlace",option+1) == 0) 00582 { 00583 ssize_t 00584 interlace; 00585 00586 if (*option == '+') 00587 break; 00588 i++; 00589 if (i == (ssize_t) argc) 00590 ThrowIdentifyException(OptionError,"MissingArgument",option); 00591 interlace=ParseCommandOption(MagickInterlaceOptions,MagickFalse, 00592 argv[i]); 00593 if (interlace < 0) 00594 ThrowIdentifyException(OptionError, 00595 "UnrecognizedInterlaceType",argv[i]); 00596 break; 00597 } 00598 if (LocaleCompare("interpolate",option+1) == 0) 00599 { 00600 ssize_t 00601 interpolate; 00602 00603 if (*option == '+') 00604 break; 00605 i++; 00606 if (i == (ssize_t) argc) 00607 ThrowIdentifyException(OptionError,"MissingArgument",option); 00608 interpolate=ParseCommandOption(MagickInterpolateOptions,MagickFalse, 00609 argv[i]); 00610 if (interpolate < 0) 00611 ThrowIdentifyException(OptionError, 00612 "UnrecognizedInterpolateMethod",argv[i]); 00613 break; 00614 } 00615 ThrowIdentifyException(OptionError,"UnrecognizedOption",option) 00616 } 00617 case 'l': 00618 { 00619 if (LocaleCompare("limit",option+1) == 0) 00620 { 00621 char 00622 *p; 00623 00624 double 00625 value; 00626 00627 ssize_t 00628 resource; 00629 00630 if (*option == '+') 00631 break; 00632 i++; 00633 if (i == (ssize_t) argc) 00634 ThrowIdentifyException(OptionError,"MissingArgument",option); 00635 resource=ParseCommandOption(MagickResourceOptions,MagickFalse, 00636 argv[i]); 00637 if (resource < 0) 00638 ThrowIdentifyException(OptionError,"UnrecognizedResourceType", 00639 argv[i]); 00640 i++; 00641 if (i == (ssize_t) argc) 00642 ThrowIdentifyException(OptionError,"MissingArgument",option); 00643 value=StringToDouble(argv[i],&p); 00644 (void) value; 00645 if ((p == argv[i]) && (LocaleCompare("unlimited",argv[i]) != 0)) 00646 ThrowIdentifyInvalidArgumentException(option,argv[i]); 00647 break; 00648 } 00649 if (LocaleCompare("list",option+1) == 0) 00650 { 00651 ssize_t 00652 list; 00653 00654 if (*option == '+') 00655 break; 00656 i++; 00657 if (i == (ssize_t) argc) 00658 ThrowIdentifyException(OptionError,"MissingArgument",option); 00659 list=ParseCommandOption(MagickListOptions,MagickFalse,argv[i]); 00660 if (list < 0) 00661 ThrowIdentifyException(OptionError,"UnrecognizedListType", 00662 argv[i]); 00663 status=MogrifyImageInfo(image_info,(int) (i-j+1),(const char **) 00664 argv+j,exception); 00665 DestroyIdentify(); 00666 return(status != 0 ? MagickFalse : MagickTrue); 00667 } 00668 if (LocaleCompare("log",option+1) == 0) 00669 { 00670 if (*option == '+') 00671 break; 00672 i++; 00673 if ((i == (ssize_t) argc) || 00674 (strchr(argv[i],'%') == (char *) NULL)) 00675 ThrowIdentifyException(OptionError,"MissingArgument",option); 00676 break; 00677 } 00678 ThrowIdentifyException(OptionError,"UnrecognizedOption",option) 00679 } 00680 case 'm': 00681 { 00682 if (LocaleCompare("matte",option+1) == 0) 00683 break; 00684 if (LocaleCompare("monitor",option+1) == 0) 00685 break; 00686 ThrowIdentifyException(OptionError,"UnrecognizedOption",option) 00687 } 00688 case 'n': 00689 { 00690 if (LocaleCompare("negate",option+1) == 0) 00691 break; 00692 ThrowIdentifyException(OptionError,"UnrecognizedOption",option) 00693 } 00694 case 'p': 00695 { 00696 if (LocaleCompare("ping",option+1) == 0) 00697 break; 00698 ThrowIdentifyException(OptionError,"UnrecognizedOption",option) 00699 } 00700 case 'q': 00701 { 00702 if (LocaleCompare("quiet",option+1) == 0) 00703 break; 00704 ThrowIdentifyException(OptionError,"UnrecognizedOption",option) 00705 } 00706 case 'r': 00707 { 00708 if (LocaleCompare("regard-warnings",option+1) == 0) 00709 break; 00710 if (LocaleNCompare("respect-parentheses",option+1,17) == 0) 00711 { 00712 respect_parenthesis=(*option == '-') ? MagickTrue : MagickFalse; 00713 break; 00714 } 00715 ThrowIdentifyException(OptionError,"UnrecognizedOption",option) 00716 } 00717 case 's': 00718 { 00719 if (LocaleCompare("sampling-factor",option+1) == 0) 00720 { 00721 if (*option == '+') 00722 break; 00723 i++; 00724 if (i == (ssize_t) argc) 00725 ThrowIdentifyException(OptionError,"MissingArgument",option); 00726 if (IsGeometry(argv[i]) == MagickFalse) 00727 ThrowIdentifyInvalidArgumentException(option,argv[i]); 00728 break; 00729 } 00730 if (LocaleCompare("seed",option+1) == 0) 00731 { 00732 if (*option == '+') 00733 break; 00734 i++; 00735 if (i == (ssize_t) (argc-1)) 00736 ThrowIdentifyException(OptionError,"MissingArgument",option); 00737 if (IsGeometry(argv[i]) == MagickFalse) 00738 ThrowIdentifyInvalidArgumentException(option,argv[i]); 00739 break; 00740 } 00741 if (LocaleCompare("set",option+1) == 0) 00742 { 00743 i++; 00744 if (i == (ssize_t) argc) 00745 ThrowIdentifyException(OptionError,"MissingArgument",option); 00746 if (*option == '+') 00747 break; 00748 i++; 00749 if (i == (ssize_t) argc) 00750 ThrowIdentifyException(OptionError,"MissingArgument",option); 00751 break; 00752 } 00753 if (LocaleCompare("size",option+1) == 0) 00754 { 00755 if (*option == '+') 00756 break; 00757 i++; 00758 if (i == (ssize_t) argc) 00759 ThrowIdentifyException(OptionError,"MissingArgument",option); 00760 if (IsGeometry(argv[i]) == MagickFalse) 00761 ThrowIdentifyInvalidArgumentException(option,argv[i]); 00762 break; 00763 } 00764 if (LocaleCompare("strip",option+1) == 0) 00765 break; 00766 if (LocaleCompare("support",option+1) == 0) 00767 { 00768 if (*option == '+') 00769 break; 00770 i++; 00771 if (i == (ssize_t) argc) 00772 ThrowIdentifyException(OptionError,"MissingArgument",option); 00773 if (IsGeometry(argv[i]) == MagickFalse) 00774 ThrowIdentifyInvalidArgumentException(option,argv[i]); 00775 break; 00776 } 00777 ThrowIdentifyException(OptionError,"UnrecognizedOption",option) 00778 } 00779 case 'u': 00780 { 00781 if (LocaleCompare("unique",option+1) == 0) 00782 break; 00783 if (LocaleCompare("units",option+1) == 0) 00784 { 00785 ssize_t 00786 units; 00787 00788 if (*option == '+') 00789 break; 00790 i++; 00791 if (i == (ssize_t) (argc-1)) 00792 ThrowIdentifyException(OptionError,"MissingArgument",option); 00793 units=ParseCommandOption(MagickResolutionOptions,MagickFalse, 00794 argv[i]); 00795 if (units < 0) 00796 ThrowIdentifyException(OptionError,"UnrecognizedUnitsType", 00797 argv[i]); 00798 break; 00799 } 00800 ThrowIdentifyException(OptionError,"UnrecognizedOption",option) 00801 } 00802 case 'v': 00803 { 00804 if (LocaleCompare("verbose",option+1) == 0) 00805 break; 00806 if (LocaleCompare("virtual-pixel",option+1) == 0) 00807 { 00808 ssize_t 00809 method; 00810 00811 if (*option == '+') 00812 break; 00813 i++; 00814 if (i == (ssize_t) (argc-1)) 00815 ThrowIdentifyException(OptionError,"MissingArgument",option); 00816 method=ParseCommandOption(MagickVirtualPixelOptions,MagickFalse, 00817 argv[i]); 00818 if (method < 0) 00819 ThrowIdentifyException(OptionError, 00820 "UnrecognizedVirtualPixelMethod",argv[i]); 00821 break; 00822 } 00823 ThrowIdentifyException(OptionError,"UnrecognizedOption",option) 00824 } 00825 case '?': 00826 break; 00827 default: 00828 ThrowIdentifyException(OptionError,"UnrecognizedOption",option) 00829 } 00830 fire=(GetCommandOptionFlags(MagickCommandOptions,MagickFalse,option) & 00831 FireOptionFlag) == 0 ? MagickFalse : MagickTrue; 00832 if (fire != MagickFalse) 00833 FireImageStack(MagickFalse,MagickTrue,MagickTrue); 00834 } 00835 if (k != 0) 00836 ThrowIdentifyException(OptionError,"UnbalancedParenthesis",argv[i]); 00837 if (i != (ssize_t) argc) 00838 ThrowIdentifyException(OptionError,"MissingAnImageFilename",argv[i]); 00839 DestroyIdentify(); 00840 return(status != 0 ? MagickTrue : MagickFalse); 00841 }