identify.c

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

Generated on 19 Nov 2009 for MagickWand by  doxygen 1.6.1