diff --git a/MagickCore/identify.c b/MagickCore/identify.c
index 4db16ec..a69d705 100644
--- a/MagickCore/identify.c
+++ b/MagickCore/identify.c
@@ -222,7 +222,7 @@
   ssize_t
     n,
     y;
-  
+
   switch (type)
   {
     case MaximumStatistic:
@@ -252,6 +252,7 @@
       *p;
 
     ssize_t
+      offset,
       x;
 
     p=GetVirtualPixels(image,0,y,image->columns,1,exception);
@@ -265,7 +266,8 @@
       PixelTrait traits=GetPixelChannelTraits(image,channel);
       if (traits == UndefinedPixelTrait)
         continue;
-      match=fabs((double) p[channel]-target) < 0.5 ? MagickTrue : MagickFalse;
+      offset=GetPixelChannelOffset(image,channel);
+      match=fabs((double) p[offset]-target) < 0.5 ? MagickTrue : MagickFalse;
       if (match != MagickFalse)
         {
           if ((max_locations != 0) && (n >= max_locations))
@@ -273,7 +275,7 @@
           (void) FormatLocaleFile(file," %.20g,%.20g",(double) x,(double) y);
           n++;
         }
-      p++;
+      p+=GetPixelChannels(image);
     }
     if (x < (ssize_t) image->columns)
       break;