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

Generated on Sat Nov 22 23:45:25 2008 for MagickWand by  doxygen 1.5.7.1