]> granicus.if.org Git - imagemagick/blobdiff - MagickWand/identify.c
(no commit message)
[imagemagick] / MagickWand / identify.c
index be8aacf0a161234e7ce39ac39a7b150aa76df004..435ee5a4cc6c6e89d78bfeee979da7d2d0946509 100644 (file)
@@ -17,7 +17,7 @@
 %                            September 1994                                   %
 %                                                                             %
 %                                                                             %
-%  Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization      %
+%  Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization      %
 %  dedicated to making software imaging solutions freely available.           %
 %                                                                             %
 %  You may not use this file except in compliance with the License.  You may  %
@@ -50,6 +50,7 @@
 #include "MagickWand/studio.h"
 #include "MagickWand/MagickWand.h"
 #include "MagickWand/mogrify-private.h"
+#include "MagickCore/string-private.h"
 \f
 /*
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -123,14 +124,16 @@ static MagickBooleanType IdentifyUsage(void)
       "                     define one or more image format options",
       "-density geometry    horizontal and vertical density of the image",
       "-depth value         image depth",
+      "-endian type         endianness (MSB or LSB) of the image",
       "-extract geometry    extract area from image",
-      "-features distance   display image features (e.g. contrast, correlation)",
+      "-features distance   analyze image features (e.g. contrast, correlation)",
       "-format \"string\"     output formatted image characteristics",
       "-fuzz distance       colors within this distance are considered equal",
       "-gamma value         of gamma correction",
       "-interlace type      type of image interlacing scheme",
       "-interpolate method  pixel color interpolation method",
       "-limit type value    pixel cache resource limit",
+      "-mask filename       associate a mask with the image",
       "-monitor             monitor progress",
       "-ping                efficiently determine image attributes",
       "-quiet               suppress all warning messages",
@@ -165,7 +168,7 @@ static MagickBooleanType IdentifyUsage(void)
   for (p=miscellaneous; *p != (char *) NULL; p++)
     (void) printf("  %s\n",*p);
   (void) printf(
-    "\nBy default, the image format of `file' is determined by its magic\n");
+    "\nBy default, the image format of 'file' is determined by its magic\n");
   (void) printf(
     "number.  To specify a particular image format, precede the filename\n");
   (void) printf(
@@ -188,7 +191,7 @@ WandExport MagickBooleanType IdentifyImageCommand(ImageInfo *image_info,
 }
 #define ThrowIdentifyException(asperity,tag,option) \
 { \
-  (void) ThrowMagickException(exception,GetMagickModule(),asperity,tag,"`%s'", \
+  (void) ThrowMagickException(exception,GetMagickModule(),asperity,tag,"'%s'", \
     option); \
   DestroyIdentify(); \
   return(MagickFalse); \
@@ -196,7 +199,7 @@ WandExport MagickBooleanType IdentifyImageCommand(ImageInfo *image_info,
 #define ThrowIdentifyInvalidArgumentException(option,argument) \
 { \
   (void) ThrowMagickException(exception,GetMagickModule(),OptionError, \
-    "InvalidArgument","`%s': %s",option,argument); \
+    "InvalidArgument","'%s': %s",option,argument); \
   DestroyIdentify(); \
   return(MagickFalse); \
 }
@@ -312,11 +315,10 @@ WandExport MagickBooleanType IdentifyImageCommand(ImageInfo *image_info,
         filename=argv[i];
         if ((LocaleCompare(filename,"--") == 0) && (i < (ssize_t) (argc-1)))
           filename=argv[++i];
-        (void) CopyMagickString(identify_info->filename,filename,MaxTextExtent);
         if (identify_info->ping != MagickFalse)
-          images=PingImages(identify_info,exception);
+          images=PingImages(identify_info,filename,exception);
         else
-          images=ReadImages(identify_info,exception);
+          images=ReadImages(identify_info,filename,exception);
         identify_info=DestroyImageInfo(identify_info);
         status&=(images != (Image *) NULL) &&
           (exception->severity < ErrorException);
@@ -338,7 +340,7 @@ WandExport MagickBooleanType IdentifyImageCommand(ImageInfo *image_info,
               char
                 *text;
 
-              text=InterpretImageProperties(image_info,image,format);
+              text=InterpretImageProperties(image_info,image,format,exception);
               if (text == (char *) NULL)
                 ThrowIdentifyException(ResourceLimitError,
                   "MemoryAllocationFailed",GetExceptionMessage(errno));
@@ -366,10 +368,11 @@ WandExport MagickBooleanType IdentifyImageCommand(ImageInfo *image_info,
             i++;
             if (i == (ssize_t) argc)
               ThrowIdentifyException(OptionError,"MissingArgument",option);
-            type=ParseCommandOption(MagickAlphaOptions,MagickFalse,argv[i]);
+            type=ParseCommandOption(MagickAlphaChannelOptions,MagickFalse,
+              argv[i]);
             if (type < 0)
-              ThrowIdentifyException(OptionError,"UnrecognizedAlphaChannelType",
-                argv[i]);
+              ThrowIdentifyException(OptionError,
+                "UnrecognizedAlphaChannelOption",argv[i]);
             break;
           }
         if (LocaleCompare("antialias",option+1) == 0)
@@ -518,6 +521,27 @@ WandExport MagickBooleanType IdentifyImageCommand(ImageInfo *image_info,
           }
         ThrowIdentifyException(OptionError,"UnrecognizedOption",option)
       }
+      case '3':
+      {
+        if (LocaleCompare("endian",option+1) == 0)
+          {
+            ssize_t
+              endian;
+
+            if (*option == '+')
+              break;
+            i++;
+            if (i == (ssize_t) (argc-1))
+              ThrowIdentifyException(OptionError,"MissingArgument",option);
+            endian=ParseCommandOption(MagickEndianOptions,MagickFalse,
+              argv[i]);
+            if (endian < 0)
+              ThrowIdentifyException(OptionError,"UnrecognizedEndianType",
+                argv[i]);
+            break;
+          }
+        ThrowIdentifyException(OptionError,"UnrecognizedOption",option)
+      }
       case 'f':
       {
         if (LocaleCompare("features",option+1) == 0)
@@ -639,7 +663,7 @@ WandExport MagickBooleanType IdentifyImageCommand(ImageInfo *image_info,
             i++;
             if (i == (ssize_t) argc)
               ThrowIdentifyException(OptionError,"MissingArgument",option);
-            value=InterpretLocaleValue(argv[i],&p);
+            value=StringToDouble(argv[i],&p);
             (void) value;
             if ((p == argv[i]) && (LocaleCompare("unlimited",argv[i]) != 0))
               ThrowIdentifyInvalidArgumentException(option,argv[i]);
@@ -678,6 +702,15 @@ WandExport MagickBooleanType IdentifyImageCommand(ImageInfo *image_info,
       }
       case 'm':
       {
+        if (LocaleCompare("mask",option+1) == 0)
+          {
+            if (*option == '+')
+              break;
+            i++;
+            if (i == (ssize_t) (argc-1))
+              ThrowIdentifyException(OptionError,"MissingArgument",option);
+            break;
+          }
         if (LocaleCompare("matte",option+1) == 0)
           break;
         if (LocaleCompare("monitor",option+1) == 0)