From: cristy Date: Sun, 19 Jan 2014 18:32:15 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~2820 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a10f744111fe012be63c9773f8a12cccb2f76fff;p=imagemagick --- diff --git a/MagickCore/identify.c b/MagickCore/identify.c index e99f0f188..dcda30f6f 100644 --- a/MagickCore/identify.c +++ b/MagickCore/identify.c @@ -481,73 +481,6 @@ MagickExport MagickBooleanType IdentifyImage(Image *image,FILE *file, (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); if (file == (FILE *) NULL) file=stdout; - locate=GetImageArtifact(image,"identify:locate"); - if (locate != (const char *) NULL) - { - const char - *limit; - - size_t - max_locations; - - StatisticType - type; - - /* - Display minimum, maximum, or mean pixel locations. - */ - type=(StatisticType) ParseCommandOption(MagickStatisticOptions, - MagickFalse,locate); - limit=GetImageArtifact(image,"identify:limit"); - max_locations=0; - if (limit != (const char *) NULL) - max_locations=StringToUnsignedLong(limit); - channel_statistics=GetLocationStatistics(image,type,exception); - if (channel_statistics == (ChannelStatistics *) NULL) - return(MagickFalse); - colorspace=image->colorspace; - if (IsImageGray(image,exception) != MagickFalse) - colorspace=GRAYColorspace; - (void) FormatLocaleFile(file,"Channel %s locations:\n",locate); - switch (colorspace) - { - case RGBColorspace: - default: - { - (void) PrintChannelLocations(file,image,RedPixelChannel,"Red", - type,max_locations,channel_statistics); - (void) PrintChannelLocations(file,image,GreenPixelChannel,"Green", - type,max_locations,channel_statistics); - (void) PrintChannelLocations(file,image,BluePixelChannel,"Blue", - type,max_locations,channel_statistics); - break; - } - case CMYKColorspace: - { - (void) PrintChannelLocations(file,image,CyanPixelChannel,"Cyan", - type,max_locations,channel_statistics); - (void) PrintChannelLocations(file,image,MagentaPixelChannel,"Magenta", - type,max_locations,channel_statistics); - (void) PrintChannelLocations(file,image,YellowPixelChannel,"Yellow", - type,max_locations,channel_statistics); - (void) PrintChannelLocations(file,image,BlackPixelChannel,"Black", - type,max_locations,channel_statistics); - break; - } - case GRAYColorspace: - { - (void) PrintChannelLocations(file,image,GrayPixelChannel,"Gray", - type,max_locations,channel_statistics); - break; - } - } - if (image->alpha_trait == BlendPixelTrait) - (void) PrintChannelLocations(file,image,AlphaPixelChannel,"Alpha", - type,max_locations,channel_statistics); - channel_statistics=(ChannelStatistics *) RelinquishMagickMemory( - channel_statistics); - return(ferror(file) != 0 ? MagickFalse : MagickTrue); - } *format='\0'; elapsed_time=GetElapsedTime(&image->timer); user_time=GetUserTime(&image->timer); @@ -675,6 +608,72 @@ MagickExport MagickBooleanType IdentifyImage(Image *image,FILE *file, MagickTypeOptions,(ssize_t) image->type)); (void) FormatLocaleFile(file," Endianess: %s\n",CommandOptionToMnemonic( MagickEndianOptions,(ssize_t) image->endian)); + locate=GetImageArtifact(image,"identify:locate"); + if (locate != (const char *) NULL) + { + const char + *limit; + + size_t + max_locations; + + StatisticType + type; + + /* + Display minimum, maximum, or mean pixel locations. + */ + type=(StatisticType) ParseCommandOption(MagickStatisticOptions, + MagickFalse,locate); + limit=GetImageArtifact(image,"identify:limit"); + max_locations=0; + if (limit != (const char *) NULL) + max_locations=StringToUnsignedLong(limit); + channel_statistics=GetLocationStatistics(image,type,exception); + if (channel_statistics == (ChannelStatistics *) NULL) + return(MagickFalse); + colorspace=image->colorspace; + if (IsImageGray(image,exception) != MagickFalse) + colorspace=GRAYColorspace; + (void) FormatLocaleFile(file,"Channel %s locations:\n",locate); + switch (colorspace) + { + case RGBColorspace: + default: + { + (void) PrintChannelLocations(file,image,RedPixelChannel,"Red", + type,max_locations,channel_statistics); + (void) PrintChannelLocations(file,image,GreenPixelChannel,"Green", + type,max_locations,channel_statistics); + (void) PrintChannelLocations(file,image,BluePixelChannel,"Blue", + type,max_locations,channel_statistics); + break; + } + case CMYKColorspace: + { + (void) PrintChannelLocations(file,image,CyanPixelChannel,"Cyan", + type,max_locations,channel_statistics); + (void) PrintChannelLocations(file,image,MagentaPixelChannel,"Magenta", + type,max_locations,channel_statistics); + (void) PrintChannelLocations(file,image,YellowPixelChannel,"Yellow", + type,max_locations,channel_statistics); + (void) PrintChannelLocations(file,image,BlackPixelChannel,"Black", + type,max_locations,channel_statistics); + break; + } + case GRAYColorspace: + { + (void) PrintChannelLocations(file,image,GrayPixelChannel,"Gray", + type,max_locations,channel_statistics); + break; + } + } + if (image->alpha_trait == BlendPixelTrait) + (void) PrintChannelLocations(file,image,AlphaPixelChannel,"Alpha", + type,max_locations,channel_statistics); + channel_statistics=(ChannelStatistics *) RelinquishMagickMemory( + channel_statistics); + } /* Detail channel depth and extrema. */ diff --git a/coders/json.c b/coders/json.c index 927e99b3d..981d67c90 100644 --- a/coders/json.c +++ b/coders/json.c @@ -540,6 +540,62 @@ static MagickBooleanType EncodeImageAttributes(Image *image,FILE *file, (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); if (file == (FILE *) NULL) file=stdout; + *format='\0'; + elapsed_time=GetElapsedTime(&image->timer); + user_time=GetUserTime(&image->timer); + GetTimerInfo(&image->timer); + p=GetVirtualPixels(image,0,0,1,1,exception); + ping=p == (const Quantum *) NULL ? MagickTrue : MagickFalse; + type=GetImageType(image,exception); + (void) SignatureImage(image,exception); + (void) FormatLocaleFile(file,"Image: %s\n",image->filename); + if (*image->magick_filename != '\0') + if (LocaleCompare(image->magick_filename,image->filename) != 0) + { + char + filename[MaxTextExtent]; + + GetPathComponent(image->magick_filename,TailPath,filename); + (void) FormatLocaleFile(file," Base filename: %s\n",filename); + } + magick_info=GetMagickInfo(image->magick,exception); + if ((magick_info == (const MagickInfo *) NULL) || + (GetMagickDescription(magick_info) == (const char *) NULL)) + (void) FormatLocaleFile(file," Format: %s\n",image->magick); + else + (void) FormatLocaleFile(file," Format: %s (%s)\n",image->magick, + GetMagickDescription(magick_info)); + if ((magick_info == (const MagickInfo *) NULL) || + (GetMagickMimeType(magick_info) != (const char *) NULL)) + (void) FormatLocaleFile(file," Mime type: %s\n",GetMagickMimeType( + magick_info)); + (void) FormatLocaleFile(file," Class: %s\n",CommandOptionToMnemonic( + MagickClassOptions,(ssize_t) image->storage_class)); + (void) FormatLocaleFile(file," Geometry: %.20gx%.20g%+.20g%+.20g\n",(double) + image->columns,(double) image->rows,(double) image->tile_offset.x,(double) + image->tile_offset.y); + if ((image->magick_columns != 0) || (image->magick_rows != 0)) + if ((image->magick_columns != image->columns) || + (image->magick_rows != image->rows)) + (void) FormatLocaleFile(file," Base geometry: %.20gx%.20g\n",(double) + image->magick_columns,(double) image->magick_rows); + if ((image->resolution.x != 0.0) && (image->resolution.y != 0.0)) + { + (void) FormatLocaleFile(file," Resolution: %gx%g\n",image->resolution.x, + image->resolution.y); + (void) FormatLocaleFile(file," Print size: %gx%g\n",(double) + image->columns/image->resolution.x,(double) image->rows/ + image->resolution.y); + } + (void) FormatLocaleFile(file," Units: %s\n",CommandOptionToMnemonic( + MagickResolutionOptions,(ssize_t) image->units)); + (void) FormatLocaleFile(file," Type: %s\n",CommandOptionToMnemonic( + MagickTypeOptions,(ssize_t) type)); + if (image->type != UndefinedType) + (void) FormatLocaleFile(file," Base type: %s\n",CommandOptionToMnemonic( + MagickTypeOptions,(ssize_t) image->type)); + (void) FormatLocaleFile(file," Endianess: %s\n",CommandOptionToMnemonic( + MagickEndianOptions,(ssize_t) image->endian)); locate=GetImageArtifact(image,"identify:locate"); if (locate == (const char *) NULL) locate=GetImageArtifact(image,"json:locate"); @@ -609,64 +665,7 @@ static MagickBooleanType EncodeImageAttributes(Image *image,FILE *file, type,max_locations,channel_statistics); channel_statistics=(ChannelStatistics *) RelinquishMagickMemory( channel_statistics); - return(ferror(file) != 0 ? MagickFalse : MagickTrue); } - *format='\0'; - elapsed_time=GetElapsedTime(&image->timer); - user_time=GetUserTime(&image->timer); - GetTimerInfo(&image->timer); - p=GetVirtualPixels(image,0,0,1,1,exception); - ping=p == (const Quantum *) NULL ? MagickTrue : MagickFalse; - type=GetImageType(image,exception); - (void) SignatureImage(image,exception); - (void) FormatLocaleFile(file,"Image: %s\n",image->filename); - if (*image->magick_filename != '\0') - if (LocaleCompare(image->magick_filename,image->filename) != 0) - { - char - filename[MaxTextExtent]; - - GetPathComponent(image->magick_filename,TailPath,filename); - (void) FormatLocaleFile(file," Base filename: %s\n",filename); - } - magick_info=GetMagickInfo(image->magick,exception); - if ((magick_info == (const MagickInfo *) NULL) || - (GetMagickDescription(magick_info) == (const char *) NULL)) - (void) FormatLocaleFile(file," Format: %s\n",image->magick); - else - (void) FormatLocaleFile(file," Format: %s (%s)\n",image->magick, - GetMagickDescription(magick_info)); - if ((magick_info == (const MagickInfo *) NULL) || - (GetMagickMimeType(magick_info) != (const char *) NULL)) - (void) FormatLocaleFile(file," Mime type: %s\n",GetMagickMimeType( - magick_info)); - (void) FormatLocaleFile(file," Class: %s\n",CommandOptionToMnemonic( - MagickClassOptions,(ssize_t) image->storage_class)); - (void) FormatLocaleFile(file," Geometry: %.20gx%.20g%+.20g%+.20g\n",(double) - image->columns,(double) image->rows,(double) image->tile_offset.x,(double) - image->tile_offset.y); - if ((image->magick_columns != 0) || (image->magick_rows != 0)) - if ((image->magick_columns != image->columns) || - (image->magick_rows != image->rows)) - (void) FormatLocaleFile(file," Base geometry: %.20gx%.20g\n",(double) - image->magick_columns,(double) image->magick_rows); - if ((image->resolution.x != 0.0) && (image->resolution.y != 0.0)) - { - (void) FormatLocaleFile(file," Resolution: %gx%g\n",image->resolution.x, - image->resolution.y); - (void) FormatLocaleFile(file," Print size: %gx%g\n",(double) - image->columns/image->resolution.x,(double) image->rows/ - image->resolution.y); - } - (void) FormatLocaleFile(file," Units: %s\n",CommandOptionToMnemonic( - MagickResolutionOptions,(ssize_t) image->units)); - (void) FormatLocaleFile(file," Type: %s\n",CommandOptionToMnemonic( - MagickTypeOptions,(ssize_t) type)); - if (image->type != UndefinedType) - (void) FormatLocaleFile(file," Base type: %s\n",CommandOptionToMnemonic( - MagickTypeOptions,(ssize_t) image->type)); - (void) FormatLocaleFile(file," Endianess: %s\n",CommandOptionToMnemonic( - MagickEndianOptions,(ssize_t) image->endian)); /* Detail channel depth and extrema. */