From 31c17a7e4e6a86d87c245586a08648a96774cff0 Mon Sep 17 00:00:00 2001 From: Cristy Date: Thu, 2 Feb 2017 20:33:08 -0500 Subject: [PATCH] ... --- MagickCore/identify.c | 14 +++++++------- MagickCore/pixel.c | 27 +++++++++++++++++++-------- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/MagickCore/identify.c b/MagickCore/identify.c index b76c66e13..eb6e29e82 100644 --- a/MagickCore/identify.c +++ b/MagickCore/identify.c @@ -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; diff --git a/MagickCore/pixel.c b/MagickCore/pixel.c index 858dc99eb..5268e3e77 100644 --- a/MagickCore/pixel.c +++ b/MagickCore/pixel.c @@ -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); -- 2.40.0