45#include "MagickCore/studio.h"
46#include "MagickCore/annotate.h"
47#include "MagickCore/artifact.h"
48#include "MagickCore/attribute.h"
49#include "MagickCore/blob.h"
50#include "MagickCore/blob-private.h"
51#include "MagickCore/cache.h"
52#include "MagickCore/client.h"
53#include "MagickCore/coder.h"
54#include "MagickCore/color.h"
55#include "MagickCore/configure.h"
56#include "MagickCore/constitute.h"
57#include "MagickCore/decorate.h"
58#include "MagickCore/delegate.h"
59#include "MagickCore/draw.h"
60#include "MagickCore/effect.h"
61#include "MagickCore/exception.h"
62#include "MagickCore/exception-private.h"
63#include "MagickCore/feature.h"
64#include "MagickCore/gem.h"
65#include "MagickCore/geometry.h"
66#include "MagickCore/histogram.h"
67#include "MagickCore/identify.h"
68#include "MagickCore/image.h"
69#include "MagickCore/image-private.h"
70#include "MagickCore/list.h"
71#include "MagickCore/locale_.h"
72#include "MagickCore/log.h"
73#include "MagickCore/magic.h"
74#include "MagickCore/magick.h"
75#include "MagickCore/memory_.h"
76#include "MagickCore/module.h"
77#include "MagickCore/monitor.h"
78#include "MagickCore/montage.h"
79#include "MagickCore/option.h"
80#include "MagickCore/pixel-accessor.h"
81#include "MagickCore/pixel-private.h"
82#include "MagickCore/prepress.h"
83#include "MagickCore/profile.h"
84#include "MagickCore/property.h"
85#include "MagickCore/quantize.h"
86#include "MagickCore/quantum.h"
87#include "MagickCore/random_.h"
88#include "MagickCore/registry.h"
89#include "MagickCore/resize.h"
90#include "MagickCore/resource_.h"
91#include "MagickCore/signature.h"
92#include "MagickCore/statistic.h"
93#include "MagickCore/string_.h"
94#include "MagickCore/string-private.h"
95#include "MagickCore/timer.h"
96#include "MagickCore/timer-private.h"
97#include "MagickCore/token.h"
98#include "MagickCore/utility.h"
99#include "MagickCore/utility-private.h"
100#include "MagickCore/version.h"
146 assert(image != (
Image *) NULL);
147 assert(image->signature == MagickCoreSignature);
148 if (IsEventLogging() != MagickFalse)
149 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",image->filename);
151 MaxPixelChannels+1,
sizeof(*channel_statistics));
153 ThrowFatalException(ResourceLimitFatalError,
"MemoryAllocationFailed");
154 (void) memset(channel_statistics,0,(MaxPixelChannels+1)*
155 sizeof(*channel_statistics));
156 for (i=0; i <= (ssize_t) MaxPixelChannels; i++)
160 case MaximumStatistic:
163 channel_statistics[i].maxima=(-MagickMaximumValue);
166 case MinimumStatistic:
168 channel_statistics[i].minima=MagickMaximumValue;
173 for (y=0; y < (ssize_t) image->rows; y++)
181 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
182 if (p == (
const Quantum *) NULL)
184 for (x=0; x < (ssize_t) image->columns; x++)
186 if (GetPixelReadMask(image,p) <= (QuantumRange/2))
188 p+=(ptrdiff_t) GetPixelChannels(image);
191 for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
193 PixelChannel channel = GetPixelChannelChannel(image,i);
194 PixelTrait traits = GetPixelChannelTraits(image,channel);
195 if (traits == UndefinedPixelTrait)
199 case MaximumStatistic:
202 if ((
double) p[i] > channel_statistics[channel].maxima)
203 channel_statistics[channel].maxima=(double) p[i];
206 case MinimumStatistic:
208 if ((
double) p[i] < channel_statistics[channel].minima)
209 channel_statistics[channel].minima=(double) p[i];
214 p+=(ptrdiff_t) GetPixelChannels(image);
217 return(channel_statistics);
220static ssize_t PrintChannelFeatures(FILE *file,
const PixelChannel channel,
223#define PrintFeature(feature) \
224 GetMagickPrecision(),(feature)[0], \
225 GetMagickPrecision(),(feature)[1], \
226 GetMagickPrecision(),(feature)[2], \
227 GetMagickPrecision(),(feature)[3], \
228 GetMagickPrecision(),((feature)[0]+(feature)[1]+(feature)[2]+(feature)[3])/4.0 \
230#define FeaturesFormat " %s:\n" \
231 " Angular Second Moment:\n" \
232 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \
234 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \
236 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \
237 " Sum of Squares Variance:\n" \
238 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \
239 " Inverse Difference Moment:\n" \
240 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \
242 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \
244 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \
246 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \
248 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \
249 " Difference Variance:\n" \
250 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \
251 " Difference Entropy:\n" \
252 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \
253 " Information Measure of Correlation 1:\n" \
254 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \
255 " Information Measure of Correlation 2:\n" \
256 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \
257 " Maximum Correlation Coefficient:\n" \
258 " %.*g, %.*g, %.*g, %.*g, %.*g\n"
263 n=FormatLocaleFile(file,FeaturesFormat,name,
264 PrintFeature(channel_features[channel].angular_second_moment),
265 PrintFeature(channel_features[channel].contrast),
266 PrintFeature(channel_features[channel].correlation),
267 PrintFeature(channel_features[channel].variance_sum_of_squares),
268 PrintFeature(channel_features[channel].inverse_difference_moment),
269 PrintFeature(channel_features[channel].sum_average),
270 PrintFeature(channel_features[channel].sum_variance),
271 PrintFeature(channel_features[channel].sum_entropy),
272 PrintFeature(channel_features[channel].entropy),
273 PrintFeature(channel_features[channel].difference_variance),
274 PrintFeature(channel_features[channel].difference_entropy),
275 PrintFeature(channel_features[channel].measure_of_correlation_1),
276 PrintFeature(channel_features[channel].measure_of_correlation_2),
277 PrintFeature(channel_features[channel].maximum_correlation_coefficient));
281static ssize_t PrintChannelLocations(FILE *file,
const Image *image,
282 const PixelChannel channel,
const char *name,
const StatisticType type,
297 case MaximumStatistic:
300 target=channel_statistics[channel].maxima;
303 case MinimumStatistic:
305 target=channel_statistics[channel].minima;
309 (void) FormatLocaleFile(file,
" %s: %.*g (%.*g)",name,GetMagickPrecision(),
310 target,GetMagickPrecision(),QuantumScale*target);
311 exception=AcquireExceptionInfo();
313 for (y=0; y < (ssize_t) image->rows; y++)
322 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
323 if (p == (
const Quantum *) NULL)
325 for (x=0; x < (ssize_t) image->columns; x++)
330 PixelTrait traits = GetPixelChannelTraits(image,channel);
331 if (traits == UndefinedPixelTrait)
333 offset=GetPixelChannelOffset(image,channel);
334 match=fabs((
double) p[offset]-target) < 0.5 ? MagickTrue : MagickFalse;
335 if (match != MagickFalse)
337 if ((max_locations != 0) && (n >= (ssize_t) max_locations))
339 (void) FormatLocaleFile(file,
" %.20g,%.20g",(
double) x,(
double) y);
342 p+=(ptrdiff_t) GetPixelChannels(image);
344 if (x < (ssize_t) image->columns)
347 (void) FormatLocaleFile(file,
"\n");
351static ssize_t PrintChannelMoments(FILE *file,
const PixelChannel channel,
352 const char *name,
const double scale,
const ChannelMoments *channel_moments)
355 powers[MaximumNumberOfImageMoments] =
356 { 1.0, 2.0, 3.0, 3.0, 6.0, 4.0, 6.0, 4.0 };
364 n=FormatLocaleFile(file,
" %s:\n",name);
365 n+=FormatLocaleFile(file,
" Centroid: %.*g,%.*g\n",
366 GetMagickPrecision(),channel_moments[channel].centroid.x,
367 GetMagickPrecision(),channel_moments[channel].centroid.y);
368 n+=FormatLocaleFile(file,
" Ellipse Semi-Major/Minor axis: %.*g,%.*g\n",
369 GetMagickPrecision(),channel_moments[channel].ellipse_axis.x,
370 GetMagickPrecision(),channel_moments[channel].ellipse_axis.y);
371 n+=FormatLocaleFile(file,
" Ellipse angle: %.*g\n",
372 GetMagickPrecision(),channel_moments[channel].ellipse_angle);
373 n+=FormatLocaleFile(file,
" Ellipse eccentricity: %.*g\n",
374 GetMagickPrecision(),channel_moments[channel].ellipse_eccentricity);
375 n+=FormatLocaleFile(file,
" Ellipse intensity: %.*g (%.*g)\n",
376 GetMagickPrecision(),pow(scale,powers[0])*
377 channel_moments[channel].ellipse_intensity,GetMagickPrecision(),
378 channel_moments[channel].ellipse_intensity);
379 for (i=0; i < MaximumNumberOfImageMoments; i++)
380 n+=FormatLocaleFile(file,
" I%.20g: %.*g (%.*g)\n",i+1.0,
381 GetMagickPrecision(),channel_moments[channel].invariant[i]/pow(scale,
382 powers[i]),GetMagickPrecision(),channel_moments[channel].invariant[i]);
386static ssize_t PrintChannelPerceptualHash(
Image *image,FILE *file,
395 (void) FormatLocaleFile(file,
" Channel perceptual hash: ");
396 for (i=0; i < (ssize_t) channel_phash[0].number_colorspaces; i++)
398 (void) FormatLocaleFile(file,
"%s",CommandOptionToMnemonic(
399 MagickColorspaceOptions,(ssize_t) channel_phash[0].colorspace[i]));
400 if (i < (ssize_t) (channel_phash[0].number_colorspaces-1))
401 (void) FormatLocaleFile(file,
", ");
403 (void) FormatLocaleFile(file,
"\n");
405 for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
416 channel=GetPixelChannelChannel(image,i);
417 if (channel == IndexPixelChannel)
419 traits=GetPixelChannelTraits(image,channel);
420 if (traits == UndefinedPixelTrait)
422 n=FormatLocaleFile(file,
" Channel %.20g:\n",(
double) channel);
423 for (j=0; j < MaximumNumberOfPerceptualHashes; j++)
428 n+=FormatLocaleFile(file,
" PH%.20g: ",(
double) j+1);
429 for (k=0; k < (ssize_t) channel_phash[0].number_colorspaces; k++)
431 n+=FormatLocaleFile(file,
"%.*g",GetMagickPrecision(),
432 channel_phash[channel].phash[k][j]);
433 if (k < (ssize_t) (channel_phash[0].number_colorspaces-1))
434 n+=FormatLocaleFile(file,
", ");
436 n+=FormatLocaleFile(file,
"\n");
442static ssize_t PrintChannelStatistics(FILE *file,
const PixelChannel channel,
443 const char *name,
const double scale,
446#define StatisticsFormat " %s:\n min: %.*g (%.*g)\n " \
447 "max: %.*g (%.*g)\n mean: %.*g (%.*g)\n median: %.*g (%.*g)\n " \
448 "standard deviation: %.*g (%.*g)\n kurtosis: %.*g\n " \
449 "skewness: %.*g\n entropy: %.*g\n"
454 n=FormatLocaleFile(file,StatisticsFormat,name,GetMagickPrecision(),
455 (
double) ClampToQuantum((MagickRealType) (scale*
456 channel_statistics[channel].minima)),GetMagickPrecision(),
457 channel_statistics[channel].minima/(
double) QuantumRange,
458 GetMagickPrecision(),(
double) ClampToQuantum((MagickRealType) (scale*
459 channel_statistics[channel].maxima)),GetMagickPrecision(),
460 channel_statistics[channel].maxima/(
double) QuantumRange,
461 GetMagickPrecision(),scale*channel_statistics[channel].mean,
462 GetMagickPrecision(),channel_statistics[channel].mean/(
double) QuantumRange,
463 GetMagickPrecision(),scale*channel_statistics[channel].median,
464 GetMagickPrecision(),channel_statistics[channel].median/(
double) QuantumRange,
465 GetMagickPrecision(),scale*channel_statistics[channel].standard_deviation,
466 GetMagickPrecision(),channel_statistics[channel].standard_deviation/
467 (
double) QuantumRange,GetMagickPrecision(),
468 channel_statistics[channel].kurtosis,GetMagickPrecision(),
469 channel_statistics[channel].skewness,GetMagickPrecision(),
470 channel_statistics[channel].entropy);
474MagickExport MagickBooleanType IdentifyImage(
Image *image,FILE *file,
478 buffer[MagickPathExtent],
479 color[MagickPathExtent],
480 key[MagickPathExtent];
537 assert(image != (
Image *) NULL);
538 assert(image->signature == MagickCoreSignature);
539 if (IsEventLogging() != MagickFalse)
540 (void) LogMagickEvent(TraceEvent,GetMagickModule(),
"%s",image->filename);
541 if (file == (FILE *) NULL)
543 colorspace=image->colorspace;
544 locate=GetImageArtifact(image,
"identify:locate");
545 if (locate != (
const char *) NULL)
559 statistic_type=(StatisticType) ParseCommandOption(MagickStatisticOptions,
561 limit=GetImageArtifact(image,
"identify:limit");
563 if (limit != (
const char *) NULL)
564 max_locations=StringToUnsignedLong(limit);
565 channel_statistics=GetLocationStatistics(image,statistic_type,exception);
568 (void) FormatLocaleFile(file,
"Channel %s locations:\n",locate);
574 if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0)
575 (void) PrintChannelLocations(file,image,RedPixelChannel,
"Red",
576 statistic_type,max_locations,channel_statistics);
577 if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0)
578 (void) PrintChannelLocations(file,image,GreenPixelChannel,
"Green",
579 statistic_type,max_locations,channel_statistics);
580 if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0)
581 (void) PrintChannelLocations(file,image,BluePixelChannel,
"Blue",
582 statistic_type,max_locations,channel_statistics);
587 if ((GetPixelCyanTraits(image) & UpdatePixelTrait) != 0)
588 (void) PrintChannelLocations(file,image,CyanPixelChannel,
"Cyan",
589 statistic_type,max_locations,channel_statistics);
590 if ((GetPixelMagentaTraits(image) & UpdatePixelTrait) != 0)
591 (void) PrintChannelLocations(file,image,MagentaPixelChannel,
592 "Magenta",statistic_type,max_locations,channel_statistics);
593 if ((GetPixelYellowTraits(image) & UpdatePixelTrait) != 0)
594 (void) PrintChannelLocations(file,image,YellowPixelChannel,
"Yellow",
595 statistic_type,max_locations,channel_statistics);
596 if ((GetPixelBlackTraits(image) & UpdatePixelTrait) != 0)
597 (void) PrintChannelLocations(file,image,BlackPixelChannel,
"Black",
598 statistic_type,max_locations,channel_statistics);
601 case LinearGRAYColorspace:
604 if ((GetPixelGrayTraits(image) & UpdatePixelTrait) != 0)
605 (void) PrintChannelLocations(file,image,GrayPixelChannel,
"Gray",
606 statistic_type,max_locations,channel_statistics);
611 for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
613 PixelChannel channel = GetPixelChannelChannel(image,i);
614 PixelTrait traits = GetPixelChannelTraits(image,channel);
615 if ((traits & UpdatePixelTrait) != 0)
616 (void) PrintChannelLocations(file,image,channel,
"Channel",
617 statistic_type,max_locations,channel_statistics);
622 if (image->alpha_trait != UndefinedPixelTrait)
623 (void) PrintChannelLocations(file,image,AlphaPixelChannel,
"Alpha",
624 statistic_type,max_locations,channel_statistics);
627 return(ferror(file) != 0 ? MagickFalse : MagickTrue);
629 elapsed_time=GetElapsedTime(&image->timer);
630 user_time=GetUserTime(&image->timer);
631 GetTimerInfo(&image->timer);
632 if (verbose == MagickFalse)
637 if (*image->magick_filename !=
'\0')
638 if (LocaleCompare(image->magick_filename,image->filename) != 0)
639 (void) FormatLocaleFile(file,
"%s=>",image->magick_filename);
640 if ((GetPreviousImageInList(image) == (
Image *) NULL) &&
641 (GetNextImageInList(image) == (
Image *) NULL) &&
643 (void) FormatLocaleFile(file,
"%s ",image->filename);
645 (
void) FormatLocaleFile(file,
"%s[%.20g] ",image->filename,(
double)
647 (void) FormatLocaleFile(file,
"%s ",image->magick);
648 if ((image->magick_columns != 0) || (image->magick_rows != 0))
649 if ((image->magick_columns != image->columns) ||
650 (image->magick_rows != image->rows))
651 (void) FormatLocaleFile(file,
"%.20gx%.20g=>",(
double)
652 image->magick_columns,(
double) image->magick_rows);
653 (void) FormatLocaleFile(file,
"%.20gx%.20g ",(
double) image->columns,
654 (
double) image->rows);
655 if ((image->page.width != 0) || (image->page.height != 0) ||
656 (image->page.x != 0) || (image->page.y != 0))
657 (void) FormatLocaleFile(file,
"%.20gx%.20g%+.20g%+.20g ",(
double)
658 image->page.width,(
double) image->page.height,(
double) image->page.x,
659 (
double) image->page.y);
660 (void) FormatLocaleFile(file,
"%.20g-bit ",(
double) image->depth);
661 if (image->type != UndefinedType)
662 (void) FormatLocaleFile(file,
"%s ",CommandOptionToMnemonic(
663 MagickTypeOptions,(ssize_t) image->type));
664 if (colorspace != UndefinedColorspace)
665 (void) FormatLocaleFile(file,
"%s ",CommandOptionToMnemonic(
666 MagickColorspaceOptions,(ssize_t) colorspace));
667 if (image->storage_class == DirectClass)
669 if (image->total_colors != 0)
671 (void) FormatMagickSize(image->total_colors,MagickFalse,
"B",
672 MagickPathExtent,buffer);
673 (void) FormatLocaleFile(file,
"%s ",buffer);
677 if (image->total_colors <= image->colors)
678 (void) FormatLocaleFile(file,
"%.20gc ",(
double)
681 (
void) FormatLocaleFile(file,
"%.20g=>%.20gc ",(
double)
682 image->total_colors,(
double) image->colors);
683 if (image->error.mean_error_per_pixel != 0.0)
684 (void) FormatLocaleFile(file,
"%.20g/%f/%fdb ",(
double)
685 (image->error.mean_error_per_pixel+0.5),
686 image->error.normalized_mean_error,
687 image->error.normalized_maximum_error);
688 if (image->extent != 0)
690 (void) FormatMagickSize(image->extent,MagickTrue,
"B",
691 MagickPathExtent,buffer);
692 (void) FormatLocaleFile(file,
"%s ",buffer);
694 (void) FormatLocaleFile(file,
"%0.3fu %lu:%02lu.%03lu",user_time,
695 (
unsigned long) (elapsed_time/60.0),(
unsigned long) floor(fmod(
696 elapsed_time,60.0)),(
unsigned long) (1000.0*(elapsed_time-
697 floor(elapsed_time))));
698 (void) FormatLocaleFile(file,
"\n");
700 return(ferror(file) != 0 ? MagickFalse : MagickTrue);
705 p=GetVirtualPixels(image,0,0,1,1,exception);
706 ping=p == (
const Quantum *) NULL ? MagickTrue : MagickFalse;
707 (void) SignatureImage(image,exception);
713 if (ping == MagickFalse)
715 depth=GetImageDepth(image,exception);
716 channel_statistics=GetImageStatistics(image,exception);
717 artifact=GetImageArtifact(image,
"identify:moments");
718 if (artifact != (
const char *) NULL)
720 channel_moments=GetImageMoments(image,exception);
721 channel_phash=GetImagePerceptualHash(image,exception);
723 artifact=GetImageArtifact(image,
"identify:features");
724 if (artifact != (
const char *) NULL)
726 distance=StringToUnsignedLong(artifact);
727 channel_features=GetImageFeatures(image,distance,exception);
730 (void) FormatLocaleFile(file,
"Image:\n Filename: %s\n",image->filename);
731 if (*image->magick_filename !=
'\0')
732 if (LocaleCompare(image->magick_filename,image->filename) != 0)
735 filename[MagickPathExtent];
737 GetPathComponent(image->magick_filename,TailPath,filename);
738 (void) FormatLocaleFile(file,
" Base filename: %s\n",filename);
740 properties=(*GetBlobProperties(image));
741 if (properties.st_mode != 0)
743 static const char *rwx[] =
744 {
"---",
"--x",
"-w-",
"-wx",
"r--",
"r-x",
"rw-",
"rwx"};
745 (void) FormatLocaleFile(file,
" Permissions: %s%s%s\n",
746 rwx[(properties.st_mode >> 6) & 0x07],
747 rwx[(properties.st_mode >> 3) & 0x07],
748 rwx[(properties.st_mode >> 0) & 0x07]);
750 magick_info=GetMagickInfo(image->magick,exception);
751 if ((magick_info == (
const MagickInfo *) NULL) ||
752 (GetMagickDescription(magick_info) == (
const char *) NULL))
753 (void) FormatLocaleFile(file,
" Format: %s\n",image->magick);
755 (
void) FormatLocaleFile(file,
" Format: %s (%s)\n",image->magick,
756 GetMagickDescription(magick_info));
757 if ((magick_info != (
const MagickInfo *) NULL) &&
758 (GetMagickMimeType(magick_info) != (
const char *) NULL))
759 (void) FormatLocaleFile(file,
" Mime type: %s\n",GetMagickMimeType(
761 (void) FormatLocaleFile(file,
" Class: %s\n",CommandOptionToMnemonic(
762 MagickClassOptions,(ssize_t) image->storage_class));
763 (void) FormatLocaleFile(file,
" Geometry: %.20gx%.20g%+.20g%+.20g\n",(
double)
764 image->columns,(
double) image->rows,(
double) image->tile_offset.x,(
double)
765 image->tile_offset.y);
766 if ((image->magick_columns != 0) || (image->magick_rows != 0))
767 if ((image->magick_columns != image->columns) ||
768 (image->magick_rows != image->rows))
769 (void) FormatLocaleFile(file,
" Base geometry: %.20gx%.20g\n",(
double)
770 image->magick_columns,(
double) image->magick_rows);
771 if ((image->resolution.x != 0.0) && (image->resolution.y != 0.0))
773 (void) FormatLocaleFile(file,
" Resolution: %gx%g\n",image->resolution.x,
774 image->resolution.y);
775 (void) FormatLocaleFile(file,
" Print size: %gx%g\n",(
double)
776 image->columns/image->resolution.x,(
double) image->rows/
777 image->resolution.y);
779 (void) FormatLocaleFile(file,
" Units: %s\n",CommandOptionToMnemonic(
780 MagickResolutionOptions,(ssize_t) image->units));
781 (void) FormatLocaleFile(file,
" Colorspace: %s\n",CommandOptionToMnemonic(
782 MagickColorspaceOptions,(ssize_t) colorspace));
783 type=IdentifyImageType(image,exception);
784 (void) FormatLocaleFile(file,
" Type: %s\n",CommandOptionToMnemonic(
785 MagickTypeOptions,(ssize_t) type));
786 if (image->type != type)
787 (void) FormatLocaleFile(file,
" Base type: %s\n",CommandOptionToMnemonic(
788 MagickTypeOptions,(ssize_t) image->type));
789 (void) FormatLocaleFile(file,
" Endianness: %s\n",CommandOptionToMnemonic(
790 MagickEndianOptions,(ssize_t) image->endian));
793 if (image->depth == depth)
794 (void) FormatLocaleFile(file,
" Depth: %.20g-bit\n",(
double)
797 (
void) FormatLocaleFile(file,
" Depth: %.20g/%.20g-bit\n",(
double)
798 image->depth,(
double) depth);
800 (void) FormatLocaleFile(file,
" Channels: %g.%g\n",(
double)
801 image->number_channels,(
double) image->number_meta_channels);
807 (void) FormatLocaleFile(file,
" Channel depth:\n");
813 if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0)
814 (void) FormatLocaleFile(file,
" Red: %.20g-bit\n",(
double)
815 channel_statistics[RedPixelChannel].depth);
816 if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0)
817 (void) FormatLocaleFile(file,
" Green: %.20g-bit\n",(
double)
818 channel_statistics[GreenPixelChannel].depth);
819 if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0)
820 (void) FormatLocaleFile(file,
" Blue: %.20g-bit\n",(
double)
821 channel_statistics[BluePixelChannel].depth);
826 if ((GetPixelCyanTraits(image) & UpdatePixelTrait) != 0)
827 (void) FormatLocaleFile(file,
" Cyan: %.20g-bit\n",(
double)
828 channel_statistics[CyanPixelChannel].depth);
829 if ((GetPixelMagentaTraits(image) & UpdatePixelTrait) != 0)
830 (void) FormatLocaleFile(file,
" Magenta: %.20g-bit\n",(
double)
831 channel_statistics[MagentaPixelChannel].depth);
832 if ((GetPixelYellowTraits(image) & UpdatePixelTrait) != 0)
833 (void) FormatLocaleFile(file,
" Yellow: %.20g-bit\n",(
double)
834 channel_statistics[YellowPixelChannel].depth);
835 if ((GetPixelBlackTraits(image) & UpdatePixelTrait) != 0)
836 (void) FormatLocaleFile(file,
" Black: %.20g-bit\n",(
double)
837 channel_statistics[BlackPixelChannel].depth);
840 case LinearGRAYColorspace:
843 if ((GetPixelGrayTraits(image) & UpdatePixelTrait) != 0)
844 (void) FormatLocaleFile(file,
" Gray: %.20g-bit\n",(
double)
845 channel_statistics[GrayPixelChannel].depth);
850 for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
852 PixelChannel channel = GetPixelChannelChannel(image,i);
853 PixelTrait traits = GetPixelChannelTraits(image,channel);
854 if ((traits & UpdatePixelTrait) != 0)
855 (void) FormatLocaleFile(file,
" Channel %.20g: %.20g-bit\n",
856 (
double) i,(
double) channel_statistics[channel].depth);
861 if (image->alpha_trait != UndefinedPixelTrait)
862 (void) FormatLocaleFile(file,
" Alpha: %.20g-bit\n",(
double)
863 channel_statistics[AlphaPixelChannel].depth);
864 if ((image->channels & ReadMaskChannel) != 0)
865 (void) FormatLocaleFile(file,
" Read mask: %.20g-bit\n",(
double)
866 channel_statistics[ReadMaskPixelChannel].depth);
867 if ((image->channels & WriteMaskChannel) != 0)
868 (void) FormatLocaleFile(file,
" Write mask: %.20g-bit\n",(
double)
869 channel_statistics[WriteMaskPixelChannel].depth);
870 if ((image->channels & CompositeMaskChannel) != 0)
871 (void) FormatLocaleFile(file,
" Composite mask: %.20g-bit\n",
872 (
double) channel_statistics[CompositeMaskPixelChannel].depth);
873 if (image->number_meta_channels != 0)
874 for (i=0; i < (ssize_t) image->number_meta_channels; i++)
877 channel = (PixelChannel) (MetaPixelChannels+i);
879 (void) FormatLocaleFile(file,
" Meta channel[%.20g]: %.20g-bit\n",
880 (
double) i,(
double) channel_statistics[channel].depth);
883 if (image->depth <= MAGICKCORE_QUANTUM_DEPTH)
884 scale=(double) (QuantumRange/((
size_t) QuantumRange >> ((
size_t)
885 MAGICKCORE_QUANTUM_DEPTH-image->depth)));
886 (void) FormatLocaleFile(file,
" Channel statistics:\n");
887 (void) FormatLocaleFile(file,
" Pixels: %.20g\n",(
double)
888 image->columns*image->rows);
894 if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0)
895 (void) PrintChannelStatistics(file,RedPixelChannel,
"Red",1.0/
896 scale,channel_statistics);
897 if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0)
898 (void) PrintChannelStatistics(file,GreenPixelChannel,
"Green",1.0/
899 scale,channel_statistics);
900 if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0)
901 (void) PrintChannelStatistics(file,BluePixelChannel,
"Blue",1.0/
902 scale,channel_statistics);
907 if ((GetPixelCyanTraits(image) & UpdatePixelTrait) != 0)
908 (void) PrintChannelStatistics(file,CyanPixelChannel,
"Cyan",1.0/
909 scale,channel_statistics);
910 if ((GetPixelMagentaTraits(image) & UpdatePixelTrait) != 0)
911 (void) PrintChannelStatistics(file,MagentaPixelChannel,
"Magenta",
912 1.0/scale,channel_statistics);
913 if ((GetPixelYellowTraits(image) & UpdatePixelTrait) != 0)
914 (void) PrintChannelStatistics(file,YellowPixelChannel,
"Yellow",1.0/
915 scale,channel_statistics);
916 if ((GetPixelBlackTraits(image) & UpdatePixelTrait) != 0)
917 (void) PrintChannelStatistics(file,BlackPixelChannel,
"Black",1.0/
918 scale,channel_statistics);
921 case LinearGRAYColorspace:
924 if ((GetPixelGrayTraits(image) & UpdatePixelTrait) != 0)
925 (void) PrintChannelStatistics(file,GrayPixelChannel,
"Gray",1.0/
926 scale,channel_statistics);
931 for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
934 label[MagickPathExtent];
936 PixelChannel channel = GetPixelChannelChannel(image,i);
937 PixelTrait traits = GetPixelChannelTraits(image,channel);
938 if ((traits & UpdatePixelTrait) != 0)
940 (void) FormatLocaleString(label,MagickPathExtent,
941 "Channel %.20g",(
double) i);
942 (void) PrintChannelStatistics(file,channel,label,1.0/scale,
949 if (image->alpha_trait != UndefinedPixelTrait)
950 (void) PrintChannelStatistics(file,AlphaPixelChannel,
951 "Alpha",1.0/scale,channel_statistics);
952 if ((image->channels & ReadMaskChannel) != 0)
953 (void) PrintChannelStatistics(file,ReadMaskPixelChannel,
954 "Read mask",1.0/scale,channel_statistics);
955 if ((image->channels & WriteMaskChannel) != 0)
956 (void) PrintChannelStatistics(file,WriteMaskPixelChannel,
957 "Write mask",1.0/scale,channel_statistics);
958 if ((image->channels & CompositeMaskChannel) != 0)
959 (void) PrintChannelStatistics(file,WriteMaskPixelChannel,
960 "Composite mask",1.0/scale,channel_statistics);
961 if (image->number_meta_channels != 0)
962 for (i=0; i < (ssize_t) image->number_meta_channels; i++)
965 label[MagickPathExtent];
968 channel = (PixelChannel) (MetaPixelChannels+i);
970 (void) FormatLocaleString(label,MagickPathExtent,
971 "Meta channel[%.20g]",(
double) i);
972 (void) PrintChannelStatistics(file,channel,label,1.0/scale,
975 if ((colorspace != LinearGRAYColorspace) &&
976 (colorspace != GRAYColorspace))
978 (void) FormatLocaleFile(file,
" Image statistics:\n");
979 (void) PrintChannelStatistics(file,CompositePixelChannel,
"Overall",
980 1.0/scale,channel_statistics);
987 scale=(double) ((1UL << image->depth)-1);
988 (void) FormatLocaleFile(file,
" Channel moments:\n");
994 if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0)
995 (void) PrintChannelMoments(file,RedPixelChannel,
"Red",scale,
997 if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0)
998 (void) PrintChannelMoments(file,GreenPixelChannel,
"Green",scale,
1000 if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0)
1001 (void) PrintChannelMoments(file,BluePixelChannel,
"Blue",scale,
1005 case CMYKColorspace:
1007 if ((GetPixelCyanTraits(image) & UpdatePixelTrait) != 0)
1008 (void) PrintChannelMoments(file,CyanPixelChannel,
"Cyan",scale,
1010 if ((GetPixelMagentaTraits(image) & UpdatePixelTrait) != 0)
1011 (void) PrintChannelMoments(file,MagentaPixelChannel,
"Magenta",scale,
1013 if ((GetPixelYellowTraits(image) & UpdatePixelTrait) != 0)
1014 (void) PrintChannelMoments(file,YellowPixelChannel,
"Yellow",scale,
1016 if ((GetPixelBlackTraits(image) & UpdatePixelTrait) != 0)
1017 (void) PrintChannelMoments(file,BlackPixelChannel,
"Black",scale,
1021 case GRAYColorspace:
1023 if ((GetPixelGrayTraits(image) & UpdatePixelTrait) != 0)
1024 (void) PrintChannelMoments(file,GrayPixelChannel,
"Gray",scale,
1030 for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
1033 label[MagickPathExtent];
1035 PixelChannel channel = GetPixelChannelChannel(image,i);
1036 PixelTrait traits = GetPixelChannelTraits(image,channel);
1037 if ((traits & UpdatePixelTrait) != 0)
1039 (void) FormatLocaleString(label,MagickPathExtent,
1040 "Channel %.20g",(
double) i);
1041 (void) PrintChannelMoments(file,channel,label,scale,
1048 if (image->alpha_trait != UndefinedPixelTrait)
1049 (void) PrintChannelMoments(file,AlphaPixelChannel,
"Alpha",scale,
1051 if (colorspace != GRAYColorspace)
1053 (void) FormatLocaleFile(file,
" Image moments:\n");
1054 (void) PrintChannelMoments(file,CompositePixelChannel,
"Overall",scale,
1062 (void) PrintChannelPerceptualHash(image,file,channel_phash);
1068 (void) FormatLocaleFile(file,
" Channel features (horizontal, vertical, "
1069 "left and right diagonals, average):\n");
1073 case sRGBColorspace:
1075 if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0)
1076 (void) PrintChannelFeatures(file,RedPixelChannel,
"Red",
1078 if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0)
1079 (void) PrintChannelFeatures(file,GreenPixelChannel,
"Green",
1081 if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0)
1082 (void) PrintChannelFeatures(file,BluePixelChannel,
"Blue",
1086 case CMYKColorspace:
1088 if ((GetPixelCyanTraits(image) & UpdatePixelTrait) != 0)
1089 (void) PrintChannelFeatures(file,CyanPixelChannel,
"Cyan",
1091 if ((GetPixelMagentaTraits(image) & UpdatePixelTrait) != 0)
1092 (void) PrintChannelFeatures(file,MagentaPixelChannel,
"Magenta",
1094 if ((GetPixelYellowTraits(image) & UpdatePixelTrait) != 0)
1095 (void) PrintChannelFeatures(file,YellowPixelChannel,
"Yellow",
1097 if ((GetPixelBlackTraits(image) & UpdatePixelTrait) != 0)
1098 (void) PrintChannelFeatures(file,BlackPixelChannel,
"Black",
1102 case GRAYColorspace:
1104 if ((GetPixelGrayTraits(image) & UpdatePixelTrait) != 0)
1105 (void) PrintChannelFeatures(file,GrayPixelChannel,
"Gray",
1111 for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
1114 label[MagickPathExtent];
1116 PixelChannel channel = GetPixelChannelChannel(image,i);
1117 PixelTrait traits = GetPixelChannelTraits(image,channel);
1118 if ((traits & UpdatePixelTrait) != 0)
1120 (void) FormatLocaleString(label,MagickPathExtent,
1121 "Channel %.20g",(
double) i);
1122 (void) PrintChannelFeatures(file,channel,label,
1129 if (image->alpha_trait != UndefinedPixelTrait)
1130 (void) PrintChannelFeatures(file,AlphaPixelChannel,
"Alpha",
1135 if (ping == MagickFalse)
1137 if (colorspace == CMYKColorspace)
1138 (void) FormatLocaleFile(file,
" Total ink density: %.*g%%\n",
1139 GetMagickPrecision(),100.0*GetImageTotalInkDensity(image,exception)/
1140 (
double) QuantumRange);
1142 if (image->alpha_trait != UndefinedPixelTrait)
1145 found = MagickFalse;
1147 p=(
const Quantum *) NULL;
1148 for (y=0; y < (ssize_t) image->rows; y++)
1150 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
1151 if (p == (
const Quantum *) NULL)
1153 for (x=0; x < (ssize_t) image->columns; x++)
1155 if (GetPixelAlpha(image,p) == (Quantum) TransparentAlpha)
1160 p+=(ptrdiff_t) GetPixelChannels(image);
1162 if (found != MagickFalse)
1165 if (found != MagickFalse)
1168 tuple[MagickPathExtent];
1173 GetPixelInfo(image,&pixel);
1174 GetPixelInfoPixel(image,p,&pixel);
1175 (void) QueryColorname(image,&pixel,SVGCompliance,tuple,
1177 (void) FormatLocaleFile(file,
" Alpha: %s ",tuple);
1178 GetColorTuple(&pixel,MagickTrue,tuple);
1179 (void) FormatLocaleFile(file,
" %s\n",tuple);
1182 if (IsHistogramImage(image,exception) != MagickFalse)
1184 (void) FormatLocaleFile(file,
" Colors: %.20g\n",(
double)
1185 GetNumberColors(image,(FILE *) NULL,exception));
1186 (void) FormatLocaleFile(file,
" Histogram:\n");
1187 (void) GetNumberColors(image,file,exception);
1191 artifact=GetImageArtifact(image,
"identify:unique-colors");
1192 if (IsStringTrue(artifact) != MagickFalse)
1193 (void) FormatLocaleFile(file,
" Colors: %.20g\n",(
double)
1194 GetNumberColors(image,(FILE *) NULL,exception));
1197 if (image->storage_class == PseudoClass)
1199 (void) FormatLocaleFile(file,
" Colormap entries: %.20g\n",(
double)
1201 (void) FormatLocaleFile(file,
" Colormap:\n");
1202 if (image->colors <= 1024)
1205 hex[MagickPathExtent],
1206 tuple[MagickPathExtent];
1214 GetPixelInfo(image,&pixel);
1216 for (i=0; i < (ssize_t) image->colors; i++)
1219 (void) CopyMagickString(tuple,
"(",MagickPathExtent);
1220 ConcatenateColorComponent(&pixel,RedPixelChannel,X11Compliance,
1222 (void) ConcatenateMagickString(tuple,
",",MagickPathExtent);
1223 ConcatenateColorComponent(&pixel,GreenPixelChannel,X11Compliance,
1225 (void) ConcatenateMagickString(tuple,
",",MagickPathExtent);
1226 ConcatenateColorComponent(&pixel,BluePixelChannel,X11Compliance,
1228 if (pixel.colorspace == CMYKColorspace)
1230 (void) ConcatenateMagickString(tuple,
",",MagickPathExtent);
1231 ConcatenateColorComponent(&pixel,BlackPixelChannel,
1232 X11Compliance,tuple);
1234 if (pixel.alpha_trait != UndefinedPixelTrait)
1236 (void) ConcatenateMagickString(tuple,
",",MagickPathExtent);
1237 ConcatenateColorComponent(&pixel,AlphaPixelChannel,
1238 X11Compliance,tuple);
1240 (void) ConcatenateMagickString(tuple,
")",MagickPathExtent);
1241 (void) QueryColorname(image,&pixel,SVGCompliance,color,
1243 GetColorTuple(&pixel,MagickTrue,hex);
1244 (void) FormatLocaleFile(file,
" %g: %s %s %s\n",(
double) i,tuple,
1250 if (image->error.mean_error_per_pixel != 0.0)
1251 (void) FormatLocaleFile(file,
" Mean error per pixel: %g\n",
1252 image->error.mean_error_per_pixel);
1253 if (image->error.normalized_mean_error != 0.0)
1254 (void) FormatLocaleFile(file,
" Normalized mean error: %g\n",
1255 image->error.normalized_mean_error);
1256 if (image->error.normalized_maximum_error != 0.0)
1257 (void) FormatLocaleFile(file,
" Normalized maximum error: %g\n",
1258 image->error.normalized_maximum_error);
1259 (void) FormatLocaleFile(file,
" Rendering intent: %s\n",
1260 CommandOptionToMnemonic(MagickIntentOptions,(ssize_t)
1261 image->rendering_intent));
1262 if (image->gamma != 0.0)
1263 (void) FormatLocaleFile(file,
" Gamma: %g\n",image->gamma);
1264 if ((image->chromaticity.red_primary.x != 0.0) ||
1265 (image->chromaticity.green_primary.x != 0.0) ||
1266 (image->chromaticity.blue_primary.x != 0.0) ||
1267 (image->chromaticity.white_point.x != 0.0))
1272 (void) FormatLocaleFile(file,
" Chromaticity:\n");
1273 (void) FormatLocaleFile(file,
" red primary: (%g,%g,%g)\n",
1274 image->chromaticity.red_primary.x,image->chromaticity.red_primary.y,
1275 image->chromaticity.red_primary.z);
1276 (void) FormatLocaleFile(file,
" green primary: (%g,%g,%g)\n",
1277 image->chromaticity.green_primary.x,image->chromaticity.green_primary.y,
1278 image->chromaticity.green_primary.z);
1279 (void) FormatLocaleFile(file,
" blue primary: (%g,%g,%g)\n",
1280 image->chromaticity.blue_primary.x,image->chromaticity.blue_primary.y,
1281 image->chromaticity.blue_primary.z);
1282 (void) FormatLocaleFile(file,
" white point: (%g,%g,%g)\n",
1283 image->chromaticity.white_point.x,image->chromaticity.white_point.y,
1284 image->chromaticity.white_point.z);
1286 if ((image->extract_info.width*image->extract_info.height) != 0)
1287 (void) FormatLocaleFile(file,
" Tile geometry: %.20gx%.20g%+.20g%+.20g\n",
1288 (
double) image->extract_info.width,(
double) image->extract_info.height,
1289 (
double) image->extract_info.x,(
double) image->extract_info.y);
1290 (void) QueryColorname(image,&image->matte_color,SVGCompliance,color,
1292 (void) FormatLocaleFile(file,
" Matte color: %s\n",color);
1293 (void) QueryColorname(image,&image->background_color,SVGCompliance,color,
1295 (void) FormatLocaleFile(file,
" Background color: %s\n",color);
1296 (void) QueryColorname(image,&image->border_color,SVGCompliance,color,
1298 (void) FormatLocaleFile(file,
" Border color: %s\n",color);
1299 (void) QueryColorname(image,&image->transparent_color,SVGCompliance,color,
1301 (void) FormatLocaleFile(file,
" Transparent color: %s\n",color);
1302 (void) FormatLocaleFile(file,
" Interlace: %s\n",CommandOptionToMnemonic(
1303 MagickInterlaceOptions,(ssize_t) image->interlace));
1304 (void) FormatLocaleFile(file,
" Intensity: %s\n",CommandOptionToMnemonic(
1305 MagickPixelIntensityOptions,(ssize_t) image->intensity));
1306 (void) FormatLocaleFile(file,
" Compose: %s\n",CommandOptionToMnemonic(
1307 MagickComposeOptions,(ssize_t) image->compose));
1308 if ((image->page.width != 0) || (image->page.height != 0) ||
1309 (image->page.x != 0) || (image->page.y != 0))
1310 (void) FormatLocaleFile(file,
" Page geometry: %.20gx%.20g%+.20g%+.20g\n",
1311 (
double) image->page.width,(
double) image->page.height,(
double)
1312 image->page.x,(
double) image->page.y);
1313 if ((image->page.x != 0) || (image->page.y != 0))
1314 (void) FormatLocaleFile(file,
" Origin geometry: %+.20g%+.20g\n",(
double)
1315 image->page.x,(
double) image->page.y);
1316 (void) FormatLocaleFile(file,
" Dispose: %s\n",CommandOptionToMnemonic(
1317 MagickDisposeOptions,(ssize_t) image->dispose));
1318 if (image->delay != 0)
1319 (void) FormatLocaleFile(file,
" Delay: %.20gx%.20g\n",(
double) image->delay,
1320 (
double) image->ticks_per_second);
1321 if (image->iterations != 1)
1322 (void) FormatLocaleFile(file,
" Iterations: %.20g\n",(
double)
1324 if (image->duration != 0)
1325 (void) FormatLocaleFile(file,
" Duration: %.20g\n",(
double)
1327 if ((image->next != (
Image *) NULL) || (image->previous != (
Image *) NULL))
1328 (void) FormatLocaleFile(file,
" Scene: %.20g of %.20g\n",(
double)
1329 image->scene,(
double) GetImageListLength(image));
1331 if (image->scene != 0)
1332 (void) FormatLocaleFile(file,
" Scene: %.20g\n",(
double) image->scene);
1333 (void) FormatLocaleFile(file,
" Compression: %s\n",CommandOptionToMnemonic(
1334 MagickCompressOptions,(ssize_t) image->compression));
1335 if (image->quality != UndefinedCompressionQuality)
1336 (void) FormatLocaleFile(file,
" Quality: %.20g\n",(
double) image->quality);
1337 (void) FormatLocaleFile(file,
" Orientation: %s\n",CommandOptionToMnemonic(
1338 MagickOrientationOptions,(ssize_t) image->orientation));
1339 if (image->montage != (
char *) NULL)
1340 (void) FormatLocaleFile(file,
" Montage: %s\n",image->montage);
1341 if (image->directory != (
char *) NULL)
1359 image_info=AcquireImageInfo();
1360 (void) CloneString(&image_info->size,
"64x64");
1361 (void) FormatLocaleFile(file,
" Directory:\n");
1362 for (d=image->directory; *d !=
'\0'; d++)
1365 while ((*q !=
'\xff') && (*q !=
'\0') &&
1366 ((
size_t) (q-d) <
sizeof(image_info->filename)))
1368 (void) CopyMagickString(image_info->filename,d,(
size_t) (q-d+1));
1370 (void) FormatLocaleFile(file,
" %s",image_info->filename);
1371 handler=SetWarningHandler((WarningHandler) NULL);
1372 tile=ReadImage(image_info,exception);
1373 (void) SetWarningHandler(handler);
1374 if (tile == (
Image *) NULL)
1376 (void) FormatLocaleFile(file,
"\n");
1379 (void) FormatLocaleFile(file,
" %.20gx%.20g %s\n",(
double)
1380 tile->magick_columns,(
double) tile->magick_rows,tile->magick);
1381 (void) SignatureImage(tile,exception);
1382 ResetImagePropertyIterator(tile);
1383 property=GetNextImageProperty(tile);
1384 while (property != (
const char *) NULL)
1386 (void) FormatLocaleFile(file,
" %s:\n",property);
1387 value=GetImageProperty(tile,property,exception);
1388 if (value != (
const char *) NULL)
1389 (void) FormatLocaleFile(file,
"%s\n",value);
1390 property=GetNextImageProperty(tile);
1392 tile=DestroyImage(tile);
1394 image_info=DestroyImageInfo(image_info);
1396 (void) FormatLocaleString(key,MagickPathExtent,
"8BIM:1999,2998:#1");
1397 value=GetImageProperty(image,key,exception);
1398 if (value != (
const char *) NULL)
1403 (void) FormatLocaleFile(file,
" Clipping path: ");
1404 if (strlen(value) > 80)
1405 (void) fputc(
'\n',file);
1406 (void) FormatLocaleFile(file,
"%s\n",value);
1408 artifact=GetImageArtifact(image,
"identify:convex-hull");
1409 if (IsStringTrue(artifact) != MagickFalse)
1427 convex_hull=GetImageConvexHull(image,&number_points,exception);
1430 points=AcquireString(
"");
1431 for (n=0; n < (ssize_t) number_points; n++)
1433 (void) FormatLocaleString(buffer,MagickPathExtent,
"%g,%g ",
1434 convex_hull[n].x,convex_hull[n].y);
1435 (void) ConcatenateString(&points,buffer);
1437 convex_hull=(
PointInfo *) RelinquishMagickMemory(convex_hull);
1438 (void) FormatLocaleFile(file,
" Convex hull: ");
1439 (void) FormatLocaleFile(file,
"%s\n",points);
1440 points=DestroyString(points);
1442 bounding_box=GetImageMinimumBoundingBox(image,&number_points,exception);
1445 points=AcquireString(
"");
1446 for (n=0; n < (ssize_t) number_points; n++)
1448 (void) FormatLocaleString(buffer,MagickPathExtent,
"%g,%g ",
1449 bounding_box[n].x,bounding_box[n].y);
1450 (void) ConcatenateString(&points,buffer);
1452 bounding_box=(
PointInfo *) RelinquishMagickMemory(bounding_box);
1453 (void) FormatLocaleFile(file,
" Minimum bounding box: ");
1454 (void) FormatLocaleFile(file,
"%s\n",points);
1455 points=DestroyString(points);
1458 ResetImageProfileIterator(image);
1459 name=GetNextImageProfile(image);
1460 if (name != (
char *) NULL)
1468 (void) FormatLocaleFile(file,
" Profiles:\n");
1469 while (name != (
char *) NULL)
1471 profile=GetImageProfile(image,name);
1474 (void) FormatLocaleFile(file,
" Profile-%s: %.20g bytes\n",name,
1475 (
double) GetStringInfoLength(profile));
1476 if (LocaleCompare(name,
"iptc") == 0)
1497 profile_length=GetStringInfoLength(profile);
1498 for (i=0; i < (ssize_t) profile_length-5; i+=(ssize_t) length)
1501 sentinel=GetStringInfoDatum(profile)[i++];
1502 if (sentinel != 0x1c)
1504 dataset=GetStringInfoDatum(profile)[i++];
1505 record=GetStringInfoDatum(profile)[i++];
1508 case 5: tag=
"Image Name";
break;
1509 case 7: tag=
"Edit Status";
break;
1510 case 10: tag=
"Priority";
break;
1511 case 15: tag=
"Category";
break;
1512 case 20: tag=
"Supplemental Category";
break;
1513 case 22: tag=
"Fixture Identifier";
break;
1514 case 25: tag=
"Keyword";
break;
1515 case 30: tag=
"Release Date";
break;
1516 case 35: tag=
"Release Time";
break;
1517 case 40: tag=
"Special Instructions";
break;
1518 case 45: tag=
"Reference Service";
break;
1519 case 47: tag=
"Reference Date";
break;
1520 case 50: tag=
"Reference Number";
break;
1521 case 55: tag=
"Created Date";
break;
1522 case 60: tag=
"Created Time";
break;
1523 case 65: tag=
"Originating Program";
break;
1524 case 70: tag=
"Program Version";
break;
1525 case 75: tag=
"Object Cycle";
break;
1526 case 80: tag=
"Byline";
break;
1527 case 85: tag=
"Byline Title";
break;
1528 case 90: tag=
"City";
break;
1529 case 92: tag=
"Sub-Location";
break;
1530 case 95: tag=
"Province State";
break;
1531 case 100: tag=
"Country Code";
break;
1532 case 101: tag=
"Country";
break;
1533 case 103: tag=
"Original Transmission Reference";
break;
1534 case 105: tag=
"Headline";
break;
1535 case 110: tag=
"Credit";
break;
1536 case 115: tag=
"Src";
break;
1537 case 116: tag=
"Copyright String";
break;
1538 case 120: tag=
"Caption";
break;
1539 case 121: tag=
"Local Caption";
break;
1540 case 122: tag=
"Caption Writer";
break;
1541 case 200: tag=
"Custom Field 1";
break;
1542 case 201: tag=
"Custom Field 2";
break;
1543 case 202: tag=
"Custom Field 3";
break;
1544 case 203: tag=
"Custom Field 4";
break;
1545 case 204: tag=
"Custom Field 5";
break;
1546 case 205: tag=
"Custom Field 6";
break;
1547 case 206: tag=
"Custom Field 7";
break;
1548 case 207: tag=
"Custom Field 8";
break;
1549 case 208: tag=
"Custom Field 9";
break;
1550 case 209: tag=
"Custom Field 10";
break;
1551 case 210: tag=
"Custom Field 11";
break;
1552 case 211: tag=
"Custom Field 12";
break;
1553 case 212: tag=
"Custom Field 13";
break;
1554 case 213: tag=
"Custom Field 14";
break;
1555 case 214: tag=
"Custom Field 15";
break;
1556 case 215: tag=
"Custom Field 16";
break;
1557 case 216: tag=
"Custom Field 17";
break;
1558 case 217: tag=
"Custom Field 18";
break;
1559 case 218: tag=
"Custom Field 19";
break;
1560 case 219: tag=
"Custom Field 20";
break;
1561 default: tag=
"unknown";
break;
1563 (void) FormatLocaleFile(file,
" %s[%.20g,%.20g]: ",tag,
1564 (
double) dataset,(
double) record);
1565 length=(size_t) (GetStringInfoDatum(profile)[i++] << 8);
1566 length|=GetStringInfoDatum(profile)[i++];
1567 length=MagickMin(length,profile_length-(
size_t) i);
1568 attribute=(
char *) NULL;
1569 if (~length >= (MagickPathExtent-1))
1570 attribute=(
char *) AcquireQuantumMemory(length+MagickPathExtent,
1571 sizeof(*attribute));
1572 if (attribute != (
char *) NULL)
1574 (void) CopyMagickString(attribute,(
char *)
1575 GetStringInfoDatum(profile)+i,length+1);
1576 attribute_list=StringToList(attribute);
1577 if (attribute_list != (
char **) NULL)
1579 for (j=0; attribute_list[j] != (
char *) NULL; j++)
1581 (void) fputs(attribute_list[j],file);
1582 (void) fputs(
"\n",file);
1583 attribute_list[j]=(
char *) RelinquishMagickMemory(
1586 attribute_list=(
char **) RelinquishMagickMemory(
1589 attribute=DestroyString(attribute);
1593 if (image->debug != MagickFalse)
1594 PrintStringInfo(file,name,profile);
1595 name=GetNextImageProfile(image);
1598 ResetImagePropertyIterator(image);
1599 property=GetNextImageProperty(image);
1600 if (property != (
const char *) NULL)
1605 (void) FormatLocaleFile(file,
" Properties:\n");
1606 while (property != (
const char *) NULL)
1608 (void) FormatLocaleFile(file,
" %s: ",property);
1609 value=GetImageProperty(image,property,exception);
1610 if (value != (
const char *) NULL)
1611 (void) FormatLocaleFile(file,
"%s\n",value);
1612 property=GetNextImageProperty(image);
1615 ResetImageArtifactIterator(image);
1616 artifact=GetNextImageArtifact(image);
1617 if (artifact != (
const char *) NULL)
1622 (void) FormatLocaleFile(file,
" Artifacts:\n");
1623 while (artifact != (
const char *) NULL)
1625 (void) FormatLocaleFile(file,
" %s: ",artifact);
1626 value=GetImageArtifact(image,artifact);
1627 if (value != (
const char *) NULL)
1628 (void) FormatLocaleFile(file,
"%s\n",value);
1629 artifact=GetNextImageArtifact(image);
1632 ResetImageRegistryIterator();
1633 registry=GetNextImageRegistry();
1634 if (registry != (
const char *) NULL)
1639 (void) FormatLocaleFile(file,
" Registry:\n");
1640 while (registry != (
const char *) NULL)
1642 (void) FormatLocaleFile(file,
" %s: ",registry);
1643 value=(
const char *) GetImageRegistry(StringRegistryType,registry,
1645 if (value != (
const char *) NULL)
1646 (void) FormatLocaleFile(file,
"%s\n",value);
1647 registry=GetNextImageRegistry();
1650 (void) FormatLocaleFile(file,
" Tainted: %s\n",CommandOptionToMnemonic(
1651 MagickBooleanOptions,(ssize_t) image->taint));
1652 (void) FormatMagickSize(image->extent,MagickTrue,
"B",MagickPathExtent,buffer);
1653 (void) FormatLocaleFile(file,
" Filesize: %s\n",buffer);
1654 (void) FormatMagickSize((MagickSizeType) image->columns*image->rows,
1655 MagickFalse,
"P",MagickPathExtent,buffer);
1656 if (strlen(buffer) > 1)
1657 buffer[strlen(buffer)-1]=
'\0';
1658 (void) FormatLocaleFile(file,
" Number pixels: %s\n",buffer);
1659 (void) FormatLocaleString(buffer,MagickPathExtent,
"%s",
1660 CommandOptionToMnemonic(MagickCacheOptions,(ssize_t)
1661 GetImagePixelCacheType(image)));
1662 (void) FormatLocaleFile(file,
" Pixel cache type: %s\n",buffer);
1663 if (elapsed_time > MagickEpsilon)
1665 (void) FormatMagickSize((MagickSizeType) ((
double) image->columns*
1666 image->rows/elapsed_time+0.5),MagickFalse,
"P",MagickPathExtent,buffer);
1667 (void) FormatLocaleFile(file,
" Pixels per second: %s\n",buffer);
1669 if (image->ttl != (time_t) 0)
1672 iso8601[
sizeof(
"9999-99-99T99:99:99Z")];
1680 (void) GetMagickUTCTime(&image->ttl,×tamp);
1681 (void) strftime(iso8601,
sizeof(iso8601),
"%Y-%m-%dT%H:%M:%SZ",×tamp);
1682 seconds=MagickMax((
int)(image->ttl-GetMagickTime()),0);
1686 (void) FormatLocaleFile(file,
" Time-to-live: %g:%02g:%02g:%02g%c %s\n",
1687 ceil((
double) (seconds/(3600*24))),
1688 ceil((
double) ((seconds % (24*3600))/3600)),
1689 ceil((
double) ((seconds % 3600)/60)),
1690 ceil((
double) ((seconds % 3600) % 60)),expired,iso8601);
1692 (void) FormatLocaleFile(file,
" User time: %0.3fu\n",user_time);
1693 (void) FormatLocaleFile(file,
" Elapsed time: %lu:%02lu.%03lu\n",
1694 (
unsigned long) (elapsed_time/60.0),(
unsigned long) ceil(fmod(elapsed_time,
1695 60.0)),(
unsigned long) (1000.0*(elapsed_time-floor(elapsed_time))));
1696 (void) FormatLocaleFile(file,
" Version: %s\n",GetMagickVersion((
size_t *)
1698 (void) fflush(file);
1699 return(ferror(file) != 0 ? MagickFalse : MagickTrue);