]> granicus.if.org Git - imagemagick/blobdiff - MagickCore/property.c
...
[imagemagick] / MagickCore / property.c
index 62acfee19ea443ff0ff51b905074bda3856e8d6a..9dc09ebe11f8f67ab3f4282dd94344d72d194913 100644 (file)
 %                                 March 2000                                  %
 %                                                                             %
 %                                                                             %
-%  Copyright 1999-2015 ImageMagick Studio LLC, a non-profit organization      %
+%  Copyright 1999-2017 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  %
 %  obtain a copy of the License at                                            %
 %                                                                             %
-%    http://www.imagemagick.org/script/license.php                            %
+%    https://www.imagemagick.org/script/license.php                           %
 %                                                                             %
 %  Unless required by applicable law or agreed to in writing, software        %
 %  distributed under the License is distributed on an "AS IS" BASIS,          %
@@ -68,6 +68,7 @@
 #include "MagickCore/monitor.h"
 #include "MagickCore/montage.h"
 #include "MagickCore/option.h"
+#include "MagickCore/policy.h"
 #include "MagickCore/profile.h"
 #include "MagickCore/property.h"
 #include "MagickCore/quantum.h"
@@ -85,8 +86,8 @@
 #include "MagickCore/xml-tree.h"
 #include "MagickCore/xml-tree-private.h"
 #if defined(MAGICKCORE_LCMS_DELEGATE)
-#if defined(MAGICKCORE_HAVE_LCMS_LCMS2_H)
-#include <lcms/lcms2.h>
+#if defined(MAGICKCORE_HAVE_LCMS2_LCMS2_H)
+#include <lcms2/lcms2.h>
 #elif defined(MAGICKCORE_HAVE_LCMS2_H)
 #include "lcms2.h"
 #elif defined(MAGICKCORE_HAVE_LCMS_LCMS_H)
@@ -134,23 +135,24 @@ MagickExport MagickBooleanType CloneImageProperties(Image *image,
   const Image *clone_image)
 {
   assert(image != (Image *) NULL);
-  assert(image->signature == MagickSignature);
+  assert(image->signature == MagickCoreSignature);
   if (image->debug != MagickFalse)
     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
   assert(clone_image != (const Image *) NULL);
-  assert(clone_image->signature == MagickSignature);
-  if( IfMagickTrue(clone_image->debug) )
+  assert(clone_image->signature == MagickCoreSignature);
+  if (clone_image->debug != MagickFalse)
     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
       clone_image->filename);
-  (void) CopyMagickString(image->filename,clone_image->filename,MaxTextExtent);
+  (void) CopyMagickString(image->filename,clone_image->filename,
+    MagickPathExtent);
   (void) CopyMagickString(image->magick_filename,clone_image->magick_filename,
-    MaxTextExtent);
+    MagickPathExtent);
   image->compression=clone_image->compression;
   image->quality=clone_image->quality;
   image->depth=clone_image->depth;
+  image->matte_color=clone_image->matte_color;
   image->background_color=clone_image->background_color;
   image->border_color=clone_image->border_color;
-  image->matte_color=clone_image->matte_color;
   image->transparent_color=clone_image->transparent_color;
   image->gamma=clone_image->gamma;
   image->chromaticity=clone_image->chromaticity;
@@ -211,7 +213,7 @@ MagickExport MagickBooleanType CloneImageProperties(Image *image,
 %
 %  DefineImageProperty() associates an assignment string of the form
 %  "key=value" with an artifact or options. It is equivelent to
-%  SetImageProperty()
+%  SetImageProperty().
 %
 %  The format of the DefineImageProperty method is:
 %
@@ -231,21 +233,21 @@ MagickExport MagickBooleanType DefineImageProperty(Image *image,
   const char *property,ExceptionInfo *exception)
 {
   char
-    key[MaxTextExtent],
-    value[MaxTextExtent];
+    key[MagickPathExtent],
+    value[MagickPathExtent];
 
   register char
     *p;
 
   assert(image != (Image *) NULL);
   assert(property != (const char *) NULL);
-  (void) CopyMagickString(key,property,MaxTextExtent-1);
+  (void) CopyMagickString(key,property,MagickPathExtent-1);
   for (p=key; *p != '\0'; p++)
     if (*p == '=')
       break;
   *value='\0';
   if (*p == '=')
-    (void) CopyMagickString(value,p+1,MaxTextExtent);
+    (void) CopyMagickString(value,p+1,MagickPathExtent);
   *p='\0';
   return(SetImageProperty(image,key,value,exception));
 }
@@ -278,10 +280,9 @@ MagickExport MagickBooleanType DeleteImageProperty(Image *image,
   const char *property)
 {
   assert(image != (Image *) NULL);
-  assert(image->signature == MagickSignature);
+  assert(image->signature == MagickCoreSignature);
   if (image->debug != MagickFalse)
-    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
-      image->filename);
+    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
   if (image->properties == (void *) NULL)
     return(MagickFalse);
   return(DeleteNodeFromSplayTree((SplayTreeInfo *) image->properties,property));
@@ -313,10 +314,9 @@ MagickExport MagickBooleanType DeleteImageProperty(Image *image,
 MagickExport void DestroyImageProperties(Image *image)
 {
   assert(image != (Image *) NULL);
-  assert(image->signature == MagickSignature);
+  assert(image->signature == MagickCoreSignature);
   if (image->debug != MagickFalse)
-    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
-      image->filename);
+    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
   if (image->properties != (void *) NULL)
     image->properties=(void *) DestroySplayTree((SplayTreeInfo *)
       image->properties);
@@ -355,7 +355,7 @@ MagickExport MagickBooleanType FormatImageProperty(Image *image,
   const char *property,const char *format,...)
 {
   char
-    value[MaxTextExtent];
+    value[MagickPathExtent];
 
   ExceptionInfo
     *exception;
@@ -370,7 +370,7 @@ MagickExport MagickBooleanType FormatImageProperty(Image *image,
     operands;
 
   va_start(operands,format);
-  n=FormatLocaleStringList(value,MaxTextExtent,format,operands);
+  n=FormatLocaleStringList(value,MagickPathExtent,format,operands);
   (void) n;
   va_end(operands);
   exception=AcquireExceptionInfo();
@@ -415,8 +415,7 @@ MagickExport MagickBooleanType FormatImageProperty(Image *image,
 */
 
 static char
-  *TracePSClippath(const unsigned char *,size_t,const size_t,
-    const size_t),
+  *TracePSClippath(const unsigned char *,size_t),
   *TraceSVGClippath(const unsigned char *,size_t,const size_t,
     const size_t);
 
@@ -499,9 +498,18 @@ static inline int ReadPropertyByte(const unsigned char **p,size_t *length)
   return(c);
 }
 
-static inline size_t ReadPropertyMSBLong(const unsigned char **p,
+static inline signed int ReadPropertyMSBLong(const unsigned char **p,
   size_t *length)
 {
+  union
+  {
+    unsigned int
+      unsigned_value;
+
+    signed int
+      signed_value;
+  } quantum;
+
   int
     c;
 
@@ -511,27 +519,37 @@ static inline size_t ReadPropertyMSBLong(const unsigned char **p,
   unsigned char
     buffer[4];
 
-  size_t
+  unsigned int
     value;
 
   if (*length < 4)
-    return(~0UL);
+    return(-1);
   for (i=0; i < 4; i++)
   {
     c=(int) (*(*p)++);
     (*length)--;
     buffer[i]=(unsigned char) c;
   }
-  value=(size_t) (buffer[0] << 24);
-  value|=buffer[1] << 16;
-  value|=buffer[2] << 8;
-  value|=buffer[3];
-  return(value & 0xffffffff);
+  value=(unsigned int) buffer[0] << 24;
+  value|=(unsigned int) buffer[1] << 16;
+  value|=(unsigned int) buffer[2] << 8;
+  value|=(unsigned int) buffer[3];
+  quantum.unsigned_value=value & 0xffffffff;
+  return(quantum.signed_value);
 }
 
-static inline unsigned short ReadPropertyMSBShort(const unsigned char **p,
+static inline signed short ReadPropertyMSBShort(const unsigned char **p,
   size_t *length)
 {
+  union
+  {
+    unsigned short
+      unsigned_value;
+
+    signed short
+      signed_value;
+  } quantum;
+
   int
     c;
 
@@ -552,9 +570,10 @@ static inline unsigned short ReadPropertyMSBShort(const unsigned char **p,
     (*length)--;
     buffer[i]=(unsigned char) c;
   }
-  value=(unsigned short) (buffer[0] << 8);
-  value|=buffer[1];
-  return((unsigned short) (value & 0xffff));
+  value=(unsigned short) buffer[0] << 8;
+  value|=(unsigned short) buffer[1];
+  quantum.unsigned_value=value & 0xffff;
+  return(quantum.signed_value);
 }
 
 static MagickBooleanType Get8BIMProperty(const Image *image,const char *key,
@@ -562,8 +581,8 @@ static MagickBooleanType Get8BIMProperty(const Image *image,const char *key,
 {
   char
     *attribute,
-    format[MaxTextExtent],
-    name[MaxTextExtent],
+    format[MagickPathExtent],
+    name[MagickPathExtent],
     *resource;
 
   const StringInfo
@@ -582,26 +601,26 @@ static MagickBooleanType Get8BIMProperty(const Image *image,const char *key,
   register ssize_t
     i;
 
+  size_t
+    length;
+
   ssize_t
     count,
     id,
     sub_number;
 
-  size_t
-    length;
-
   /*
     There are no newlines in path names, so it's safe as terminator.
   */
   profile=GetImageProfile(image,"8bim");
   if (profile == (StringInfo *) NULL)
     return(MagickFalse);
-  count=(ssize_t) sscanf(key,"8BIM:%ld,%ld:%[^\n]\n%[^\n]",&start,&stop,name,
-    format);
+  count=(ssize_t) sscanf(key,"8BIM:%ld,%ld:%1024[^\n]\n%1024[^\n]",&start,&stop,
+    name,format);
   if ((count != 2) && (count != 3) && (count != 4))
     return(MagickFalse);
   if (count < 4)
-    (void) CopyMagickString(format,"SVG",MaxTextExtent);
+    (void) CopyMagickString(format,"SVG",MagickPathExtent);
   if (count < 3)
     *name='\0';
   sub_number=1;
@@ -612,7 +631,7 @@ static MagickBooleanType Get8BIMProperty(const Image *image,const char *key,
   status=MagickFalse;
   length=GetStringInfoLength(profile);
   info=GetStringInfoDatum(profile);
-  while ((length > 0) && IfMagickFalse(status))
+  while ((length > 0) && (status == MagickFalse))
   {
     if (ReadPropertyByte(&info,&length) != (unsigned char) '8')
       continue;
@@ -622,7 +641,7 @@ static MagickBooleanType Get8BIMProperty(const Image *image,const char *key,
       continue;
     if (ReadPropertyByte(&info,&length) != (unsigned char) 'M')
       continue;
-    id=(ssize_t) ((int) ReadPropertyMSBShort(&info,&length));
+    id=(ssize_t) ReadPropertyMSBShort(&info,&length);
     if (id < (ssize_t) start)
       continue;
     if (id > (ssize_t) stop)
@@ -633,9 +652,9 @@ static MagickBooleanType Get8BIMProperty(const Image *image,const char *key,
     if ((count != 0) && ((size_t) count <= length))
       {
         resource=(char *) NULL;
-        if (~((size_t) count) >= (MaxTextExtent-1))
-          resource=(char *) AcquireQuantumMemory((size_t) count+MaxTextExtent,
-            sizeof(*resource));
+        if (~((size_t) count) >= (MagickPathExtent-1))
+          resource=(char *) AcquireQuantumMemory((size_t) count+
+            MagickPathExtent,sizeof(*resource));
         if (resource != (char *) NULL)
           {
             for (i=0; i < (ssize_t) count; i++)
@@ -645,7 +664,12 @@ static MagickBooleanType Get8BIMProperty(const Image *image,const char *key,
       }
     if ((count & 0x01) == 0)
       (void) ReadPropertyByte(&info,&length);
-    count=(ssize_t) ((int) ReadPropertyMSBLong(&info,&length));
+    count=(ssize_t) ReadPropertyMSBLong(&info,&length);
+    if ((count < 0) || ((size_t) count > length))
+      {
+        length=0; 
+        continue;
+      }
     if ((*name != '\0') && (*name != '#'))
       if ((resource == (char *) NULL) || (LocaleCompare(name,resource) != 0))
         {
@@ -670,8 +694,8 @@ static MagickBooleanType Get8BIMProperty(const Image *image,const char *key,
       We have the resource of interest.
     */
     attribute=(char *) NULL;
-    if (~((size_t) count) >= (MaxTextExtent-1))
-      attribute=(char *) AcquireQuantumMemory((size_t) count+MaxTextExtent,
+    if (~((size_t) count) >= (MagickPathExtent-1))
+      attribute=(char *) AcquireQuantumMemory((size_t) count+MagickPathExtent,
         sizeof(*attribute));
     if (attribute != (char *) NULL)
       {
@@ -680,8 +704,8 @@ static MagickBooleanType Get8BIMProperty(const Image *image,const char *key,
         info+=count;
         length-=MagickMin(count,(ssize_t) length);
         if ((id <= 1999) || (id >= 2999))
-          (void) SetImageProperty((Image *) image,key,(const char *)
-            attribute,exception);
+          (void) SetImageProperty((Image *) image,key,(const char *) attribute,
+            exception);
         else
           {
             char
@@ -691,8 +715,7 @@ static MagickBooleanType Get8BIMProperty(const Image *image,const char *key,
               path=TraceSVGClippath((unsigned char *) attribute,(size_t) count,
                 image->columns,image->rows);
             else
-              path=TracePSClippath((unsigned char *) attribute,(size_t) count,
-                image->columns,image->rows);
+              path=TracePSClippath((unsigned char *) attribute,(size_t) count);
             (void) SetImageProperty((Image *) image,key,(const char *) path,
               exception);
             path=DestroyString(path);
@@ -706,37 +729,102 @@ static MagickBooleanType Get8BIMProperty(const Image *image,const char *key,
   return(status);
 }
 
-static inline unsigned short ReadPropertyShort(const EndianType endian,
+static inline signed int ReadPropertySignedLong(const EndianType endian,
+  const unsigned char *buffer)
+{
+  union
+  {
+    unsigned int
+      unsigned_value;
+
+    signed int
+      signed_value;
+  } quantum;
+
+  unsigned int
+    value;
+
+  if (endian == LSBEndian)
+    {
+      value=(unsigned int) buffer[3] << 24;
+      value|=(unsigned int) buffer[2] << 16;
+      value|=(unsigned int) buffer[1] << 8;
+      value|=(unsigned int) buffer[0];
+      quantum.unsigned_value=value & 0xffffffff;
+      return(quantum.signed_value);
+    }
+  value=(unsigned int) buffer[0] << 24;
+  value|=(unsigned int) buffer[1] << 16;
+  value|=(unsigned int) buffer[2] << 8;
+  value|=(unsigned int) buffer[3];
+  quantum.unsigned_value=value & 0xffffffff;
+  return(quantum.signed_value);
+}
+
+static inline unsigned int ReadPropertyUnsignedLong(const EndianType endian,
+  const unsigned char *buffer)
+{
+  unsigned int
+    value;
+
+  if (endian == LSBEndian)
+    {
+      value=(unsigned int) buffer[3] << 24;
+      value|=(unsigned int) buffer[2] << 16;
+      value|=(unsigned int) buffer[1] << 8;
+      value|=(unsigned int) buffer[0];
+      return(value & 0xffffffff);
+    }
+  value=(unsigned int) buffer[0] << 24;
+  value|=(unsigned int) buffer[1] << 16;
+  value|=(unsigned int) buffer[2] << 8;
+  value|=(unsigned int) buffer[3];
+  return(value & 0xffffffff);
+}
+
+static inline signed short ReadPropertySignedShort(const EndianType endian,
   const unsigned char *buffer)
 {
+  union
+  {
+    unsigned short
+      unsigned_value;
+
+    signed short
+      signed_value;
+  } quantum;
+
   unsigned short
     value;
 
   if (endian == LSBEndian)
     {
-      value=(unsigned short) ((buffer[1] << 8) | buffer[0]);
-      return((unsigned short) (value & 0xffff));
+      value=(unsigned short) buffer[1] << 8;
+      value|=(unsigned short) buffer[0];
+      quantum.unsigned_value=value & 0xffff;
+      return(quantum.signed_value);
     }
-  value=(unsigned short) ((((unsigned char *) buffer)[0] << 8) |
-    ((unsigned char *) buffer)[1]);
-  return((unsigned short) (value & 0xffff));
+  value=(unsigned short) buffer[0] << 8;
+  value|=(unsigned short) buffer[1];
+  quantum.unsigned_value=value & 0xffff;
+  return(quantum.signed_value);
 }
 
-static inline size_t ReadPropertyLong(const EndianType endian,
+static inline unsigned short ReadPropertyUnsignedShort(const EndianType endian,
   const unsigned char *buffer)
 {
-  size_t
+  unsigned short
     value;
 
   if (endian == LSBEndian)
     {
-      value=(size_t) ((buffer[3] << 24) | (buffer[2] << 16) |
-        (buffer[1] << 8 ) | (buffer[0]));
-      return((size_t) (value & 0xffffffff));
+      value=(unsigned short) buffer[1] << 8;
+      value|=(unsigned short) buffer[0];
+      return(value & 0xffff);
     }
-  value=(size_t) ((buffer[0] << 24) | (buffer[1] << 16) |
-    (buffer[2] << 8) | buffer[3]);
-  return((size_t) (value & 0xffffffff));
+  value=(unsigned short) buffer[0] << 8;
+  value|=(unsigned short) buffer[1];
+  return(value & 0xffff);
 }
 
 static MagickBooleanType GetEXIFProperty(const Image *image,
@@ -776,10 +864,10 @@ static MagickBooleanType GetEXIFProperty(const Image *image,
    p1=p; \
    for (component=0; component < components; component++) \
    { \
-     length+=FormatLocaleString(buffer+length,MaxTextExtent-length, \
+     length+=FormatLocaleString(buffer+length,MagickPathExtent-length, \
        format", ",arg); \
-     if (length >= (MaxTextExtent-1)) \
-       length=MaxTextExtent-1; \
+     if (length >= (MagickPathExtent-1)) \
+       length=MagickPathExtent-1; \
      p1+=size; \
    } \
    if (length > 1) \
@@ -802,10 +890,10 @@ static MagickBooleanType GetEXIFProperty(const Image *image,
    p1=p; \
    for (component=0; component < components; component++) \
    { \
-     length+=FormatLocaleString(buffer+length,MaxTextExtent-length, \
+     length+=FormatLocaleString(buffer+length,MagickPathExtent-length, \
        format", ",(arg1),(arg2)); \
-     if (length >= (MaxTextExtent-1)) \
-       length=MaxTextExtent-1; \
+     if (length >= (MagickPathExtent-1)) \
+       length=MagickPathExtent-1; \
      p1+=size; \
    } \
    if (length > 1) \
@@ -1133,7 +1221,8 @@ static MagickBooleanType GetEXIFProperty(const Image *image,
     entry,
     length,
     number_entries,
-    tag;
+    tag,
+    tag_value;
 
   SplayTreeInfo
     *exif_resources;
@@ -1143,8 +1232,7 @@ static MagickBooleanType GetEXIFProperty(const Image *image,
     id,
     level,
     offset,
-    tag_offset,
-    tag_value;
+    tag_offset;
 
   static int
     tag_bytes[] = {0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8};
@@ -1153,12 +1241,14 @@ static MagickBooleanType GetEXIFProperty(const Image *image,
     If EXIF data exists, then try to parse the request for a tag.
   */
   profile=GetImageProfile(image,"exif");
-  if (profile == (StringInfo *) NULL)
+  if (profile == (const StringInfo *) NULL)
     return(MagickFalse);
   if ((property == (const char *) NULL) || (*property == '\0'))
     return(MagickFalse);
   while (isspace((int) ((unsigned char) *property)) != 0)
     property++;
+  if (strlen(property) <= 5)
+    return(MagickFalse);
   all=0;
   tag=(~0UL);
   switch (*(property+5))
@@ -1259,7 +1349,7 @@ static MagickBooleanType GetEXIFProperty(const Image *image,
   }
   if (length < 16)
     return(MagickFalse);
-  id=(ssize_t) ((int) ReadPropertyShort(LSBEndian,exif));
+  id=(ssize_t) ReadPropertySignedShort(LSBEndian,exif);
   endian=LSBEndian;
   if (id == 0x4949)
     endian=LSBEndian;
@@ -1268,12 +1358,12 @@ static MagickBooleanType GetEXIFProperty(const Image *image,
       endian=MSBEndian;
     else
       return(MagickFalse);
-  if (ReadPropertyShort(endian,exif+2) != 0x002a)
+  if (ReadPropertyUnsignedShort(endian,exif+2) != 0x002a)
     return(MagickFalse);
   /*
     This the offset to the first IFD.
   */
-  offset=(ssize_t) ((int) ReadPropertyLong(endian,exif+4));
+  offset=(ssize_t) ReadPropertySignedLong(endian,exif+4);
   if ((offset < 0) || (size_t) offset >= length)
     return(MagickFalse);
   /*
@@ -1298,10 +1388,12 @@ static MagickBooleanType GetEXIFProperty(const Image *image,
         entry=directory_stack[level].entry;
         tag_offset=directory_stack[level].offset;
       }
+    if ((directory < exif) || (directory > (exif+length-2)))
+      break;
     /*
       Determine how many entries there are in the current IFD.
     */
-    number_entries=(size_t) ((int) ReadPropertyShort(endian,directory));
+    number_entries=(size_t) ReadPropertyUnsignedShort(endian,directory);
     for ( ; entry < number_entries; entry++)
     {
       register unsigned char
@@ -1316,14 +1408,18 @@ static MagickBooleanType GetEXIFProperty(const Image *image,
         components;
 
       q=(unsigned char *) (directory+(12*entry)+2);
+      if (q > (exif+length-12))
+        break;  /* corrupt EXIF */
       if (GetValueFromSplayTree(exif_resources,q) == q)
         break;
       (void) AddValueToSplayTree(exif_resources,q,q);
-      tag_value=(ssize_t) ((int) ReadPropertyShort(endian,q)+tag_offset);
-      format=(size_t) ((int) ReadPropertyShort(endian,q+2));
+      tag_value=(size_t) ReadPropertyUnsignedShort(endian,q)+tag_offset;
+      format=(size_t) ReadPropertyUnsignedShort(endian,q+2);
       if (format >= (sizeof(tag_bytes)/sizeof(*tag_bytes)))
         break;
-      components=(ssize_t) ((int) ReadPropertyLong(endian,q+4));
+      components=(ssize_t) ReadPropertySignedLong(endian,q+4);
+      if (components < 0)
+        break;  /* corrupt EXIF */
       number_bytes=(size_t) components*tag_bytes[format];
       if (number_bytes < components)
         break;  /* prevent overflow */
@@ -1337,7 +1433,7 @@ static MagickBooleanType GetEXIFProperty(const Image *image,
           /*
             The directory entry contains an offset.
           */
-          offset=(ssize_t) ((int) ReadPropertyLong(endian,q+8));
+          offset=(ssize_t) ReadPropertySignedLong(endian,q+8);
           if ((offset < 0) || (size_t) offset >= length)
             continue;
           if ((ssize_t) (offset+number_bytes) < offset)
@@ -1349,7 +1445,7 @@ static MagickBooleanType GetEXIFProperty(const Image *image,
       if ((all != 0) || (tag == (size_t) tag_value))
         {
           char
-            buffer[MaxTextExtent],
+            buffer[MagickPathExtent],
             *value;
 
           value=(char *) NULL;
@@ -1369,38 +1465,38 @@ static MagickBooleanType GetEXIFProperty(const Image *image,
             }
             case EXIF_FMT_SSHORT:
             {
-              EXIFMultipleValues(2,"%hd",ReadPropertyShort(endian,p1));
+              EXIFMultipleValues(2,"%hd",ReadPropertySignedShort(endian,p1));
               break;
             }
             case EXIF_FMT_USHORT:
             {
-              EXIFMultipleValues(2,"%hu",ReadPropertyShort(endian,p1));
+              EXIFMultipleValues(2,"%hu",ReadPropertyUnsignedShort(endian,p1));
               break;
             }
             case EXIF_FMT_ULONG:
             {
               EXIFMultipleValues(4,"%.20g",(double)
-                ((int) ReadPropertyLong(endian,p1)));
+                ReadPropertyUnsignedLong(endian,p1));
               break;
             }
             case EXIF_FMT_SLONG:
             {
               EXIFMultipleValues(4,"%.20g",(double)
-                ((int) ReadPropertyLong(endian,p1)));
+                ReadPropertySignedLong(endian,p1));
               break;
             }
             case EXIF_FMT_URATIONAL:
             {
               EXIFMultipleFractions(8,"%.20g/%.20g",(double)
-                ((int) ReadPropertyLong(endian,p1)),(double)
-                ((int) ReadPropertyLong(endian,p1+4)));
+                ReadPropertyUnsignedLong(endian,p1),(double)
+                ReadPropertyUnsignedLong(endian,p1+4));
               break;
             }
             case EXIF_FMT_SRATIONAL:
             {
               EXIFMultipleFractions(8,"%.20g/%.20g",(double)
-                ((int) ReadPropertyLong(endian,p1)),(double)
-                ((int) ReadPropertyLong(endian,p1+4)));
+                ReadPropertySignedLong(endian,p1),(double)
+                ReadPropertySignedLong(endian,p1+4));
               break;
             }
             case EXIF_FMT_SINGLE:
@@ -1460,13 +1556,13 @@ static MagickBooleanType GetEXIFProperty(const Image *image,
                   {
                     if (EXIFTag[i].tag == 0)
                       break;
-                    if ((ssize_t) EXIFTag[i].tag == tag_value)
+                    if (EXIFTag[i].tag == tag_value)
                       {
                         description=EXIFTag[i].description;
                         break;
                       }
                   }
-                  (void) FormatLocaleString(key,MaxTextExtent,"%s",
+                  (void) FormatLocaleString(key,MagickPathExtent,"%s",
                     description);
                   if (level == 2)
                     (void) SubstituteString(&key,"exif:","exif:thumbnail:");
@@ -1475,14 +1571,14 @@ static MagickBooleanType GetEXIFProperty(const Image *image,
                 case 2:
                 {
                   if (tag_value < 0x10000)
-                    (void) FormatLocaleString(key,MaxTextExtent,"#%04lx",
+                    (void) FormatLocaleString(key,MagickPathExtent,"#%04lx",
                       (unsigned long) tag_value);
                   else
                     if (tag_value < 0x20000)
-                      (void) FormatLocaleString(key,MaxTextExtent,"@%04lx",
+                      (void) FormatLocaleString(key,MagickPathExtent,"@%04lx",
                         (unsigned long) (tag_value & 0xffff));
                     else
-                      (void) FormatLocaleString(key,MaxTextExtent,"unknown");
+                      (void) FormatLocaleString(key,MagickPathExtent,"unknown");
                   break;
                 }
                 default:
@@ -1508,7 +1604,7 @@ static MagickBooleanType GetEXIFProperty(const Image *image,
             ssize_t
               offset;
 
-            offset=(ssize_t) ((int) ReadPropertyLong(endian,p));
+            offset=(ssize_t) ReadPropertySignedLong(endian,p);
             if (((size_t) offset < length) && (level < (MaxDirectoryStack-2)))
               {
                 ssize_t
@@ -1527,8 +1623,8 @@ static MagickBooleanType GetEXIFProperty(const Image *image,
                 level++;
                 if ((directory+2+(12*number_entries)) > (exif+length))
                   break;
-                offset=(ssize_t) ((int) ReadPropertyLong(endian,directory+2+(12*
-                  number_entries)));
+                offset=(ssize_t) ReadPropertySignedLong(endian,directory+2+(12*
+                  number_entries));
                 if ((offset != 0) && ((size_t) offset < length) &&
                     (level < (MaxDirectoryStack-2)))
                   {
@@ -1579,21 +1675,21 @@ static MagickBooleanType GetICCProperty(const Image *image,const char *property,
           (void) SetImageProperty((Image *) image,"icc:name",name,exception);
 #else
         char
-          info[MaxTextExtent];
+          info[MagickPathExtent];
 
-        (void) cmsGetProfileInfoASCII(icc_profile,cmsInfoDescription,
-          "en","US",info,MaxTextExtent);
+        (void) cmsGetProfileInfoASCII(icc_profile,cmsInfoDescription,"en","US",
+          info,MagickPathExtent);
         (void) SetImageProperty((Image *) image,"icc:description",info,
           exception);
-        (void) cmsGetProfileInfoASCII(icc_profile,cmsInfoManufacturer,
-          "en","US",info,MaxTextExtent);
+        (void) cmsGetProfileInfoASCII(icc_profile,cmsInfoManufacturer,"en","US",
+          info,MagickPathExtent);
         (void) SetImageProperty((Image *) image,"icc:manufacturer",info,
           exception);
-        (void) cmsGetProfileInfoASCII(icc_profile,cmsInfoModel,"en",
-          "US",info,MaxTextExtent);
+        (void) cmsGetProfileInfoASCII(icc_profile,cmsInfoModel,"en","US",info,
+          MagickPathExtent);
         (void) SetImageProperty((Image *) image,"icc:model",info,exception);
-        (void) cmsGetProfileInfoASCII(icc_profile,cmsInfoCopyright,
-          "en","US",info,MaxTextExtent);
+        (void) cmsGetProfileInfoASCII(icc_profile,cmsInfoCopyright,"en","US",
+          info,MagickPathExtent);
         (void) SetImageProperty((Image *) image,"icc:copyright",info,exception);
 #endif
         (void) cmsCloseProfile(icc_profile);
@@ -1670,6 +1766,9 @@ static MagickBooleanType GetXMPProperty(const Image *image,const char *property)
       description=GetXMLTreeChild(rdf,"rdf:Description");
       while (description != (XMLTreeInfo *) NULL)
       {
+        char
+          *xmp_namespace;
+
         node=GetXMLTreeChild(description,(const char *) NULL);
         while (node != (XMLTreeInfo *) NULL)
         {
@@ -1677,14 +1776,22 @@ static MagickBooleanType GetXMPProperty(const Image *image,const char *property)
           content=GetXMLTreeContent(node);
           if ((child == (XMLTreeInfo *) NULL) &&
               (SkipXMPValue(content) == MagickFalse))
-            (void) AddValueToSplayTree((SplayTreeInfo *) image->properties,
-              ConstantString(GetXMLTreeTag(node)),ConstantString(content));
+            {
+              xmp_namespace=ConstantString(GetXMLTreeTag(node));
+              (void) SubstituteString(&xmp_namespace,"exif:","xmp:");
+              (void) AddValueToSplayTree((SplayTreeInfo *) image->properties,
+                xmp_namespace,ConstantString(content));
+            }
           while (child != (XMLTreeInfo *) NULL)
           {
             content=GetXMLTreeContent(child);
             if (SkipXMPValue(content) == MagickFalse)
-              (void) AddValueToSplayTree((SplayTreeInfo *) image->properties,
-                ConstantString(GetXMLTreeTag(child)),ConstantString(content));
+              {
+                xmp_namespace=ConstantString(GetXMLTreeTag(node));
+                (void) SubstituteString(&xmp_namespace,"exif:","xmp:");
+                (void) AddValueToSplayTree((SplayTreeInfo *) image->properties,
+                  xmp_namespace,ConstantString(content));
+              }
             child=GetXMLTreeSibling(child);
           }
           node=GetXMLTreeSibling(node);
@@ -1696,8 +1803,7 @@ static MagickBooleanType GetXMPProperty(const Image *image,const char *property)
   return(status);
 }
 
-static char *TracePSClippath(const unsigned char *blob,size_t length,
-  const size_t magick_unused(columns),const size_t magick_unused(rows))
+static char *TracePSClippath(const unsigned char *blob,size_t length)
 {
   char
     *path,
@@ -1724,30 +1830,33 @@ static char *TracePSClippath(const unsigned char *blob,size_t length,
   if (path == (char *) NULL)
     return((char *) NULL);
   message=AcquireString((char *) NULL);
-  (void) FormatLocaleString(message,MaxTextExtent,"/ClipImage\n");
+  (void) FormatLocaleString(message,MagickPathExtent,"/ClipImage\n");
   (void) ConcatenateString(&path,message);
-  (void) FormatLocaleString(message,MaxTextExtent,"{\n");
+  (void) FormatLocaleString(message,MagickPathExtent,"{\n");
   (void) ConcatenateString(&path,message);
-  (void) FormatLocaleString(message,MaxTextExtent,"  /c {curveto} bind def\n");
+  (void) FormatLocaleString(message,MagickPathExtent,
+    "  /c {curveto} bind def\n");
   (void) ConcatenateString(&path,message);
-  (void) FormatLocaleString(message,MaxTextExtent,"  /l {lineto} bind def\n");
+  (void) FormatLocaleString(message,MagickPathExtent,
+    "  /l {lineto} bind def\n");
   (void) ConcatenateString(&path,message);
-  (void) FormatLocaleString(message,MaxTextExtent,"  /m {moveto} bind def\n");
+  (void) FormatLocaleString(message,MagickPathExtent,
+    "  /m {moveto} bind def\n");
   (void) ConcatenateString(&path,message);
-  (void) FormatLocaleString(message,MaxTextExtent,
+  (void) FormatLocaleString(message,MagickPathExtent,
     "  /v {currentpoint 6 2 roll curveto} bind def\n");
   (void) ConcatenateString(&path,message);
-  (void) FormatLocaleString(message,MaxTextExtent,
+  (void) FormatLocaleString(message,MagickPathExtent,
     "  /y {2 copy curveto} bind def\n");
   (void) ConcatenateString(&path,message);
-  (void) FormatLocaleString(message,MaxTextExtent,
+  (void) FormatLocaleString(message,MagickPathExtent,
     "  /z {closepath} bind def\n");
   (void) ConcatenateString(&path,message);
-  (void) FormatLocaleString(message,MaxTextExtent,"  newpath\n");
+  (void) FormatLocaleString(message,MagickPathExtent,"  newpath\n");
   (void) ConcatenateString(&path,message);
   /*
-    The clipping path format is defined in "Adobe Photoshop File
-    Formats Specification" version 6.0 downloadable from adobe.com.
+    The clipping path format is defined in "Adobe Photoshop File Formats
+    Specification" version 6.0 downloadable from adobe.com.
   */
   (void) ResetMagickMemory(point,0,sizeof(point));
   (void) ResetMagickMemory(first,0,sizeof(first));
@@ -1756,7 +1865,7 @@ static char *TracePSClippath(const unsigned char *blob,size_t length,
   in_subpath=MagickFalse;
   while (length > 0)
   {
-    selector=(ssize_t) ((int) ReadPropertyMSBShort(&blob,&length));
+    selector=(ssize_t) ReadPropertyMSBShort(&blob,&length);
     switch (selector)
     {
       case 0:
@@ -1771,7 +1880,7 @@ static char *TracePSClippath(const unsigned char *blob,size_t length,
         /*
           Expected subpath length record.
         */
-        knot_count=(ssize_t) ((int) ReadPropertyMSBShort(&blob,&length));
+        knot_count=(ssize_t) ReadPropertyMSBShort(&blob,&length);
         blob+=22;
         length-=MagickMin(22,(ssize_t) length);
         break;
@@ -1799,8 +1908,8 @@ static char *TracePSClippath(const unsigned char *blob,size_t length,
             xx,
             yy;
 
-          yy=(size_t) ((int) ReadPropertyMSBLong(&blob,&length));
-          xx=(size_t) ((int) ReadPropertyMSBLong(&blob,&length));
+          yy=(size_t) ReadPropertyMSBLong(&blob,&length);
+          xx=(size_t) ReadPropertyMSBLong(&blob,&length);
           x=(ssize_t) xx;
           if (xx > 2147483647)
             x=(ssize_t) xx-4294967295U-1;
@@ -1810,9 +1919,9 @@ static char *TracePSClippath(const unsigned char *blob,size_t length,
           point[i].x=(double) x/4096/4096;
           point[i].y=1.0-(double) y/4096/4096;
         }
-        if( IfMagickFalse(in_subpath) )
+        if (in_subpath == MagickFalse)
           {
-            (void) FormatLocaleString(message,MaxTextExtent,"  %g %g m\n",
+            (void) FormatLocaleString(message,MagickPathExtent,"  %g %g m\n",
               point[1].x,point[1].y);
             for (i=0; i < 3; i++)
             {
@@ -1828,20 +1937,20 @@ static char *TracePSClippath(const unsigned char *blob,size_t length,
             */
             if ((last[1].x == last[2].x) && (last[1].y == last[2].y) &&
                 (point[0].x == point[1].x) && (point[0].y == point[1].y))
-              (void) FormatLocaleString(message,MaxTextExtent,
+              (void) FormatLocaleString(message,MagickPathExtent,
                 "  %g %g l\n",point[1].x,point[1].y);
             else
               if ((last[1].x == last[2].x) && (last[1].y == last[2].y))
-                (void) FormatLocaleString(message,MaxTextExtent,
+                (void) FormatLocaleString(message,MagickPathExtent,
                   "  %g %g %g %g v\n",point[0].x,point[0].y,
                   point[1].x,point[1].y);
               else
                 if ((point[0].x == point[1].x) && (point[0].y == point[1].y))
-                  (void) FormatLocaleString(message,MaxTextExtent,
+                  (void) FormatLocaleString(message,MagickPathExtent,
                     "  %g %g %g %g y\n",last[2].x,last[2].y,
                     point[1].x,point[1].y);
                 else
-                  (void) FormatLocaleString(message,MaxTextExtent,
+                  (void) FormatLocaleString(message,MagickPathExtent,
                     "  %g %g %g %g %g %g c\n",last[2].x,
                     last[2].y,point[0].x,point[0].y,point[1].x,point[1].y);
             for (i=0; i < 3; i++)
@@ -1861,20 +1970,20 @@ static char *TracePSClippath(const unsigned char *blob,size_t length,
             */
             if ((last[1].x == last[2].x) && (last[1].y == last[2].y) &&
                 (first[0].x == first[1].x) && (first[0].y == first[1].y))
-              (void) FormatLocaleString(message,MaxTextExtent,
+              (void) FormatLocaleString(message,MagickPathExtent,
                 "  %g %g l z\n",first[1].x,first[1].y);
             else
               if ((last[1].x == last[2].x) && (last[1].y == last[2].y))
-                (void) FormatLocaleString(message,MaxTextExtent,
+                (void) FormatLocaleString(message,MagickPathExtent,
                   "  %g %g %g %g v z\n",first[0].x,first[0].y,
                   first[1].x,first[1].y);
               else
                 if ((first[0].x == first[1].x) && (first[0].y == first[1].y))
-                  (void) FormatLocaleString(message,MaxTextExtent,
+                  (void) FormatLocaleString(message,MagickPathExtent,
                     "  %g %g %g %g y z\n",last[2].x,last[2].y,
                     first[1].x,first[1].y);
                 else
-                  (void) FormatLocaleString(message,MaxTextExtent,
+                  (void) FormatLocaleString(message,MagickPathExtent,
                     "  %g %g %g %g %g %g c z\n",last[2].x,
                     last[2].y,first[0].x,first[0].y,first[1].x,first[1].y);
             (void) ConcatenateString(&path,message);
@@ -1896,9 +2005,9 @@ static char *TracePSClippath(const unsigned char *blob,size_t length,
   /*
     Returns an empty PS path if the path has no knots.
   */
-  (void) FormatLocaleString(message,MaxTextExtent,"  eoclip\n");
+  (void) FormatLocaleString(message,MagickPathExtent,"  eoclip\n");
   (void) ConcatenateString(&path,message);
-  (void) FormatLocaleString(message,MaxTextExtent,"} bind def");
+  (void) FormatLocaleString(message,MagickPathExtent,"} bind def");
   (void) ConcatenateString(&path,message);
   message=DestroyString(message);
   return(path);
@@ -1932,14 +2041,14 @@ static char *TraceSVGClippath(const unsigned char *blob,size_t length,
   if (path == (char *) NULL)
     return((char *) NULL);
   message=AcquireString((char *) NULL);
-    (void) FormatLocaleString(message,MaxTextExtent,
-    ("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n"
+  (void) FormatLocaleString(message,MagickPathExtent,(
+    "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n"
     "<svg xmlns=\"http://www.w3.org/2000/svg\""
     " width=\"%.20g\" height=\"%.20g\">\n"
     "<g>\n"
-    "<path fill-rule=\"evenodd\" style=\"fill:#00000000;stroke:#00000000;"
-    "stroke-width:0;stroke-antialiasing:false\" d=\"\n"),
-    (double) columns,(double) rows);
+    "<path fill-rule=\"evenodd\" style=\"fill:#000000;stroke:#000000;"
+    "stroke-width:0;stroke-antialiasing:false\" d=\"\n"),(double) columns,
+    (double) rows);
   (void) ConcatenateString(&path,message);
   (void) ResetMagickMemory(point,0,sizeof(point));
   (void) ResetMagickMemory(first,0,sizeof(first));
@@ -1948,7 +2057,7 @@ static char *TraceSVGClippath(const unsigned char *blob,size_t length,
   in_subpath=MagickFalse;
   while (length != 0)
   {
-    selector=(ssize_t) ((int) ReadPropertyMSBShort(&blob,&length));
+    selector=(ssize_t) ReadPropertyMSBShort(&blob,&length);
     switch (selector)
     {
       case 0:
@@ -1963,7 +2072,7 @@ static char *TraceSVGClippath(const unsigned char *blob,size_t length,
         /*
           Expected subpath length record.
         */
-        knot_count=(ssize_t) ((int) ReadPropertyMSBShort(&blob,&length));
+        knot_count=(ssize_t) ReadPropertyMSBShort(&blob,&length);
         blob+=22;
         length-=MagickMin(22,(ssize_t) length);
         break;
@@ -1991,8 +2100,8 @@ static char *TraceSVGClippath(const unsigned char *blob,size_t length,
             xx,
             yy;
 
-          yy=(unsigned int) ((int) ReadPropertyMSBLong(&blob,&length));
-          xx=(unsigned int) ((int) ReadPropertyMSBLong(&blob,&length));
+          yy=(unsigned int) ReadPropertyMSBLong(&blob,&length);
+          xx=(unsigned int) ReadPropertyMSBLong(&blob,&length);
           x=(ssize_t) xx;
           if (xx > 2147483647)
             x=(ssize_t) xx-4294967295U-1;
@@ -2004,7 +2113,7 @@ static char *TraceSVGClippath(const unsigned char *blob,size_t length,
         }
         if (in_subpath == MagickFalse)
           {
-            (void) FormatLocaleString(message,MaxTextExtent,"M %g %g\n",
+            (void) FormatLocaleString(message,MagickPathExtent,"M %g %g\n",
               point[1].x,point[1].y);
             for (i=0; i < 3; i++)
             {
@@ -2020,10 +2129,10 @@ static char *TraceSVGClippath(const unsigned char *blob,size_t length,
             */
             if ((last[1].x == last[2].x) && (last[1].y == last[2].y) &&
                 (point[0].x == point[1].x) && (point[0].y == point[1].y))
-              (void) FormatLocaleString(message,MaxTextExtent,
+              (void) FormatLocaleString(message,MagickPathExtent,
                 "L %g %g\n",point[1].x,point[1].y);
             else
-              (void) FormatLocaleString(message,MaxTextExtent,
+              (void) FormatLocaleString(message,MagickPathExtent,
                 "C %g %g %g %g %g %g\n",last[2].x,
                 last[2].y,point[0].x,point[0].y,point[1].x,point[1].y);
             for (i=0; i < 3; i++)
@@ -2043,10 +2152,10 @@ static char *TraceSVGClippath(const unsigned char *blob,size_t length,
             */
             if ((last[1].x == last[2].x) && (last[1].y == last[2].y) &&
                 (first[0].x == first[1].x) && (first[0].y == first[1].y))
-              (void) FormatLocaleString(message,MaxTextExtent,
+              (void) FormatLocaleString(message,MagickPathExtent,
                 "L %g %g Z\n",first[1].x,first[1].y);
             else
-              (void) FormatLocaleString(message,MaxTextExtent,
+              (void) FormatLocaleString(message,MagickPathExtent,
                 "C %g %g %g %g %g %g Z\n",last[2].x,
                 last[2].y,first[0].x,first[0].y,first[1].x,first[1].y);
             (void) ConcatenateString(&path,message);
@@ -2080,8 +2189,8 @@ MagickExport const char *GetImageProperty(const Image *image,
     *p;
 
   assert(image != (Image *) NULL);
-  assert(image->signature == MagickSignature);
-  if (IfMagickTrue(image->debug))
+  assert(image->signature == MagickCoreSignature);
+  if (image->debug != MagickFalse)
     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
   p=(const char *) NULL;
   if (image->properties != (void *) NULL)
@@ -2250,43 +2359,49 @@ MagickExport const char *GetImageProperty(const Image *image,
 %    o exception: return any errors or warnings in this structure.
 %
 */
+static const char *GetMagickPropertyLetter(ImageInfo *image_info,
+  Image *image,const char letter,ExceptionInfo *exception)
+{
 #define WarnNoImageReturn(format,arg) \
   if (image == (Image *) NULL ) { \
     (void) ThrowMagickException(exception,GetMagickModule(),OptionWarning, \
-        "NoImageForProperty",format,arg); \
+      "NoImageForProperty",format,arg); \
     return((const char *) NULL); \
   }
 #define WarnNoImageInfoReturn(format,arg) \
   if (image_info == (ImageInfo *) NULL ) { \
     (void) ThrowMagickException(exception,GetMagickModule(),OptionWarning, \
-        "NoImageInfoForProperty",format,arg); \
+      "NoImageInfoForProperty",format,arg); \
     return((const char *) NULL); \
   }
 
-static const char *GetMagickPropertyLetter(ImageInfo *image_info,
-  Image *image,const char letter,ExceptionInfo *exception)
-{
   char
-    value[MaxTextExtent];  /* formated string to store as a returned artifact */
+    value[MagickPathExtent];  /* formatted string to store as an artifact */
 
   const char
     *string;     /* return a string already stored somewher */
 
-  if (image != (Image *) NULL && IfMagickTrue(image->debug))
+  if ((image != (Image *) NULL) && (image->debug != MagickFalse))
     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
-  else if( image_info != (ImageInfo *) NULL && IfMagickTrue(image_info->debug))
+  else
+    if ((image_info != (ImageInfo *) NULL) &&
+        (image_info->debug != MagickFalse))
     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s","no-images");
-
   *value='\0';           /* formatted string */
   string=(char *) NULL;  /* constant string reference */
-
-  /* Get properities that are directly defined by images */
+  /*
+    Get properities that are directly defined by images.
+  */
   switch (letter)
   {
     case 'b':  /* image size read in - in bytes */
     {
       WarnNoImageReturn("\"%%%c\"",letter);
-      (void) FormatMagickSize(image->extent,MagickFalse,"B",value);
+      (void) FormatMagickSize(image->extent,MagickFalse,"B",MagickPathExtent,
+        value);
+      if (image->extent == 0)
+        (void) FormatMagickSize(GetBlobSize(image),MagickFalse,"B",
+          MagickPathExtent,value);
       break;
     }
     case 'c':  /* image comment property - empty string by default */
@@ -2301,35 +2416,38 @@ static const char *GetMagickPropertyLetter(ImageInfo *image_info,
     {
       WarnNoImageReturn("\"%%%c\"",letter);
       GetPathComponent(image->magick_filename,HeadPath,value);
-      if (*value == '\0') string="";
+      if (*value == '\0')
+        string="";
       break;
     }
     case 'e': /* Filename extension (suffix) of image file */
     {
       WarnNoImageReturn("\"%%%c\"",letter);
       GetPathComponent(image->magick_filename,ExtensionPath,value);
-      if (*value == '\0') string="";
+      if (*value == '\0')
+        string="";
       break;
     }
     case 'f': /* Filename without directory component */
     {
       WarnNoImageReturn("\"%%%c\"",letter);
       GetPathComponent(image->magick_filename,TailPath,value);
-      if (*value == '\0') string="";
+      if (*value == '\0')
+        string="";
       break;
     }
     case 'g': /* Image geometry, canvas and offset  %Wx%H+%X+%Y */
     {
       WarnNoImageReturn("\"%%%c\"",letter);
-      (void) FormatLocaleString(value,MaxTextExtent,"%.20gx%.20g%+.20g%+.20g",
-        (double) image->page.width,(double) image->page.height,
-        (double) image->page.x,(double) image->page.y);
+      (void) FormatLocaleString(value,MagickPathExtent,
+        "%.20gx%.20g%+.20g%+.20g",(double) image->page.width,(double)
+        image->page.height,(double) image->page.x,(double) image->page.y);
       break;
     }
     case 'h': /* Image height (current) */
     {
       WarnNoImageReturn("\"%%%c\"",letter);
-      (void) FormatLocaleString(value,MaxTextExtent,"%.20g",(double)
+      (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double)
         (image->rows != 0 ? image->rows : image->magick_rows));
       break;
     }
@@ -2345,7 +2463,7 @@ static const char *GetMagickPropertyLetter(ImageInfo *image_info,
         FUTURE: ensure this does not generate the formatted comment!
       */
       WarnNoImageReturn("\"%%%c\"",letter);
-      (void) FormatLocaleString(value,MaxTextExtent,"%.20g",(double)
+      (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double)
         GetNumberColors(image,(FILE *) NULL,exception));
       break;
     }
@@ -2353,7 +2471,7 @@ static const char *GetMagickPropertyLetter(ImageInfo *image_info,
     {
       WarnNoImageReturn("\"%%%c\"",letter);
       string=GetImageProperty(image,"label",exception);
-      if ( string == (const char *) NULL)
+      if (string == (const char *) NULL)
         string="";
       break;
     }
@@ -2366,7 +2484,7 @@ static const char *GetMagickPropertyLetter(ImageInfo *image_info,
     case 'n': /* Number of images in the list.  */
     {
       if ( image != (Image *) NULL )
-        (void) FormatLocaleString(value,MaxTextExtent,"%.20g",(double)
+        (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double)
           GetImageListLength(image));
       else
         string="0";    /* no images or scenes */
@@ -2379,14 +2497,14 @@ static const char *GetMagickPropertyLetter(ImageInfo *image_info,
     case 'p': /* Image index in current image list */
     {
       WarnNoImageReturn("\"%%%c\"",letter);
-      (void) FormatLocaleString(value,MaxTextExtent,"%.20g",(double)
+      (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double)
         GetImageIndexInList(image));
       break;
     }
     case 'q': /* Quantum depth of image in memory */
     {
       WarnNoImageReturn("\"%%%c\"",letter);
-      (void) FormatLocaleString(value,MaxTextExtent,"%.20g",(double)
+      (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double)
         MAGICKCORE_QUANTUM_DEPTH);
       break;
     }
@@ -2397,28 +2515,29 @@ static const char *GetMagickPropertyLetter(ImageInfo *image_info,
 
       WarnNoImageReturn("\"%%%c\"",letter);
       colorspace=image->colorspace;
-      if (IfMagickTrue(IsImageGray(image,exception)))
+      if (SetImageGray(image,exception) != MagickFalse)
         colorspace=GRAYColorspace;   /* FUTURE: this is IMv6 not IMv7 */
-      (void) FormatLocaleString(value,MaxTextExtent,"%s %s %s",
-        CommandOptionToMnemonic(MagickClassOptions,(ssize_t) image->storage_class),
-        CommandOptionToMnemonic(MagickColorspaceOptions,(ssize_t) colorspace),
-        image->alpha_trait != UndefinedPixelTrait ? "Alpha" : "");
+      (void) FormatLocaleString(value,MagickPathExtent,"%s %s %s",
+        CommandOptionToMnemonic(MagickClassOptions,(ssize_t)
+        image->storage_class),CommandOptionToMnemonic(MagickColorspaceOptions,
+        (ssize_t) colorspace),image->alpha_trait != UndefinedPixelTrait ?
+        "Alpha" : "");
       break;
     }
     case 's': /* Image scene number */
     {
 #if 0  /* this seems non-sensical -- simplifing */
       if (image_info->number_scenes != 0)
-        (void) FormatLocaleString(value,MaxTextExtent,"%.20g",(double)
+        (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double)
           image_info->scene);
       else if (image != (Image *) NULL)
-        (void) FormatLocaleString(value,MaxTextExtent,"%.20g",(double)
+        (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double)
           image->scene);
       else
           string="0";
 #else
       WarnNoImageReturn("\"%%%c\"",letter);
-      (void) FormatLocaleString(value,MaxTextExtent,"%.20g",(double)
+      (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double)
          image->scene);
 #endif
       break;
@@ -2427,74 +2546,77 @@ static const char *GetMagickPropertyLetter(ImageInfo *image_info,
     {
       WarnNoImageReturn("\"%%%c\"",letter);
       GetPathComponent(image->magick_filename,BasePath,value);
-      if (*value == '\0') string="";
+      if (*value == '\0')
+        string="";
       break;
     }
     case 'u': /* Unique filename */
+    {
       WarnNoImageInfoReturn("\"%%%c\"",letter);
       string=image_info->unique;
       break;
+    }
     case 'w': /* Image width (current) */
     {
       WarnNoImageReturn("\"%%%c\"",letter);
-      (void) FormatLocaleString(value,MaxTextExtent,"%.20g",(double)
+      (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double)
         (image->columns != 0 ? image->columns : image->magick_columns));
       break;
     }
     case 'x': /* Image horizontal resolution (with units) */
     {
       WarnNoImageReturn("\"%%%c\"",letter);
-      (void) FormatLocaleString(value,MaxTextExtent,"%.20g",
+      (void) FormatLocaleString(value,MagickPathExtent,"%.20g",
         fabs(image->resolution.x) > MagickEpsilon ? image->resolution.x : 72.0);
       break;
     }
     case 'y': /* Image vertical resolution (with units) */
     {
       WarnNoImageReturn("\"%%%c\"",letter);
-      (void) FormatLocaleString(value,MaxTextExtent,"%.20g",
+      (void) FormatLocaleString(value,MagickPathExtent,"%.20g",
         fabs(image->resolution.y) > MagickEpsilon ? image->resolution.y : 72.0);
       break;
     }
     case 'z': /* Image depth as read in */
     {
       WarnNoImageReturn("\"%%%c\"",letter);
-      (void) FormatLocaleString(value,MaxTextExtent,"%.20g",
-        (double) image->depth);
+      (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double)
+        image->depth);
       break;
     }
     case 'A': /* Image alpha channel  */
     {
       WarnNoImageReturn("\"%%%c\"",letter);
-      string=CommandOptionToMnemonic(MagickBooleanOptions,
-        (ssize_t) image->alpha_trait);
+      string=CommandOptionToMnemonic(MagickPixelTraitOptions,(ssize_t)
+        image->alpha_trait);
       break;
     }
     case 'C': /* Image compression method.  */
     {
       WarnNoImageReturn("\"%%%c\"",letter);
-      string=CommandOptionToMnemonic(MagickCompressOptions,
-        (ssize_t) image->compression);
+      string=CommandOptionToMnemonic(MagickCompressOptions,(ssize_t)
+        image->compression);
       break;
     }
     case 'D': /* Image dispose method.  */
     {
       WarnNoImageReturn("\"%%%c\"",letter);
-      string=CommandOptionToMnemonic(MagickDisposeOptions,
-        (ssize_t) image->dispose);
+      string=CommandOptionToMnemonic(MagickDisposeOptions,(ssize_t)
+        image->dispose);
       break;
     }
     case 'G': /* Image size as geometry = "%wx%h" */
     {
       WarnNoImageReturn("\"%%%c\"",letter);
-      (void) FormatLocaleString(value,MaxTextExtent,"%.20gx%.20g",
-        (double)image->magick_columns,(double) image->magick_rows);
+      (void) FormatLocaleString(value,MagickPathExtent,"%.20gx%.20g",(double)
+        image->magick_columns,(double) image->magick_rows);
       break;
     }
     case 'H': /* layer canvas height */
     {
       WarnNoImageReturn("\"%%%c\"",letter);
-      (void) FormatLocaleString(value,MaxTextExtent,"%.20g",
-        (double) image->page.height);
+      (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double)
+        image->page.height);
       break;
     }
     case 'M': /* Magick filename - filename given incl. coder & read mods */
@@ -2506,21 +2628,21 @@ static const char *GetMagickPropertyLetter(ImageInfo *image_info,
     case 'O': /* layer canvas offset with sign = "+%X+%Y" */
     {
       WarnNoImageReturn("\"%%%c\"",letter);
-      (void) FormatLocaleString(value,MaxTextExtent,"%+ld%+ld",(long)
+      (void) FormatLocaleString(value,MagickPathExtent,"%+ld%+ld",(long)
         image->page.x,(long) image->page.y);
       break;
     }
     case 'P': /* layer canvas page size = "%Wx%H" */
     {
       WarnNoImageReturn("\"%%%c\"",letter);
-      (void) FormatLocaleString(value,MaxTextExtent,"%.20gx%.20g",
-        (double) image->page.width,(double) image->page.height);
+      (void) FormatLocaleString(value,MagickPathExtent,"%.20gx%.20g",(double)
+        image->page.width,(double) image->page.height);
       break;
     }
     case 'Q': /* image compression quality */
     {
       WarnNoImageReturn("\"%%%c\"",letter);
-      (void) FormatLocaleString(value,MaxTextExtent,"%.20g",(double)
+      (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double)
         (image->quality == 0 ? 92 : image->quality));
       break;
     }
@@ -2531,12 +2653,12 @@ static const char *GetMagickPropertyLetter(ImageInfo *image_info,
       if (image_info->number_scenes == 0)
          string="2147483647";
       else if ( image != (Image *) NULL )
-        (void) FormatLocaleString(value,MaxTextExtent,"%.20g",(double)
+        (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double)
                 image_info->scene+image_info->number_scenes);
       else
         string="0";
 #else
-      (void) FormatLocaleString(value,MaxTextExtent,"%.20g",(double)
+      (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double)
         (image_info->number_scenes == 0 ? 2147483647 :
          image_info->number_scenes));
 #endif
@@ -2545,45 +2667,43 @@ static const char *GetMagickPropertyLetter(ImageInfo *image_info,
     case 'T': /* image time delay for animations */
     {
       WarnNoImageReturn("\"%%%c\"",letter);
-      (void) FormatLocaleString(value,MaxTextExtent,"%.20g",(double)
+      (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double)
         image->delay);
       break;
     }
     case 'U': /* Image resolution units. */
     {
       WarnNoImageReturn("\"%%%c\"",letter);
-      string=CommandOptionToMnemonic(MagickResolutionOptions,
-        (ssize_t) image->units);
+      string=CommandOptionToMnemonic(MagickResolutionOptions,(ssize_t)
+        image->units);
       break;
     }
     case 'W': /* layer canvas width */
     {
       WarnNoImageReturn("\"%%%c\"",letter);
-      (void) FormatLocaleString(value,MaxTextExtent,"%.20g",(double)
+      (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double)
         image->page.width);
       break;
     }
     case 'X': /* layer canvas X offset */
     {
       WarnNoImageReturn("\"%%%c\"",letter);
-      (void) FormatLocaleString(value,MaxTextExtent,"%+.20g",(double)
+      (void) FormatLocaleString(value,MagickPathExtent,"%+.20g",(double)
         image->page.x);
       break;
     }
     case 'Y': /* layer canvas Y offset */
     {
       WarnNoImageReturn("\"%%%c\"",letter);
-      (void) FormatLocaleString(value,MaxTextExtent,"%+.20g",(double)
+      (void) FormatLocaleString(value,MagickPathExtent,"%+.20g",(double)
         image->page.y);
       break;
     }
-    case 'Z': /* Zero filename ??? */
-      WarnNoImageInfoReturn("\"%%%c\"",letter);
-      string=image_info->zero;
-      break;
     case '%': /* percent escaped */
+    {
       string="%";
       break;
+    }
     case '@': /* Trim bounding box, without actually Trimming! */
     {
       RectangleInfo
@@ -2591,9 +2711,9 @@ static const char *GetMagickPropertyLetter(ImageInfo *image_info,
 
       WarnNoImageReturn("\"%%%c\"",letter);
       page=GetImageBoundingBox(image,exception);
-      (void) FormatLocaleString(value,MaxTextExtent,"%.20gx%.20g%+.20g%+.20g",
-        (double) page.width,(double) page.height,(double) page.x,(double)
-        page.y);
+      (void) FormatLocaleString(value,MagickPathExtent,
+        "%.20gx%.20g%+.20g%+.20g",(double) page.width,(double) page.height,
+        (double) page.x,(double)page.y);
       break;
     }
     case '#':
@@ -2632,40 +2752,39 @@ MagickExport const char *GetMagickProperty(ImageInfo *image_info,
   Image *image,const char *property,ExceptionInfo *exception)
 {
   char
-    value[MaxTextExtent];
+    value[MagickPathExtent];
 
   const char
     *string;
 
   assert(property[0] != '\0');
   assert(image != (Image *) NULL || image_info != (ImageInfo *) NULL );
-
   if (property[1] == '\0')  /* single letter property request */
     return(GetMagickPropertyLetter(image_info,image,*property,exception));
-
-  if (image != (Image *) NULL && IfMagickTrue(image->debug))
+  if ((image != (Image *) NULL) && (image->debug != MagickFalse))
     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
-  else if( image_info != (ImageInfo *) NULL && IfMagickTrue(image_info->debug))
+  else
+    if ((image_info != (ImageInfo *) NULL) &&
+        (image_info->debug != MagickFalse))
     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s","no-images");
-
   *value='\0';           /* formated string */
   string=(char *) NULL;  /* constant string reference */
   switch (*property)
   {
     case 'b':
     {
-      if ((LocaleCompare("base",property) == 0) ||
-          (LocaleCompare("basename",property) == 0) )
+      if (LocaleCompare("basename",property) == 0)
         {
           WarnNoImageReturn("\"%%[%s]\"",property);
           GetPathComponent(image->magick_filename,BasePath,value);
-          if (*value == '\0') string="";
+          if (*value == '\0')
+            string="";
           break;
         }
       if (LocaleCompare("bit-depth",property) == 0)
         {
-          (void) FormatLocaleString(value,MaxTextExtent,"%.20g",(double)
-            GetImageDepth(image, exception));
+          (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double)
+            GetImageDepth(image,exception));
           break;
         }
       break;
@@ -2676,12 +2795,12 @@ MagickExport const char *GetMagickProperty(ImageInfo *image_info,
         {
           WarnNoImageReturn("\"%%[%s]\"",property);
           /* FUTURE: return actual image channels */
-          (void) FormatLocaleString(value,MaxTextExtent,"%s",
+          (void) FormatLocaleString(value,MagickPathExtent,"%s",
             CommandOptionToMnemonic(MagickColorspaceOptions,(ssize_t)
             image->colorspace));
           LocaleLower(value);
           if( image->alpha_trait != UndefinedPixelTrait )
-            (void) ConcatenateMagickString(value,"a",MaxTextExtent);
+            (void) ConcatenateMagickString(value,"a",MagickPathExtent);
           break;
         }
       if (LocaleCompare("colorspace",property) == 0)
@@ -2692,9 +2811,16 @@ MagickExport const char *GetMagickProperty(ImageInfo *image_info,
             image->colorspace);
           break;
         }
+      if (LocaleCompare("compose",property) == 0)
+        {
+          WarnNoImageReturn("\"%%[%s]\"",property);
+          string=CommandOptionToMnemonic(MagickComposeOptions,(ssize_t)
+            image->compose);
+          break;
+        }
       if (LocaleCompare("copyright",property) == 0)
         {
-          (void) CopyMagickString(value,GetMagickCopyright(),MaxTextExtent);
+          (void) CopyMagickString(value,GetMagickCopyright(),MagickPathExtent);
           break;
         }
       break;
@@ -2704,7 +2830,7 @@ MagickExport const char *GetMagickProperty(ImageInfo *image_info,
       if (LocaleCompare("depth",property) == 0)
         {
           WarnNoImageReturn("\"%%[%s]\"",property);
-          (void) FormatLocaleString(value,MaxTextExtent,"%.20g",(double)
+          (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double)
             image->depth);
           break;
         }
@@ -2712,7 +2838,8 @@ MagickExport const char *GetMagickProperty(ImageInfo *image_info,
         {
           WarnNoImageReturn("\"%%[%s]\"",property);
           GetPathComponent(image->magick_filename,HeadPath,value);
-          if (*value == '\0') string="";
+          if (*value == '\0')
+            string="";
           break;
         }
       break;
@@ -2726,7 +2853,7 @@ MagickExport const char *GetMagickProperty(ImageInfo *image_info,
 
           WarnNoImageReturn("\"%%[%s]\"",property);
           (void) GetImageEntropy(image,&entropy,exception);
-          (void) FormatLocaleString(value,MaxTextExtent,"%.*g",
+          (void) FormatLocaleString(value,MagickPathExtent,"%.*g",
             GetMagickPrecision(),entropy);
           break;
         }
@@ -2734,7 +2861,8 @@ MagickExport const char *GetMagickProperty(ImageInfo *image_info,
         {
           WarnNoImageReturn("\"%%[%s]\"",property);
           GetPathComponent(image->magick_filename,ExtensionPath,value);
-          if (*value == '\0') string="";
+          if (*value == '\0')
+            string="";
           break;
         }
       break;
@@ -2744,17 +2872,10 @@ MagickExport const char *GetMagickProperty(ImageInfo *image_info,
       if (LocaleCompare("gamma",property) == 0)
         {
           WarnNoImageReturn("\"%%[%s]\"",property);
-          (void) FormatLocaleString(value,MaxTextExtent,"%.*g",
+          (void) FormatLocaleString(value,MagickPathExtent,"%.*g",
             GetMagickPrecision(),image->gamma);
           break;
         }
-      if (LocaleCompare("group",property) == 0)
-        {
-          WarnNoImageInfoReturn("\"%%[%s]\"",property);
-          (void) FormatLocaleString(value,MaxTextExtent,"0x%lx",(unsigned long)
-            image_info->group);
-          break;
-        }
       break;
     }
     case 'h':
@@ -2762,7 +2883,7 @@ MagickExport const char *GetMagickProperty(ImageInfo *image_info,
       if (LocaleCompare("height",property) == 0)
         {
           WarnNoImageReturn("\"%%[%s]\"",property);
-          (void) FormatLocaleString(value,MaxTextExtent,"%.20g",
+          (void) FormatLocaleString(value,MagickPathExtent,"%.20g",
             image->magick_rows != 0 ? (double) image->magick_rows : 256.0);
           break;
         }
@@ -2788,7 +2909,7 @@ MagickExport const char *GetMagickProperty(ImageInfo *image_info,
 
           WarnNoImageReturn("\"%%[%s]\"",property);
           (void) GetImageKurtosis(image,&kurtosis,&skewness,exception);
-          (void) FormatLocaleString(value,MaxTextExtent,"%.*g",
+          (void) FormatLocaleString(value,MagickPathExtent,"%.*g",
             GetMagickPrecision(),kurtosis);
           break;
         }
@@ -2802,7 +2923,8 @@ MagickExport const char *GetMagickProperty(ImageInfo *image_info,
           string=image->magick;
           break;
         }
-      if (LocaleCompare("max",property) == 0)
+      if ((LocaleCompare("maxima",property) == 0) ||
+          (LocaleCompare("max",property) == 0))
         {
           double
             maximum,
@@ -2810,7 +2932,7 @@ MagickExport const char *GetMagickProperty(ImageInfo *image_info,
 
           WarnNoImageReturn("\"%%[%s]\"",property);
           (void) GetImageRange(image,&minimum,&maximum,exception);
-          (void) FormatLocaleString(value,MaxTextExtent,"%.*g",
+          (void) FormatLocaleString(value,MagickPathExtent,"%.*g",
             GetMagickPrecision(),maximum);
           break;
         }
@@ -2822,11 +2944,12 @@ MagickExport const char *GetMagickProperty(ImageInfo *image_info,
 
           WarnNoImageReturn("\"%%[%s]\"",property);
           (void) GetImageMean(image,&mean,&standard_deviation,exception);
-          (void) FormatLocaleString(value,MaxTextExtent,"%.*g",
+          (void) FormatLocaleString(value,MagickPathExtent,"%.*g",
             GetMagickPrecision(),mean);
           break;
         }
-      if (LocaleCompare("min",property) == 0)
+      if ((LocaleCompare("minima",property) == 0) ||
+          (LocaleCompare("min",property) == 0))
         {
           double
             maximum,
@@ -2834,7 +2957,7 @@ MagickExport const char *GetMagickProperty(ImageInfo *image_info,
 
           WarnNoImageReturn("\"%%[%s]\"",property);
           (void) GetImageRange(image,&minimum,&maximum,exception);
-          (void) FormatLocaleString(value,MaxTextExtent,"%.*g",
+          (void) FormatLocaleString(value,MagickPathExtent,"%.*g",
             GetMagickPrecision(),minimum);
           break;
         }
@@ -2845,8 +2968,8 @@ MagickExport const char *GetMagickProperty(ImageInfo *image_info,
       if (LocaleCompare("opaque",property) == 0)
         {
           WarnNoImageReturn("\"%%[%s]\"",property);
-          string=CommandOptionToMnemonic(MagickBooleanOptions,
-               (ssize_t) IsImageOpaque(image,exception));
+          string=CommandOptionToMnemonic(MagickBooleanOptions,(ssize_t)
+            IsImageOpaque(image,exception));
           break;
         }
       if (LocaleCompare("orientation",property) == 0)
@@ -2859,7 +2982,7 @@ MagickExport const char *GetMagickProperty(ImageInfo *image_info,
       if (LocaleCompare("output",property) == 0)
         {
           WarnNoImageInfoReturn("\"%%[%s]\"",property);
-          (void) CopyMagickString(value,image_info->filename,MaxTextExtent);
+          (void) CopyMagickString(value,image_info->filename,MagickPathExtent);
           break;
         }
      break;
@@ -2883,7 +3006,6 @@ MagickExport const char *GetMagickProperty(ImageInfo *image_info,
           profile=GetImageProfile(image,property+8);
           if (profile == (StringInfo *) NULL)
             break;
-
           icc_profile=cmsOpenProfileFromMem(GetStringInfoDatum(profile),
             (cmsUInt32Number) GetStringInfoLength(profile));
           if (icc_profile != (cmsHPROFILE *) NULL)
@@ -2892,7 +3014,7 @@ MagickExport const char *GetMagickProperty(ImageInfo *image_info,
               string=cmsTakeProductName(icc_profile);
 #else
               (void) cmsGetProfileInfoASCII(icc_profile,cmsInfoDescription,
-                "en","US",value,MaxTextExtent);
+                "en","US",value,MagickPathExtent);
 #endif
               (void) cmsCloseProfile(icc_profile);
             }
@@ -2907,12 +3029,12 @@ MagickExport const char *GetMagickProperty(ImageInfo *image_info,
           name=GetNextImageProfile(image);
           if (name != (char *) NULL)
             {
-              (void) CopyMagickString(value,name,MaxTextExtent);
+              (void) CopyMagickString(value,name,MagickPathExtent);
               name=GetNextImageProfile(image);
               while (name != (char *) NULL)
               {
-                ConcatenateMagickString(value,",",MaxTextExtent);
-                ConcatenateMagickString(value,name,MaxTextExtent);
+                ConcatenateMagickString(value,",",MagickPathExtent);
+                ConcatenateMagickString(value,name,MagickPathExtent);
                 name=GetNextImageProfile(image);
               }
             }
@@ -2925,14 +3047,14 @@ MagickExport const char *GetMagickProperty(ImageInfo *image_info,
       if (LocaleCompare("resolution.x",property) == 0)
         {
           WarnNoImageReturn("\"%%[%s]\"",property);
-          (void) FormatLocaleString(value,MaxTextExtent,"%g",
+          (void) FormatLocaleString(value,MagickPathExtent,"%g",
             image->resolution.x);
           break;
         }
       if (LocaleCompare("resolution.y",property) == 0)
         {
           WarnNoImageReturn("\"%%[%s]\"",property);
-          (void) FormatLocaleString(value,MaxTextExtent,"%g",
+          (void) FormatLocaleString(value,MagickPathExtent,"%g",
             image->resolution.y);
           break;
         }
@@ -2944,11 +3066,11 @@ MagickExport const char *GetMagickProperty(ImageInfo *image_info,
         {
           WarnNoImageInfoReturn("\"%%[%s]\"",property);
           if (image_info->number_scenes != 0)
-            (void) FormatLocaleString(value,MaxTextExtent,"%.20g",(double)
+            (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double)
               image_info->scene);
           else {
             WarnNoImageReturn("\"%%[%s]\"",property);
-            (void) FormatLocaleString(value,MaxTextExtent,"%.20g",(double)
+            (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double)
               image->scene);
           }
           break;
@@ -2957,14 +3079,15 @@ MagickExport const char *GetMagickProperty(ImageInfo *image_info,
         {
           /* FUTURE: equivelent to %n? */
           WarnNoImageReturn("\"%%[%s]\"",property);
-          (void) FormatLocaleString(value,MaxTextExtent,"%.20g",(double)
+          (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double)
             GetImageListLength(image));
           break;
         }
       if (LocaleCompare("size",property) == 0)
         {
           WarnNoImageReturn("\"%%[%s]\"",property);
-          (void) FormatMagickSize(GetBlobSize(image),MagickFalse,"B",value);
+          (void) FormatMagickSize(GetBlobSize(image),MagickFalse,"B",
+            MagickPathExtent,value);
           break;
         }
       if (LocaleCompare("skewness",property) == 0)
@@ -2975,12 +3098,11 @@ MagickExport const char *GetMagickProperty(ImageInfo *image_info,
 
           WarnNoImageReturn("\"%%[%s]\"",property);
           (void) GetImageKurtosis(image,&kurtosis,&skewness,exception);
-          (void) FormatLocaleString(value,MaxTextExtent,"%.*g",
+          (void) FormatLocaleString(value,MagickPathExtent,"%.*g",
             GetMagickPrecision(),skewness);
           break;
         }
-      if ((LocaleCompare("standard-deviation",property) == 0) ||
-          (LocaleCompare("standard_deviation",property) == 0))
+      if (LocaleCompare("standard-deviation",property) == 0)
         {
           double
             mean,
@@ -2988,7 +3110,7 @@ MagickExport const char *GetMagickProperty(ImageInfo *image_info,
 
           WarnNoImageReturn("\"%%[%s]\"",property);
           (void) GetImageMean(image,&mean,&standard_deviation,exception);
-          (void) FormatLocaleString(value,MaxTextExtent,"%.*g",
+          (void) FormatLocaleString(value,MagickPathExtent,"%.*g",
             GetMagickPrecision(),standard_deviation);
           break;
         }
@@ -3000,7 +3122,7 @@ MagickExport const char *GetMagickProperty(ImageInfo *image_info,
         {
           WarnNoImageReturn("\"%%[%s]\"",property);
           string=CommandOptionToMnemonic(MagickTypeOptions,(ssize_t)
-            GetImageType(image,exception));
+            IdentifyImageType(image,exception));
           break;
         }
        break;
@@ -3020,7 +3142,6 @@ MagickExport const char *GetMagickProperty(ImageInfo *image_info,
             image->units);
           break;
         }
-      if (LocaleCompare("copyright",property) == 0)
       break;
     }
     case 'v':
@@ -3037,63 +3158,31 @@ MagickExport const char *GetMagickProperty(ImageInfo *image_info,
       if (LocaleCompare("width",property) == 0)
         {
           WarnNoImageReturn("\"%%[%s]\"",property);
-          (void) FormatLocaleString(value,MaxTextExtent,"%.20g",(double)
+          (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double)
             (image->magick_columns != 0 ? image->magick_columns : 256));
           break;
         }
       break;
     }
-    case 'x': /* FUTURE: Obsolete X resolution */
-    {
-      if ((LocaleCompare("xresolution",property) == 0) ||
-          (LocaleCompare("x-resolution",property) == 0) )
-        {
-          WarnNoImageReturn("\"%%[%s]\"",property);
-          (void) FormatLocaleString(value,MaxTextExtent,"%.20g",
-            image->resolution.x);
-          break;
-        }
-      break;
-    }
-    case 'y': /* FUTURE: Obsolete Y resolution */
+  }
+  if (string != (char *) NULL)
+    return(string);
+  if (*value != '\0')
     {
-      if ((LocaleCompare("yresolution",property) == 0) ||
-          (LocaleCompare("y-resolution",property) == 0) )
+      /*
+        Create a cloned copy of result, that will get cleaned up, eventually.
+      */
+      if (image != (Image *) NULL)
         {
-          WarnNoImageReturn("\"%%[%s]\"",property);
-          (void) FormatLocaleString(value,MaxTextExtent,"%.20g",
-            image->resolution.y);
-          break;
+          (void) SetImageArtifact(image,"get-property",value);
+          return(GetImageArtifact(image,"get-property"));
         }
-      break;
-    }
-    case 'z':
-    {
-      if (LocaleCompare("zero",property) == 0)
+      else
         {
-          WarnNoImageInfoReturn("\"%%[%s]\"",property);
-          string=image_info->zero;
-          break;
+          (void) SetImageOption(image_info,"get-property",value);
+          return(GetImageOption(image_info,"get-property"));
         }
-      break;
     }
-  }
-  if (string != (char *) NULL)
-    return(string);
-  if (*value != '\0')
-  {
-    /* create a cloned copy of result, that will get cleaned up, eventually */
-    if (image != (Image *) NULL)
-      {
-        (void) SetImageArtifact(image,"get-property",value);
-        return(GetImageArtifact(image,"get-property"));
-      }
-    else
-      {
-        (void) SetImageOption(image_info,"get-property",value);
-        return(GetImageOption(image_info,"get-property"));
-      }
-  }
   return((char *) NULL);
 }
 #undef WarnNoImageReturn
@@ -3120,16 +3209,16 @@ MagickExport const char *GetMagickProperty(ImageInfo *image_info,
 %    o image: the image.
 %
 */
-MagickExport char *GetNextImageProperty(const Image *image)
+MagickExport const char *GetNextImageProperty(const Image *image)
 {
   assert(image != (Image *) NULL);
-  assert(image->signature == MagickSignature);
+  assert(image->signature == MagickCoreSignature);
   if (image->debug != MagickFalse)
     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
       image->filename);
   if (image->properties == (void *) NULL)
-    return((char *) NULL);
-  return((char *) GetNextKeyInSplayTree((SplayTreeInfo *) image->properties));
+    return((const char *) NULL);
+  return((const char *) GetNextKeyInSplayTree((SplayTreeInfo *) image->properties));
 }
 \f
 /*
@@ -3186,198 +3275,234 @@ MagickExport char *GetNextImageProperty(const Image *image)
 %    o exception: return any errors or warnings in this structure.
 %
 */
-
-/* common inline code to expand the interpreted text string */
-#define ExtendInterpretText(string_length)  do { \
+MagickExport char *InterpretImageProperties(ImageInfo *image_info,Image *image,
+  const char *embed_text,ExceptionInfo *exception)
+{
+#define ExtendInterpretText(string_length) \
 DisableMSCWarning(4127) \
-    size_t length=(string_length); \
-    if ((size_t) (q-interpret_text+length+1) >= extent) \
-     { extent+=length; \
-       interpret_text=(char *) ResizeQuantumMemory(interpret_text, \
-             extent+MaxTextExtent,sizeof(*interpret_text)); \
-       if (interpret_text == (char *) NULL) \
-         return((char *) NULL); \
-       q=interpret_text+strlen(interpret_text); \
-   } } while (0)  /* no trailing ; */ \
+{ \
+  size_t length=(string_length); \
+  if ((size_t) (q-interpret_text+length+1) >= extent) \
+    { \
+      extent+=length; \
+      interpret_text=(char *) ResizeQuantumMemory(interpret_text,extent+ \
+        MaxTextExtent,sizeof(*interpret_text)); \
+      if (interpret_text == (char *) NULL) \
+        return((char *) NULL); \
+      q=interpret_text+strlen(interpret_text); \
+   } \
+} \
 RestoreMSCWarning
 
-/* same but append the given string */
-#define AppendString2Text(string)  do { \
+#define AppendKeyValue2Text(key,value)\
 DisableMSCWarning(4127) \
-    size_t length=strlen((string)); \
-    if ((size_t) (q-interpret_text+length+1) >= extent) \
-     { extent+=length; \
-       interpret_text=(char *) ResizeQuantumMemory(interpret_text, \
-             extent+MaxTextExtent,sizeof(*interpret_text)); \
-       if (interpret_text == (char *) NULL) \
-         return((char *) NULL); \
-       q=interpret_text+strlen(interpret_text); \
-      } \
-     (void) CopyMagickString(q,(string),extent); \
-     q+=length; \
-   } while (0)  /* no trailing ; */ \
+{ \
+  size_t length=strlen(key)+strlen(value)+2; \
+  if ((size_t) (q-interpret_text+length+1) >= extent) \
+    { \
+      extent+=length; \
+      interpret_text=(char *) ResizeQuantumMemory(interpret_text,extent+ \
+        MaxTextExtent,sizeof(*interpret_text)); \
+      if (interpret_text == (char *) NULL) \
+        return((char *) NULL); \
+      q=interpret_text+strlen(interpret_text); \
+     } \
+   q+=FormatLocaleString(q,extent,"%s=%s\n",(key),(value)); \
+} \
 RestoreMSCWarning
 
-/* same but append a 'key' and 'string' pair */
-#define AppendKeyValue2Text(key,string)  do { \
+#define AppendString2Text(string) \
 DisableMSCWarning(4127) \
-    size_t length=strlen(key)+strlen(string)+2; \
-    if ((size_t) (q-interpret_text+length+1) >= extent) \
-     { extent+=length; \
-      interpret_text=(char *) ResizeQuantumMemory(interpret_text, \
-              extent+MaxTextExtent,sizeof(*interpret_text)); \
+{ \
+  size_t length=strlen((string)); \
+  if ((size_t) (q-interpret_text+length+1) >= extent) \
+    { \
+      extent+=length; \
+      interpret_text=(char *) ResizeQuantumMemory(interpret_text,extent+ \
+        MaxTextExtent,sizeof(*interpret_text)); \
       if (interpret_text == (char *) NULL) \
         return((char *) NULL); \
       q=interpret_text+strlen(interpret_text); \
-     } \
-     q+=FormatLocaleString(q,extent,"%s=%s\n",(key),(string)); \
-   } while (0)  /* no trailing ; */ \
+    } \
+  (void) CopyMagickString(q,(string),extent); \
+  q+=length; \
+} \
 RestoreMSCWarning
 
-MagickExport char *InterpretImageProperties(ImageInfo *image_info,
-  Image *image,const char *embed_text,ExceptionInfo *exception)
-{
   char
     *interpret_text;
 
+  MagickBooleanType
+    number;
+
   register char
-    *q;     /* current position in interpret_text */
+    *q;  /* current position in interpret_text */
 
   register const char
-    *p;     /* position in embed_text string being expanded */
+    *p;  /* position in embed_text string being expanded */
 
   size_t
-    extent; /* allocated length of interpret_text */
-
-  MagickBooleanType
-    number;
+    extent;  /* allocated length of interpret_text */
 
-  assert(image == NULL || image->signature == MagickSignature);
-  assert(image_info == NULL || image_info->signature == MagickSignature);
-
-  if (image != (Image *) NULL && IfMagickTrue(image->debug))
+  assert(image == NULL || image->signature == MagickCoreSignature);
+  assert(image_info == NULL || image_info->signature == MagickCoreSignature);
+  if ((image != (Image *) NULL) && (image->debug != MagickFalse))
     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
-  else if( image_info != (ImageInfo *) NULL && IfMagickTrue(image_info->debug))
-    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s","no-image");
-
+  else
+   if ((image_info != (ImageInfo *) NULL) && (image_info->debug != MagickFalse))
+     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s","no-image");
   if (embed_text == (const char *) NULL)
-    return((char *) NULL);
+    return(ConstantString(""));
   p=embed_text;
-
+  while ((isspace((int) ((unsigned char) *p)) != 0) && (*p != '\0'))
+    p++;
   if (*p == '\0')
     return(ConstantString(""));
-
-  /* handle a '@' replace string from file */
-  if (*p == '@') {
-     p++;
-     if (*p != '-' && IfMagickFalse(IsPathAccessible(p)) ) {
-       (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
-         "UnableToAccessPath","%s",p);
-       return((char *) NULL);
-     }
-     return(FileToString(p,~0UL,exception));
-  }
-
+  if ((*p == '@') && (IsPathAccessible(p+1) != MagickFalse))
+    {
+      /*
+        Handle a '@' replace string from file.
+      */
+      if (IsRightsAuthorized(PathPolicyDomain,ReadPolicyRights,p) == MagickFalse)
+        {
+          errno=EPERM;
+          (void) ThrowMagickException(exception,GetMagickModule(),PolicyError,
+            "NotAuthorized","`%s'",p);
+          return(ConstantString(""));
+        }
+      interpret_text=FileToString(p+1,~0UL,exception);
+      if (interpret_text != (char *) NULL)
+        return(interpret_text);
+    }
   /*
     Translate any embedded format characters.
   */
   interpret_text=AcquireString(embed_text); /* new string with extra space */
-  extent=MaxTextExtent;                     /* allocated space in string */
+  extent=MagickPathExtent;                     /* allocated space in string */
   number=MagickFalse;                       /* is last char a number? */
-  for (q=interpret_text; *p!='\0'; number=IsMagickTrue(isdigit(*p)),p++)
+  for (q=interpret_text; *p!='\0'; number=isdigit(*p) ? MagickTrue : MagickFalse,p++)
   {
-    *q='\0';
-    ExtendInterpretText(MaxTextExtent);
     /*
       Look for the various escapes, (and handle other specials)
     */
-    switch (*p) {
+    *q='\0';
+    ExtendInterpretText(MagickPathExtent);
+    switch (*p)
+    {
       case '\\':
-        switch (*(p+1)) {
+      {
+        switch (*(p+1))
+        {
           case '\0':
             continue;
-          case 'r':       /* convert to RETURN */
+          case 'r':  /* convert to RETURN */
+          {
             *q++='\r';
             p++;
             continue;
-          case 'n':       /* convert to NEWLINE */
+          }
+          case 'n':  /* convert to NEWLINE */
+          {
             *q++='\n';
             p++;
             continue;
-          case '\n':      /* EOL removal UNIX,MacOSX */
+          }
+          case '\n':  /* EOL removal UNIX,MacOSX */
+          {
             p++;
             continue;
-          case '\r':      /* EOL removal DOS,Windows */
+          }
+          case '\r':  /* EOL removal DOS,Windows */
+          {
             p++;
             if (*p == '\n') /* return-newline EOL */
               p++;
             continue;
+          }
           default:
+          {
             p++;
             *q++=(*p);
+          }
         }
         continue;
+      }
       case '&':
+      {
         if (LocaleNCompare("&lt;",p,4) == 0)
-          *q++='<', p+=3;
-        else if (LocaleNCompare("&gt;",p,4) == 0)
-          *q++='>', p+=3;
-        else if (LocaleNCompare("&amp;",p,5) == 0)
-          *q++='&', p+=4;
+          {
+            *q++='<';
+            p+=3;
+          }
         else
-          *q++=(*p);
+          if (LocaleNCompare("&gt;",p,4) == 0)
+            {
+              *q++='>';
+              p+=3;
+            }
+          else
+            if (LocaleNCompare("&amp;",p,5) == 0)
+              {
+                *q++='&';
+                p+=4;
+              }
+            else
+              *q++=(*p);
         continue;
+      }
       case '%':
-        break;      /* continue to next set of handlers */
+        break;  /* continue to next set of handlers */
       default:
+      {
         *q++=(*p);  /* any thing else is 'as normal' */
         continue;
+      }
     }
     p++; /* advance beyond the percent */
-
     /*
-      Doubled Percent - or percent at end of string
+      Doubled Percent - or percent at end of string.
     */
     if ((*p == '\0') || (*p == '\'') || (*p == '"'))
       p--;
-    if (*p == '%') {
+    if (*p == '%')
+      {
         *q++='%';
         continue;
       }
     /*
-      Single letter escapes  %c
+      Single letter escapes %c.
     */
-    if ( *p != '[' ) {
-      const char
-        *string;
+    if (*p != '[')
+      {
+        const char
+          *string;
 
-      /* But only if not preceeded by a number! */
-      if ( IfMagickTrue(number) ) {
-        *q++='%'; /* do NOT substitute the percent */
-        p--;      /* back up one */
+        if (number != MagickFalse)
+          {
+            /*
+              But only if not preceeded by a number!
+            */
+            *q++='%'; /* do NOT substitute the percent */
+            p--;      /* back up one */
+            continue;
+          }
+        string=GetMagickPropertyLetter(image_info,image,*p, exception);
+        if (string != (char *) NULL)
+          {
+            AppendString2Text(string);
+            if (image != (Image *) NULL)
+              (void) DeleteImageArtifact(image,"get-property");
+            if (image_info != (ImageInfo *) NULL)
+              (void) DeleteImageOption(image_info,"get-property");
+            continue;
+          }
+        (void) ThrowMagickException(exception,GetMagickModule(),OptionWarning,
+          "UnknownImageProperty","\"%%%c\"",*p);
         continue;
       }
-      string=GetMagickPropertyLetter(image_info,image,*p, exception);
-      if (string != (char *) NULL)
-        {
-          AppendString2Text(string);
-          if (image != (Image *) NULL)
-            (void)DeleteImageArtifact(image,"get-property");
-          if (image_info != (ImageInfo *) NULL)
-            (void)DeleteImageOption(image_info,"get-property");
-          continue;
-        }
-      (void) ThrowMagickException(exception,GetMagickModule(),OptionWarning,
-        "UnknownImageProperty","\"%%%c\"",*p);
-      continue;
-    }
-
-    /*
-      Braced Percent Escape  %[...]
-    */
     {
       char
-        pattern[2*MaxTextExtent];
+        pattern[2*MagickPathExtent];
 
       const char
         *key,
@@ -3389,22 +3514,28 @@ MagickExport char *InterpretImageProperties(ImageInfo *image_info,
       ssize_t
         depth;
 
-      /* get the property name framed by the %[...] */
+      /*
+        Braced Percent Escape %[...].
+      */
       p++;  /* advance p to just inside the opening brace */
       depth=1;
-      if ( *p == ']' ) {
-        (void) ThrowMagickException(exception,GetMagickModule(),OptionWarning,
-          "UnknownImageProperty","\"%%[]\"");
-        break;
-      }
-      for (len=0; len<(MaxTextExtent-1L) && (*p != '\0');)
-      {
-        /* skip escaped braces within braced pattern */
-        if ( (*p == '\\') && (*(p+1) != '\0') ) {
-          pattern[len++]=(*p++);
-          pattern[len++]=(*p++);
-          continue;
+      if (*p == ']')
+        {
+          (void) ThrowMagickException(exception,GetMagickModule(),OptionWarning,
+            "UnknownImageProperty","\"%%[]\"");
+          break;
         }
+      for (len=0; len<(MagickPathExtent-1L) && (*p != '\0');)
+      {
+        if ((*p == '\\') && (*(p+1) != '\0'))
+          {
+            /*
+              Skip escaped braces within braced pattern.
+            */
+            pattern[len++]=(*p++);
+            pattern[len++]=(*p++);
+            continue;
+          }
         if (*p == '[')
           depth++;
         if (*p == ']')
@@ -3414,75 +3545,140 @@ MagickExport char *InterpretImageProperties(ImageInfo *image_info,
         pattern[len++]=(*p++);
       }
       pattern[len]='\0';
-      /* Check for unmatched final ']' for "%[...]" */
-      if ( depth != 0 ) {
-        if (len >= 64) {  /* truncate string for error message */
-          pattern[61] = '.';
-          pattern[62] = '.';
-          pattern[63] = '.';
-          pattern[64] = '\0';
+      if (depth != 0)
+        {
+          /*
+            Check for unmatched final ']' for "%[...]".
+          */
+          if (len >= 64)
+            {
+              pattern[61] = '.';  /* truncate string for error message */
+              pattern[62] = '.';
+              pattern[63] = '.';
+              pattern[64] = '\0';
+            }
+          (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
+            "UnbalancedBraces","\"%%[%s\"",pattern);
+          interpret_text=DestroyString(interpret_text);
+          return((char *) NULL);
         }
-        (void) ThrowMagickException(exception,GetMagickModule(),
-            OptionError,"UnbalancedBraces","\"%%[%s\"",pattern);
-        interpret_text=DestroyString(interpret_text);
-        return((char *) NULL);
-      }
-
       /*
-        Special Lookup Prefixes %[prefix:...]
+        Special Lookup Prefixes %[prefix:...].
       */
-      /* fx - value calculator */
       if (LocaleNCompare("fx:",pattern,3) == 0)
         {
-          FxInfo
-            *fx_info;
-
           double
             value;
 
+          FxInfo
+            *fx_info;
+
           MagickBooleanType
             status;
 
-          if (image == (Image *) NULL ) {
-            (void) ThrowMagickException(exception,GetMagickModule(),
+          /*
+            FX - value calculator.
+          */
+          if (image == (Image *) NULL )
+            {
+              (void) ThrowMagickException(exception,GetMagickModule(),
                 OptionWarning,"NoImageForProperty","\"%%[%s]\"",pattern);
-            continue; /* else no image to retrieve artifact */
-          }
+              continue; /* else no image to retrieve artifact */
+            }
           fx_info=AcquireFxInfo(image,pattern+3,exception);
           status=FxEvaluateChannelExpression(fx_info,IntensityPixelChannel,0,0,
             &value,exception);
           fx_info=DestroyFxInfo(fx_info);
-          if( IfMagickTrue(status) )
+          if (status != MagickFalse)
             {
               char
-                result[MaxTextExtent];
+                result[MagickPathExtent];
 
-              (void) FormatLocaleString(result,MaxTextExtent,"%.*g",
+              (void) FormatLocaleString(result,MagickPathExtent,"%.*g",
                 GetMagickPrecision(),(double) value);
               AppendString2Text(result);
             }
           continue;
         }
-      /* pixel - color value calculator */
-      if (LocaleNCompare("pixel:",pattern,6) == 0)
+      if (LocaleNCompare("hex:",pattern,4) == 0)
         {
+          double
+            value;
+
           FxInfo
             *fx_info;
 
+          MagickStatusType
+            status;
+
+          PixelInfo
+            pixel;
+
+          /*
+            Pixel - color value calculator.
+          */
+          if (image == (Image *) NULL)
+            {
+              (void) ThrowMagickException(exception,GetMagickModule(),
+                OptionWarning,"NoImageForProperty","\"%%[%s]\"",pattern);
+              continue; /* else no image to retrieve artifact */
+            }
+          GetPixelInfo(image,&pixel);
+          fx_info=AcquireFxInfo(image,pattern+4,exception);
+          status=FxEvaluateChannelExpression(fx_info,RedPixelChannel,0,0,
+            &value,exception);
+          pixel.red=(double) QuantumRange*value;
+          status&=FxEvaluateChannelExpression(fx_info,GreenPixelChannel,0,0,
+            &value,exception);
+          pixel.green=(double) QuantumRange*value;
+          status&=FxEvaluateChannelExpression(fx_info,BluePixelChannel,0,0,
+            &value,exception);
+          pixel.blue=(double) QuantumRange*value;
+          if (image->colorspace == CMYKColorspace)
+            {
+              status&=FxEvaluateChannelExpression(fx_info,BlackPixelChannel,0,0,
+                &value,exception);
+              pixel.black=(double) QuantumRange*value;
+            }
+          status&=FxEvaluateChannelExpression(fx_info,AlphaPixelChannel,0,0,
+            &value,exception);
+          pixel.alpha=(double) QuantumRange*value;
+          fx_info=DestroyFxInfo(fx_info);
+          if (status != MagickFalse)
+            {
+              char
+                hex[MagickPathExtent],
+                name[MagickPathExtent];
+
+              (void) QueryColorname(image,&pixel,SVGCompliance,name,exception);
+              GetColorTuple(&pixel,MagickTrue,hex);
+              AppendString2Text(hex+1);
+            }
+          continue;
+        }
+      if (LocaleNCompare("pixel:",pattern,6) == 0)
+        {
           double
             value;
 
+          FxInfo
+            *fx_info;
+
           MagickStatusType
             status;
 
           PixelInfo
             pixel;
 
-          if (image == (Image *) NULL ) {
-            (void) ThrowMagickException(exception,GetMagickModule(),
+          /*
+            Pixel - color value calculator.
+          */
+          if (image == (Image *) NULL)
+            {
+              (void) ThrowMagickException(exception,GetMagickModule(),
                 OptionWarning,"NoImageForProperty","\"%%[%s]\"",pattern);
-            continue; /* else no image to retrieve artifact */
-          }
+              continue; /* else no image to retrieve artifact */
+            }
           GetPixelInfo(image,&pixel);
           fx_info=AcquireFxInfo(image,pattern+6,exception);
           status=FxEvaluateChannelExpression(fx_info,RedPixelChannel,0,0,
@@ -3504,104 +3700,113 @@ MagickExport char *InterpretImageProperties(ImageInfo *image_info,
             &value,exception);
           pixel.alpha=(double) QuantumRange*value;
           fx_info=DestroyFxInfo(fx_info);
-          if( IfMagickTrue(status) )
+          if (status != MagickFalse)
             {
               char
-                name[MaxTextExtent];
+                name[MagickPathExtent];
 
-              (void) QueryColorname(image,&pixel,SVGCompliance,name,
-                exception);
+              (void) QueryColorname(image,&pixel,SVGCompliance,name,exception);
               AppendString2Text(name);
             }
           continue;
         }
-      /* option - direct global option lookup (with globbing) */
       if (LocaleNCompare("option:",pattern,7) == 0)
-      {
-        if (image_info == (ImageInfo *) NULL ) {
-          (void) ThrowMagickException(exception,GetMagickModule(),
-              OptionWarning,"NoImageForProperty","\"%%[%s]\"",pattern);
-          continue; /* else no image to retrieve artifact */
-        }
-        if( IfMagickTrue(IsGlob(pattern+7)) )
         {
-          ResetImageOptionIterator(image_info);
-          while ((key=GetNextImageOption(image_info)) != (const char *) NULL)
-            if( IfMagickTrue(GlobExpression(key,pattern+7,MagickTrue)) )
-              {
-                string=GetImageOption(image_info,key);
-                if (string != (const char *) NULL)
-                  AppendKeyValue2Text(key,string);
-                /* else - assertion failure? key found but no string value! */
-              }
+          /*
+            Option - direct global option lookup (with globbing).
+          */
+          if (image_info == (ImageInfo *) NULL )
+            {
+              (void) ThrowMagickException(exception,GetMagickModule(),
+                OptionWarning,"NoImageForProperty","\"%%[%s]\"",pattern);
+              continue; /* else no image to retrieve artifact */
+            }
+          if (IsGlob(pattern+7) != MagickFalse)
+            {
+              ResetImageOptionIterator(image_info);
+              while ((key=GetNextImageOption(image_info)) != (const char *) NULL)
+                if (GlobExpression(key,pattern+7,MagickTrue) != MagickFalse)
+                  {
+                    string=GetImageOption(image_info,key);
+                    if (string != (const char *) NULL)
+                      AppendKeyValue2Text(key,string);
+                    /* else - assertion failure? key found but no string value! */
+                  }
+              continue;
+            }
+          string=GetImageOption(image_info,pattern+7);
+          if (string == (char *) NULL)
+            goto PropertyLookupFailure; /* no artifact of this specifc name */
+          AppendString2Text(string);
           continue;
         }
-        string=GetImageOption(image_info,pattern+7);
-        if (string == (char *) NULL)
-          goto PropertyLookupFailure; /* no artifact of this specifc name */
-        AppendString2Text(string);
-        continue;
-      }
-      /* artifact - direct image artifact lookup (with glob) */
       if (LocaleNCompare("artifact:",pattern,9) == 0)
-      {
-        if (image == (Image *) NULL ) {
-          (void) ThrowMagickException(exception,GetMagickModule(),
-              OptionWarning,"NoImageForProperty","\"%%[%s]\"",pattern);
-          continue; /* else no image to retrieve artifact */
-        }
-        if( IfMagickTrue(IsGlob(pattern+9)) )
         {
-          ResetImageArtifactIterator(image);
-          while ((key=GetNextImageArtifact(image)) != (const char *) NULL)
-            if( IfMagickTrue(GlobExpression(key,pattern+9,MagickTrue)) )
-              {
-                string=GetImageArtifact(image,key);
-                if (string != (const char *) NULL)
-                  AppendKeyValue2Text(key,string);
-                /* else - assertion failure? key found but no string value! */
-              }
+          /*
+            Artifact - direct image artifact lookup (with glob).
+          */
+          if (image == (Image *) NULL)
+            {
+              (void) ThrowMagickException(exception,GetMagickModule(),
+                OptionWarning,"NoImageForProperty","\"%%[%s]\"",pattern);
+              continue; /* else no image to retrieve artifact */
+            }
+          if (IsGlob(pattern+9) != MagickFalse)
+            {
+              ResetImageArtifactIterator(image);
+              while ((key=GetNextImageArtifact(image)) != (const char *) NULL)
+              if (GlobExpression(key,pattern+9,MagickTrue) != MagickFalse)
+                {
+                  string=GetImageArtifact(image,key);
+                  if (string != (const char *) NULL)
+                    AppendKeyValue2Text(key,string);
+                  /* else - assertion failure? key found but no string value! */
+                }
+              continue;
+            }
+          string=GetImageArtifact(image,pattern+9);
+          if (string == (char *) NULL)
+            goto PropertyLookupFailure; /* no artifact of this specifc name */
+          AppendString2Text(string);
           continue;
         }
-        string=GetImageArtifact(image,pattern+9);
-        if (string == (char *) NULL)
-          goto PropertyLookupFailure; /* no artifact of this specifc name */
-        AppendString2Text(string);
-        continue;
-      }
-      /* property - direct image property lookup (with glob) */
       if (LocaleNCompare("property:",pattern,9) == 0)
-      {
-        if (image == (Image *) NULL ) {
-          (void) ThrowMagickException(exception,GetMagickModule(),
-              OptionWarning,"NoImageForProperty","\"%%[%s]\"",pattern);
-          continue; /* else no image to retrieve artifact */
-        }
-        if( IfMagickTrue(IsGlob(pattern+9)) )
         {
-          ResetImagePropertyIterator(image);
-          while ((key=GetNextImageProperty(image)) != (const char *) NULL)
-            if( IfMagickTrue(GlobExpression(key,pattern,MagickTrue)) )
-              {
-                string=GetImageProperty(image,key,exception);
-                if (string != (const char *) NULL)
-                  AppendKeyValue2Text(key,string);
-                /* else - assertion failure? */
-              }
+          /*
+            Property - direct image property lookup (with glob).
+          */
+          if (image == (Image *) NULL)
+            {
+              (void) ThrowMagickException(exception,GetMagickModule(),
+                OptionWarning,"NoImageForProperty","\"%%[%s]\"",pattern);
+              continue; /* else no image to retrieve artifact */
+            }
+          if (IsGlob(pattern+9) != MagickFalse)
+            {
+              ResetImagePropertyIterator(image);
+              while ((key=GetNextImageProperty(image)) != (const char *) NULL)
+                if (GlobExpression(key,pattern,MagickTrue) != MagickFalse)
+                  {
+                    string=GetImageProperty(image,key,exception);
+                    if (string != (const char *) NULL)
+                      AppendKeyValue2Text(key,string);
+                    /* else - assertion failure? */
+                  }
+              continue;
+            }
+          string=GetImageProperty(image,pattern+9,exception);
+          if (string == (char *) NULL)
+            goto PropertyLookupFailure; /* no artifact of this specifc name */
+          AppendString2Text(string);
           continue;
         }
-        string=GetImageProperty(image,pattern+9,exception);
-        if (string == (char *) NULL)
-          goto PropertyLookupFailure; /* no artifact of this specifc name */
-        AppendString2Text(string);
-        continue;
-      }
-      /* Properties without special prefix.
-         This handles attributes, properties, and profiles such as %[exif:...]
-         Note the profile properties may also include a glob expansion pattern.
-      */
-      if ( image != (Image *) NULL )
+      if (image != (Image *) NULL)
         {
+          /*
+            Properties without special prefix.  This handles attributes,
+            properties, and profiles such as %[exif:...].  Note the profile
+            properties may also include a glob expansion pattern.
+          */
           string=GetImageProperty(image,pattern,exception);
           if (string != (const char *) NULL)
             {
@@ -3613,17 +3818,17 @@ MagickExport char *InterpretImageProperties(ImageInfo *image_info,
               continue;
             }
         }
-      /*
-        Handle property 'glob' patterns
-        Such as:  %[*]   %[user:array_??]  %[filename:e*]
-      */
-      if( IfMagickTrue(IsGlob(pattern)) )
+      if (IsGlob(pattern) != MagickFalse)
         {
+          /*
+            Handle property 'glob' patterns such as:
+            %[*] %[user:array_??] %[filename:e*]>
+          */
           if (image == (Image *) NULL)
             continue; /* else no image to retrieve proprty - no list */
           ResetImagePropertyIterator(image);
           while ((key=GetNextImageProperty(image)) != (const char *) NULL)
-            if( IfMagickTrue(GlobExpression(key,pattern,MagickTrue)) )
+            if (GlobExpression(key,pattern,MagickTrue) != MagickFalse)
               {
                 string=GetImageProperty(image,key,exception);
                 if (string != (const char *) NULL)
@@ -3633,9 +3838,9 @@ MagickExport char *InterpretImageProperties(ImageInfo *image_info,
           continue;
         }
       /*
-        Look for a known property or image attribute
-        Such as  %[basename]  %[denisty]  %[delay]
-        Also handles a braced single letter:  %[b] %[G] %[g]
+        Look for a known property or image attribute such as
+        %[basename] %[denisty] %[delay].  Also handles a braced single
+        letter: %[b] %[G] %[g].
       */
       string=GetMagickProperty(image_info,image,pattern,exception);
       if (string != (const char *) NULL)
@@ -3644,8 +3849,8 @@ MagickExport char *InterpretImageProperties(ImageInfo *image_info,
           continue;
         }
       /*
-        Look for a per-image Artifact
-        This includes option lookup (FUTURE: interpreted according to image)
+        Look for a per-image artifact. This includes option lookup
+        (FUTURE: interpreted according to image).
       */
       if (image != (Image *) NULL)
         {
@@ -3657,9 +3862,11 @@ MagickExport char *InterpretImageProperties(ImageInfo *image_info,
             }
         }
       else
-        /* no image, so direct 'option' lookup (no delayed percent escapes) */
         if (image_info != (ImageInfo *) NULL)
           {
+            /*
+              No image, so direct 'option' lookup (no delayed percent escapes).
+            */
             string=GetImageOption(image_info,pattern);
             if (string != (char *) NULL)
               {
@@ -3671,18 +3878,17 @@ PropertyLookupFailure:
       /*
         Failed to find any match anywhere!
       */
-      if (len >= 64) {  /* truncate string for error message */
-        pattern[61] = '.';
-        pattern[62] = '.';
-        pattern[63] = '.';
-        pattern[64] = '\0';
-      }
-      (void) ThrowMagickException(exception,GetMagickModule(),
-          OptionWarning,"UnknownImageProperty","\"%%[%s]\"",pattern);
-      /* continue */
-    } /* Braced Percent Escape */
-
-  } /* for each char in 'embed_text' */
+      if (len >= 64)
+        {
+          pattern[61] = '.';  /* truncate string for error message */
+          pattern[62] = '.';
+          pattern[63] = '.';
+          pattern[64] = '\0';
+        }
+      (void) ThrowMagickException(exception,GetMagickModule(),OptionWarning,
+        "UnknownImageProperty","\"%%[%s]\"",pattern);
+    }
+  }
   *q='\0';
   return(interpret_text);
 }
@@ -3715,17 +3921,15 @@ PropertyLookupFailure:
 %    o property: the image property.
 %
 */
-MagickExport char *RemoveImageProperty(Image *image,
-  const char *property)
+MagickExport char *RemoveImageProperty(Image *image,const char *property)
 {
   char
     *value;
 
   assert(image != (Image *) NULL);
-  assert(image->signature == MagickSignature);
+  assert(image->signature == MagickCoreSignature);
   if (image->debug != MagickFalse)
-    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
-      image->filename);
+    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
   if (image->properties == (void *) NULL)
     return((char *) NULL);
   value=(char *) RemoveNodeFromSplayTree((SplayTreeInfo *) image->properties,
@@ -3760,10 +3964,9 @@ MagickExport char *RemoveImageProperty(Image *image,
 MagickExport void ResetImagePropertyIterator(const Image *image)
 {
   assert(image != (Image *) NULL);
-  assert(image->signature == MagickSignature);
+  assert(image->signature == MagickCoreSignature);
   if (image->debug != MagickFalse)
-    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
-      image->filename);
+    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
   if (image->properties == (void *) NULL)
     return;
   ResetSplayTreeIterator((SplayTreeInfo *) image->properties);
@@ -3812,7 +4015,7 @@ MagickExport MagickBooleanType SetImageProperty(Image *image,
     flags;
 
   assert(image != (Image *) NULL);
-  assert(image->signature == MagickSignature);
+  assert(image->signature == MagickCoreSignature);
   if (image->debug != MagickFalse)
     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
   if (image->properties == (void *) NULL)
@@ -3843,8 +4046,8 @@ MagickExport MagickBooleanType SetImageProperty(Image *image,
     {
       if (LocaleNCompare("8bim:",property,5) == 0)
         {
-          (void) ThrowMagickException(exception,GetMagickModule(),
-               OptionError,"SetReadOnlyProperty","`%s'",property);
+          (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
+            "SetReadOnlyProperty","`%s'",property);
           return(MagickFalse);
         }
       break;
@@ -3936,8 +4139,8 @@ MagickExport MagickBooleanType SetImageProperty(Image *image,
         }
       if (LocaleCompare("delay_units",property) == 0)
         {
-          (void) ThrowMagickException(exception,GetMagickModule(),
-               OptionError,"SetReadOnlyProperty","`%s'",property);
+          (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
+            "SetReadOnlyProperty","`%s'",property);
           return(MagickFalse);
         }
       if (LocaleCompare("density",property) == 0)
@@ -3977,8 +4180,8 @@ MagickExport MagickBooleanType SetImageProperty(Image *image,
     {
       if (LocaleNCompare("exif:",property,5) == 0)
         {
-          (void) ThrowMagickException(exception,GetMagickModule(),
-               OptionError,"SetReadOnlyProperty","`%s'",property);
+          (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
+            "SetReadOnlyProperty","`%s'",property);
           return(MagickFalse);
         }
       break; /* not an attribute, add as a property */
@@ -3988,8 +4191,8 @@ MagickExport MagickBooleanType SetImageProperty(Image *image,
     {
       if (LocaleNCompare("fx:",property,3) == 0)
         {
-          (void) ThrowMagickException(exception,GetMagickModule(),
-               OptionError,"SetReadOnlyProperty","`%s'",property);
+          (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
+            "SetReadOnlyProperty","`%s'",property);
           return(MagickFalse);
         }
       break; /* not an attribute, add as a property */
@@ -4021,8 +4224,8 @@ MagickExport MagickBooleanType SetImageProperty(Image *image,
     {
       if (LocaleCompare("height",property) == 0)
         {
-          (void) ThrowMagickException(exception,GetMagickModule(),
-               OptionError,"SetReadOnlyProperty","`%s'",property);
+          (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
+            "SetReadOnlyProperty","`%s'",property);
           return(MagickFalse);
         }
       break; /* not an attribute, add as a property */
@@ -4035,8 +4238,7 @@ MagickExport MagickBooleanType SetImageProperty(Image *image,
           ssize_t
             intensity;
 
-          intensity=ParseCommandOption(MagickIntentOptions,MagickFalse,
-            value);
+          intensity=ParseCommandOption(MagickIntentOptions,MagickFalse,value);
           if (intensity < 0)
             return(MagickFalse);
           image->intensity=(PixelIntensityMethod) intensity;
@@ -4070,8 +4272,8 @@ MagickExport MagickBooleanType SetImageProperty(Image *image,
           Throwing an exception causes this setting to fail */
       if (LocaleNCompare("iptc:",property,5) == 0)
         {
-          (void) ThrowMagickException(exception,GetMagickModule(),
-               OptionError,"SetReadOnlyProperty","`%s'",property);
+          (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
+            "SetReadOnlyProperty","`%s'",property);
           return(MagickFalse);
         }
 #endif
@@ -4081,8 +4283,8 @@ MagickExport MagickBooleanType SetImageProperty(Image *image,
     case 'k':
       if (LocaleCompare("kurtosis",property) == 0)
         {
-          (void) ThrowMagickException(exception,GetMagickModule(),
-               OptionError,"SetReadOnlyProperty","`%s'",property);
+          (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
+            "SetReadOnlyProperty","`%s'",property);
           return(MagickFalse);
         }
       break; /* not an attribute, add as a property */
@@ -4098,11 +4300,11 @@ MagickExport MagickBooleanType SetImageProperty(Image *image,
     }
     case 'M':
     case 'm':
-      if ( (LocaleCompare("magick",property) == 0) ||
-           (LocaleCompare("max",property) == 0) ||
-           (LocaleCompare("mean",property) == 0) ||
-           (LocaleCompare("min",property) == 0) ||
-           (LocaleCompare("min",property) == 0) )
+      if ((LocaleCompare("magick",property) == 0) ||
+          (LocaleCompare("max",property) == 0) ||
+          (LocaleCompare("mean",property) == 0) ||
+          (LocaleCompare("min",property) == 0) ||
+          (LocaleCompare("min",property) == 0))
         {
           (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
              "SetReadOnlyProperty","`%s'",property);
@@ -4113,8 +4315,8 @@ MagickExport MagickBooleanType SetImageProperty(Image *image,
     case 'o':
       if (LocaleCompare("opaque",property) == 0)
         {
-          (void) ThrowMagickException(exception,GetMagickModule(),
-               OptionError,"SetReadOnlyProperty","`%s'",property);
+          (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
+            "SetReadOnlyProperty","`%s'",property);
           return(MagickFalse);
         }
       break; /* not an attribute, add as a property */
@@ -4135,8 +4337,8 @@ MagickExport MagickBooleanType SetImageProperty(Image *image,
           Throwing an exception causes this setting to fail */
       if (LocaleNCompare("pixel:",property,6) == 0)
         {
-          (void) ThrowMagickException(exception,GetMagickModule(),
-               OptionError,"SetReadOnlyProperty","`%s'",property);
+          (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
+            "SetReadOnlyProperty","`%s'",property);
           return(MagickFalse);
         }
 #endif
@@ -4149,7 +4351,7 @@ MagickExport MagickBooleanType SetImageProperty(Image *image,
             *profile;
 
           image_info=AcquireImageInfo();
-          (void) CopyMagickString(image_info->filename,value,MaxTextExtent);
+          (void) CopyMagickString(image_info->filename,value,MagickPathExtent);
           (void) SetImageInfo(image_info,1,exception);
           profile=FileToStringInfo(image_info->filename,~0UL,exception);
           if (profile != (StringInfo *) NULL)
@@ -4178,13 +4380,13 @@ MagickExport MagickBooleanType SetImageProperty(Image *image,
     }
     case 'S':
     case 's':
-      if ( (LocaleCompare("size",property) == 0) ||
-           (LocaleCompare("skewness",property) == 0) ||
-           (LocaleCompare("scenes",property) == 0) ||
-           (LocaleCompare("standard-deviation",property) == 0) )
+      if ((LocaleCompare("size",property) == 0) ||
+          (LocaleCompare("skewness",property) == 0) ||
+          (LocaleCompare("scenes",property) == 0) ||
+          (LocaleCompare("standard-deviation",property) == 0))
         {
-          (void) ThrowMagickException(exception,GetMagickModule(),
-               OptionError,"SetReadOnlyProperty","`%s'",property);
+          (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
+            "SetReadOnlyProperty","`%s'",property);
           return(MagickFalse);
         }
       break; /* not an attribute, add as a property */
@@ -4224,8 +4426,8 @@ MagickExport MagickBooleanType SetImageProperty(Image *image,
     {
       if (LocaleCompare("version",property) == 0)
         {
-          (void) ThrowMagickException(exception,GetMagickModule(),
-               OptionError,"SetReadOnlyProperty","`%s'",property);
+          (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
+            "SetReadOnlyProperty","`%s'",property);
           return(MagickFalse);
         }
       break; /* not an attribute, add as a property */
@@ -4235,8 +4437,8 @@ MagickExport MagickBooleanType SetImageProperty(Image *image,
     {
       if (LocaleCompare("width",property) == 0)
         {
-          (void) ThrowMagickException(exception,GetMagickModule(),
-               OptionError,"SetReadOnlyProperty","`%s'",property);
+          (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
+            "SetReadOnlyProperty","`%s'",property);
           return(MagickFalse);
         }
       break; /* not an attribute, add as a property */
@@ -4248,8 +4450,8 @@ MagickExport MagickBooleanType SetImageProperty(Image *image,
     {
       if (LocaleNCompare("xmp:",property,4) == 0)
         {
-          (void) ThrowMagickException(exception,GetMagickModule(),
-               OptionError,"SetReadOnlyProperty","`%s'",property);
+          (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
+            "SetReadOnlyProperty","`%s'",property);
           return(MagickFalse);
         }
       break; /* not an attribute, add as a property */