From 9e92b7fe6663a8f48ae0437db632d7efff9fc861 Mon Sep 17 00:00:00 2001 From: Cristy Date: Sun, 24 Dec 2017 08:26:08 -0500 Subject: [PATCH] Image type must match the results of IMv6 --- MagickCore/identify.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/MagickCore/identify.c b/MagickCore/identify.c index cce4b2414..a372549c5 100644 --- a/MagickCore/identify.c +++ b/MagickCore/identify.c @@ -486,6 +486,9 @@ MagickExport MagickBooleanType IdentifyImage(Image *image,FILE *file, ChannelStatistics *channel_statistics; + ColorspaceType + colorspace; + const char *artifact, *locate, @@ -527,6 +530,7 @@ MagickExport MagickBooleanType IdentifyImage(Image *image,FILE *file, (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); if (file == (FILE *) NULL) file=stdout; + colorspace=image->colorspace; locate=GetImageArtifact(image,"identify:locate"); if (locate != (const char *) NULL) { @@ -552,7 +556,7 @@ MagickExport MagickBooleanType IdentifyImage(Image *image,FILE *file, if (channel_statistics == (ChannelStatistics *) NULL) return(MagickFalse); (void) FormatLocaleFile(file,"Channel %s locations:\n",locate); - switch (image->colorspace) + switch (colorspace) { case RGBColorspace: case sRGBColorspace: @@ -634,9 +638,9 @@ MagickExport MagickBooleanType IdentifyImage(Image *image,FILE *file, if (image->type != UndefinedType) (void) FormatLocaleFile(file,"%s ",CommandOptionToMnemonic( MagickTypeOptions,(ssize_t) image->type)); - if (image->colorspace != UndefinedColorspace) + if (colorspace != UndefinedColorspace) (void) FormatLocaleFile(file,"%s ",CommandOptionToMnemonic( - MagickColorspaceOptions,(ssize_t) image->colorspace)); + MagickColorspaceOptions,(ssize_t) colorspace)); if (image->storage_class == DirectClass) { if (image->total_colors != 0) @@ -720,8 +724,8 @@ MagickExport MagickBooleanType IdentifyImage(Image *image,FILE *file, (void) FormatLocaleFile(file," Units: %s\n",CommandOptionToMnemonic( MagickResolutionOptions,(ssize_t) image->units)); (void) FormatLocaleFile(file," Colorspace: %s\n",CommandOptionToMnemonic( - MagickColorspaceOptions,(ssize_t) image->colorspace)); - type=GetImageType(image); + MagickColorspaceOptions,(ssize_t) colorspace)); + type=IdentifyImageType(image,exception); (void) FormatLocaleFile(file," Type: %s\n",CommandOptionToMnemonic( MagickTypeOptions,(ssize_t) type)); if (image->type != type) @@ -765,7 +769,7 @@ MagickExport MagickBooleanType IdentifyImage(Image *image,FILE *file, (void) FormatLocaleFile(file," Depth: %.20g/%.20g-bit\n",(double) image->depth,(double) depth); (void) FormatLocaleFile(file," Channel depth:\n"); - switch (image->colorspace) + switch (colorspace) { case RGBColorspace: case sRGBColorspace: @@ -817,7 +821,7 @@ MagickExport MagickBooleanType IdentifyImage(Image *image,FILE *file, (void) FormatLocaleFile(file," Channel statistics:\n"); (void) FormatLocaleFile(file," Pixels: %.20g\n",(double) image->columns*image->rows); - switch (image->colorspace) + switch (colorspace) { case RGBColorspace: case sRGBColorspace: @@ -866,7 +870,7 @@ MagickExport MagickBooleanType IdentifyImage(Image *image,FILE *file, if (image->alpha_trait != UndefinedPixelTrait) (void) PrintChannelStatistics(file,AlphaPixelChannel,"Alpha",1.0/ scale,channel_statistics); - if (image->colorspace != GRAYColorspace) + if (colorspace != GRAYColorspace) { (void) FormatLocaleFile(file," Image statistics:\n"); (void) PrintChannelStatistics(file,CompositePixelChannel,"Overall", @@ -879,7 +883,7 @@ MagickExport MagickBooleanType IdentifyImage(Image *image,FILE *file, { scale=(double) ((1UL << image->depth)-1); (void) FormatLocaleFile(file," Channel moments:\n"); - switch (image->colorspace) + switch (colorspace) { case RGBColorspace: case sRGBColorspace: @@ -928,7 +932,7 @@ MagickExport MagickBooleanType IdentifyImage(Image *image,FILE *file, if (image->alpha_trait != UndefinedPixelTrait) (void) PrintChannelMoments(file,AlphaPixelChannel,"Alpha",scale, channel_moments); - if (image->colorspace != GRAYColorspace) + if (colorspace != GRAYColorspace) { (void) FormatLocaleFile(file," Image moments:\n"); (void) PrintChannelMoments(file,CompositePixelChannel,"Overall",scale, @@ -947,7 +951,7 @@ MagickExport MagickBooleanType IdentifyImage(Image *image,FILE *file, { (void) FormatLocaleFile(file," Channel features (horizontal, vertical, " "left and right diagonals, average):\n"); - switch (image->colorspace) + switch (colorspace) { case RGBColorspace: case sRGBColorspace: @@ -1001,7 +1005,7 @@ MagickExport MagickBooleanType IdentifyImage(Image *image,FILE *file, } if (ping == MagickFalse) { - if (image->colorspace == CMYKColorspace) + if (colorspace == CMYKColorspace) (void) FormatLocaleFile(file," Total ink density: %.*g%%\n", GetMagickPrecision(),100.0*GetImageTotalInkDensity(image,exception)/ (double) QuantumRange); -- 2.40.0