diff --git a/ChangeLog b/ChangeLog
index be2d199..d34ca55 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-07-31  6.6.3-1 Cristy  <quetzlzacatenango@image...>
+  * Only use the first alpha channel in PSD image.
+  * Only use XPM complying colors for XPM images (e.g. green is rgb(0,255,0)).
+
 2010-07-27  6.6.3-2 Glenn Randers-Pehrson <glennrp@image...>
   * Eliminate useless message about assuming zero delay when writing
     a single-frame MNG, and changed it from Error to Warning when
diff --git a/coders/psd.c b/coders/psd.c
index 49b8f47..dad595d 100644
--- a/coders/psd.c
+++ b/coders/psd.c
@@ -664,6 +664,8 @@
         }
         case 4:
         {
+          if ((image->colorspace == RGBColorspace) && (channels > 3))
+            break;
           q->opacity=(Quantum) (QuantumRange-pixel);
           break;
         }
diff --git a/coders/xpm.c b/coders/xpm.c
index 94a1607..134f539 100644
--- a/coders/xpm.c
+++ b/coders/xpm.c
@@ -384,7 +384,9 @@
         image->storage_class=DirectClass;
         image->matte=MagickTrue;
       }
-    if (QueryColorDatabase(target,&image->colormap[j],exception) == MagickFalse)
+    status=QueryColorCompliance(target,XPMCompliance,&image->colormap[j],
+      exception);
+    if (status == MagickFalse)
       break;
   }
   if (j < (ssize_t) image->colors)
@@ -519,8 +521,7 @@
 %                                                                             %
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %
-%  Procedure WritePICONImage() writes an image to a file in the Personal Icon
-%  format.
+%  WritePICONImage() writes an image to a file in the Personal Icon format.
 %
 %  The format of the WritePICONImage method is:
 %
@@ -827,7 +828,7 @@
 %                                                                             %
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %
-%  Procedure WriteXPMImage() writes an image to a file in the X pixmap format.
+%  WriteXPMImage() writes an image to a file in the X pixmap format.
 %
 %  The format of the WriteXPMImage method is:
 %
@@ -839,7 +840,6 @@
 %
 %    o image:  The image.
 %
-%
 */
 static MagickBooleanType WriteXPMImage(const ImageInfo *image_info,Image *image)
 {
diff --git a/config/colors.xml b/config/colors.xml
index 6af18c2..55bfb5d 100644
--- a/config/colors.xml
+++ b/config/colors.xml
@@ -16,7 +16,7 @@
   255, blue = 255, and alpha = 0).
 -->
 <colormap>
-  <!-- <color name="none" color="rgba(0,0,0,0)" compliance="SVG"/> -->
+  <!-- <color name="none" color="rgba(0,0,0,0)" compliance="SVG, XPM"/> -->
   <!-- <color name="black" color="rgb(0,0,0)" compliance="SVG, X11, XPM"/> -->
   <!-- <color name="red" color="rgb(255,0,0)" compliance="SVG, X11, XPM"/> -->
   <!-- <color name="magenta" color="rgb(255,0,255)" compliance="SVG, X11, XPM"/> -->
diff --git a/magick/color.c b/magick/color.c
index 68eb0d8..28378d6 100644
--- a/magick/color.c
+++ b/magick/color.c
@@ -95,7 +95,7 @@
 static const ColorMapInfo
   ColorMap[] =
   {
-    { "none", 0, 0, 0, 0, SVGCompliance },
+    { "none", 0, 0, 0, 0, SVGCompliance | XPMCompliance },
     { "black", 0, 0, 0, 1, SVGCompliance | X11Compliance | XPMCompliance },
     { "red", 255, 0, 0, 1, SVGCompliance | X11Compliance | XPMCompliance },
     { "magenta", 255, 0, 255, 1, SVGCompliance | X11Compliance | XPMCompliance },
@@ -873,32 +873,31 @@
 %                                                                             %
 %                                                                             %
 %                                                                             %
-+   G e t C o l o r I n f o                                                   %
++   G e t C o l o r C o m p l i a n c e                                       %
 %                                                                             %
 %                                                                             %
 %                                                                             %
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %
-%  GetColorInfo() searches the color list for the specified name and if found
-%  returns attributes for that color.
+%  GetColorInfo() searches the color list for the specified name and standards
+%  compliance and if found returns attributes for that color.
 %
 %  The format of the GetColorInfo method is:
 %
 %      const PixelPacket *GetColorInfo(const char *name,
-%        ExceptionInfo *exception)
+%        const ComplianceType compliance,ExceptionInfo *exception)
 %
 %  A description of each parameter follows:
 %
-%    o color_info: search the color list for the specified name and if found
-%      return attributes for that color.
-%
 %    o name: the color name.
 %
+%    o compliance: Adhere to this color standard: SVG, X11, or XPM.
+%
 %    o exception: return any errors or warnings in this structure.
 %
 */
-MagickExport const ColorInfo *GetColorInfo(const char *name,
-  ExceptionInfo *exception)
+MagickExport const ColorInfo *GetColorCompliance(const char *name,
+  const ComplianceType compliance,ExceptionInfo *exception)
 {
   char
     colorname[MaxTextExtent];
@@ -938,7 +937,8 @@
   p=(const ColorInfo *) GetNextValueInLinkedList(color_list);
   while (p != (const ColorInfo *) NULL)
   {
-    if (LocaleCompare(colorname,p->name) == 0)
+    if (((p->compliance & compliance) != 0) &&
+        (LocaleCompare(colorname,p->name) == 0))
       break;
     p=(const ColorInfo *) GetNextValueInLinkedList(color_list);
   }
@@ -957,6 +957,41 @@
 %                                                                             %
 %                                                                             %
 %                                                                             %
++   G e t C o l o r I n f o                                                   %
+%                                                                             %
+%                                                                             %
+%                                                                             %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+%  GetColorInfo() searches the color list for the specified name and if found
+%  returns attributes for that color.
+%
+%  The format of the GetColorInfo method is:
+%
+%      const PixelPacket *GetColorInfo(const char *name,
+%        ExceptionInfo *exception)
+%
+%  A description of each parameter follows:
+%
+%    o color_info: search the color list for the specified name and if found
+%      return attributes for that color.
+%
+%    o name: the color name.
+%
+%    o exception: return any errors or warnings in this structure.
+%
+*/
+MagickExport const ColorInfo *GetColorInfo(const char *name,
+  ExceptionInfo *exception)
+{
+  return(GetColorCompliance(name,AllCompliance,exception));
+}
+
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%                                                                             %
+%                                                                             %
+%                                                                             %
 +   C o n c a t e n a t e C o l o r C o m p o n e n t                         %
 %                                                                             %
 %                                                                             %
@@ -2240,13 +2275,16 @@
 %
 %  The format of the QueryColorDatabase method is:
 %
-%      MagickBooleanType QueryColorDatabase(const char *name,PixelPacket *color,
+%      MagickBooleanType QueryColorDatabase(const char *name,
+%        const ComplianceType compliance,PixelPacket *color,
 %        ExceptionInfo *exception)
 %
 %  A description of each parameter follows:
 %
 %    o name: the color name (e.g. white, blue, yellow).
 %
+%    o compliance: Adhere to this color standard: SVG, X11, or XPM.
+%
 %    o color: the red, green, blue, and opacity intensities values of the
 %      named color in this structure.
 %
@@ -2261,8 +2299,8 @@
   return(y);
 }
 
-MagickExport MagickBooleanType QueryColorDatabase(const char *name,
-  PixelPacket *color,ExceptionInfo *exception)
+MagickExport MagickBooleanType QueryColorCompliance(const char *name,
+  const ComplianceType compliance,PixelPacket *color,ExceptionInfo *exception)
 {
   MagickBooleanType
     status;
@@ -2270,7 +2308,7 @@
   MagickPixelPacket
     pixel;
 
-  status=QueryMagickColor(name,&pixel,exception);
+  status=QueryMagickColorCompliance(name,compliance,&pixel,exception);
   color->opacity=ClampToQuantum(pixel.opacity);
   if (pixel.colorspace == CMYKColorspace)
     {
@@ -2296,6 +2334,41 @@
 %                                                                             %
 %                                                                             %
 %                                                                             %
+%   Q u e r y C o l o r D a t a b a s e                                       %
+%                                                                             %
+%                                                                             %
+%                                                                             %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+%  QueryColorDatabase() returns the red, green, blue, and opacity intensities
+%  for a given color name.
+%
+%  The format of the QueryColorDatabase method is:
+%
+%      MagickBooleanType QueryColorDatabase(const char *name,PixelPacket *color,
+%        ExceptionInfo *exception)
+%
+%  A description of each parameter follows:
+%
+%    o name: the color name (e.g. white, blue, yellow).
+%
+%    o color: the red, green, blue, and opacity intensities values of the
+%      named color in this structure.
+%
+%    o exception: return any errors or warnings in this structure.
+%
+*/
+MagickExport MagickBooleanType QueryColorDatabase(const char *name,
+  PixelPacket *color,ExceptionInfo *exception)
+{
+  return(QueryColorCompliance(name,AllCompliance,color,exception));
+}
+
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%                                                                             %
+%                                                                             %
+%                                                                             %
 %  Q u e r y C o l o r n a m e                                                %
 %                                                                             %
 %                                                                             %
@@ -2341,32 +2414,36 @@
 %                                                                             %
 %                                                                             %
 %                                                                             %
-%   Q u e r y M a g i c k C o l o r                                           %
+%   Q u e r y M a g i c k C o l o r C o m p l i a n c e                       %
 %                                                                             %
 %                                                                             %
 %                                                                             %
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %
-%  QueryMagickColor() returns the red, green, blue, and opacity intensities
-%  for a given color name.
+%  QueryMagickColorCompliance() returns the red, green, blue, and opacity
+%  intensities for a given color name and standards compliance.
 %
 %  The format of the QueryMagickColor method is:
 %
 %      MagickBooleanType QueryMagickColor(const char *name,
-%        MagickPixelPacket *color,ExceptionInfo *exception)
+%        const ComplianceType compliance,MagickPixelPacket *color,
+%        ExceptionInfo *exception)
 %
 %  A description of each parameter follows:
 %
 %    o name: the color name (e.g. white, blue, yellow).
 %
+%    o compliance: Adhere to this color standard: SVG, X11, or XPM.
+%
 %    o color: the red, green, blue, and opacity intensities values of the
 %      named color in this structure.
 %
 %    o exception: return any errors or warnings in this structure.
 %
 */
-MagickExport MagickBooleanType QueryMagickColor(const char *name,
-  MagickPixelPacket *color,ExceptionInfo *exception)
+MagickExport MagickBooleanType QueryMagickColorCompliance(const char *name,
+  const ComplianceType compliance,MagickPixelPacket *color,
+  ExceptionInfo *exception)
 {
   GeometryInfo
     geometry_info;
@@ -2591,7 +2668,7 @@
   /*
     Parse named color.
   */
-  p=GetColorInfo(name,exception);
+  p=GetColorCompliance(name,compliance,exception);
   if (p == (const ColorInfo *) NULL)
     return(MagickFalse);
   color->colorspace=RGBColorspace;
@@ -2609,6 +2686,41 @@
 %                                                                             %
 %                                                                             %
 %                                                                             %
+%   Q u e r y M a g i c k C o l o r                                           %
+%                                                                             %
+%                                                                             %
+%                                                                             %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+%  QueryMagickColor() returns the red, green, blue, and opacity intensities
+%  for a given color name.
+%
+%  The format of the QueryMagickColor method is:
+%
+%      MagickBooleanType QueryMagickColor(const char *name,
+%        MagickPixelPacket *color,ExceptionInfo *exception)
+%
+%  A description of each parameter follows:
+%
+%    o name: the color name (e.g. white, blue, yellow).
+%
+%    o color: the red, green, blue, and opacity intensities values of the
+%      named color in this structure.
+%
+%    o exception: return any errors or warnings in this structure.
+%
+*/
+MagickExport MagickBooleanType QueryMagickColor(const char *name,
+  MagickPixelPacket *color,ExceptionInfo *exception)
+{
+  return(QueryMagickColorCompliance(name,AllCompliance,color,exception));
+}
+
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%                                                                             %
+%                                                                             %
+%                                                                             %
 %  Q u e r y M a g i c k C o l o r n a m e                                    %
 %                                                                             %
 %                                                                             %
@@ -2658,8 +2770,6 @@
     {
       pixel.matte=MagickFalse;
       pixel.depth=(size_t) MagickMin(1.0*image->depth,16.0);
-      GetColorTuple(&pixel,MagickTrue,name);
-      return(MagickTrue);
     }
   GetColorTuple(&pixel,compliance != SVGCompliance ? MagickTrue : MagickFalse,
     name);
diff --git a/magick/color.h b/magick/color.h
index 8855593..86098f5 100644
--- a/magick/color.h
+++ b/magick/color.h
@@ -85,9 +85,13 @@
   IsOpacitySimilar(const Image *,const PixelPacket *,const PixelPacket *),
   IsOpaqueImage(const Image *,ExceptionInfo *),
   ListColorInfo(FILE *,ExceptionInfo *),
+  QueryColorCompliance(const char *,const ComplianceType,PixelPacket *,
+    ExceptionInfo *),
   QueryColorDatabase(const char *,PixelPacket *,ExceptionInfo *),
   QueryColorname(const Image *,const PixelPacket *,const ComplianceType,char *,
     ExceptionInfo *),
+  QueryMagickColorCompliance(const char *,const ComplianceType,
+    MagickPixelPacket *,ExceptionInfo *),
   QueryMagickColor(const char *,MagickPixelPacket *,ExceptionInfo *),
   QueryMagickColorname(const Image *,const MagickPixelPacket *,
     const ComplianceType,char *,ExceptionInfo *);