]> granicus.if.org Git - imagemagick/commitdiff
...
authorCristy <urban-warrior@imagemagick.org>
Fri, 3 Feb 2017 01:33:08 +0000 (20:33 -0500)
committerCristy <urban-warrior@imagemagick.org>
Fri, 3 Feb 2017 01:33:08 +0000 (20:33 -0500)
MagickCore/identify.c
MagickCore/pixel.c

index b76c66e1386e4a7ad34b473a434ec74ac7a6b2cd..eb6e29e820909e9b0bfae2a1558a738773ad039b 100644 (file)
@@ -795,7 +795,7 @@ MagickExport MagickBooleanType IdentifyImage(Image *image,FILE *file,
             channel_statistics[GrayPixelChannel].depth);
           break;
         }
-       default:
+        default:
         {
           ssize_t
             number_channels;
@@ -851,7 +851,7 @@ MagickExport MagickBooleanType IdentifyImage(Image *image,FILE *file,
             scale,channel_statistics);
           break;
         }
-       default:
+        default:
         {
           ssize_t
             number_channels;
@@ -864,7 +864,7 @@ MagickExport MagickBooleanType IdentifyImage(Image *image,FILE *file,
 
             (void) FormatLocaleString(channel,MagickPathExtent,"Channel %.20g",
               (double) i);
-            (void) PrintChannelStatistics(file,GrayPixelChannel,channel,1.0/
+            (void) PrintChannelStatistics(file,(PixelChannel) i,channel,1.0/
               scale,channel_statistics);
           }
           break;
@@ -917,7 +917,7 @@ MagickExport MagickBooleanType IdentifyImage(Image *image,FILE *file,
             channel_moments);
           break;
         }
-       default:
+        default:
         {
           ssize_t
             number_channels;
@@ -930,7 +930,7 @@ MagickExport MagickBooleanType IdentifyImage(Image *image,FILE *file,
 
             (void) FormatLocaleString(channel,MagickPathExtent,"Channel %.20g",
               (double) i);
-            (void) PrintChannelMoments(file,GrayPixelChannel,"channel",scale,
+            (void) PrintChannelMoments(file,(PixelChannel) i,"channel",scale,
               channel_moments);
           }
           break;
@@ -989,7 +989,7 @@ MagickExport MagickBooleanType IdentifyImage(Image *image,FILE *file,
             channel_features);
           break;
         }
-       default:
+        default:
         {
           ssize_t
             number_channels;
@@ -1002,7 +1002,7 @@ MagickExport MagickBooleanType IdentifyImage(Image *image,FILE *file,
 
             (void) FormatLocaleString(channel,MagickPathExtent,"Channel %.20g",
               (double) i);
-            (void) PrintChannelFeatures(file,GrayPixelChannel,channel,
+            (void) PrintChannelFeatures(file,(PixelChannel) i,channel,
               channel_features);
           }
           break;
index 858dc99eb1cce274e44fddad5c6bfdef289d9b85..5268e3e77b18b851ae7ebbf940833124c40b511f 100644 (file)
@@ -4425,12 +4425,26 @@ MagickExport void InitializePixelChannelMap(Image *image)
   assert(image->signature == MagickCoreSignature);
   (void) ResetMagickMemory(image->channel_map,0,MaxPixelChannels*
     sizeof(*image->channel_map));
+  n=0;
+  if (image->colorspace == UndefinedColorspace)
+    {
+      /*
+        Multispectral image.
+      */
+      for (i=0; i < (ssize_t) image->number_channels; i++)
+        SetPixelChannelAttributes(image,(PixelChannel) i,UpdatePixelTrait,n++);
+      for (i=0; i < (ssize_t) image->number_meta_channels; i++)
+        SetPixelChannelAttributes(image,(PixelChannel) (image->number_channels+
+          i),UpdatePixelTrait,n++);
+      if (image->debug != MagickFalse)
+        LogPixelChannels(image);
+      SetImageChannelMask(image,image->channel_mask);
+      return;
+    }
   trait=UpdatePixelTrait;
   if (image->alpha_trait != UndefinedPixelTrait)
     trait=(PixelTrait) (trait | BlendPixelTrait);
-  n=0;
-  if ((image->colorspace == GRAYColorspace) ||
-      (image->colorspace == UndefinedColorspace))
+  if (image->colorspace == GRAYColorspace)
     {
       SetPixelChannelAttributes(image,BluePixelChannel,trait,n);
       SetPixelChannelAttributes(image,GreenPixelChannel,trait,n);
@@ -4454,12 +4468,9 @@ MagickExport void InitializePixelChannelMap(Image *image)
     SetPixelChannelAttributes(image,WriteMaskPixelChannel,CopyPixelTrait,n++);
   assert((n+image->number_meta_channels) < MaxPixelChannels);
   image->number_channels=(size_t) n;
-  trait=CopyPixelTrait;
-  if (image->colorspace == UndefinedColorspace)
-    trait=UpdatePixelTrait;
   for (i=0; i < (ssize_t) image->number_meta_channels; i++)
-    SetPixelChannelAttributes(image,(PixelChannel) (MetaPixelChannel+i),trait,
-      n++);
+    SetPixelChannelAttributes(image,(PixelChannel) (MetaPixelChannel+i),
+      CopyPixelTrait,n++);
   if (image->debug != MagickFalse)
     LogPixelChannels(image);
   SetImageChannelMask(image,image->channel_mask);