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 ((locations != 0) && (n >= (ssize_t) 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 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,locations,channel_statistics);
577 if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0)
578 (void) PrintChannelLocations(file,image,GreenPixelChannel,
"Green",
579 statistic_type,locations,channel_statistics);
580 if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0)
581 (void) PrintChannelLocations(file,image,BluePixelChannel,
"Blue",
582 statistic_type,locations,channel_statistics);
587 if ((GetPixelCyanTraits(image) & UpdatePixelTrait) != 0)
588 (void) PrintChannelLocations(file,image,CyanPixelChannel,
"Cyan",
589 statistic_type,locations,channel_statistics);
590 if ((GetPixelMagentaTraits(image) & UpdatePixelTrait) != 0)
591 (void) PrintChannelLocations(file,image,MagentaPixelChannel,
592 "Magenta",statistic_type,locations,channel_statistics);
593 if ((GetPixelYellowTraits(image) & UpdatePixelTrait) != 0)
594 (void) PrintChannelLocations(file,image,YellowPixelChannel,
"Yellow",
595 statistic_type,locations,channel_statistics);
596 if ((GetPixelBlackTraits(image) & UpdatePixelTrait) != 0)
597 (void) PrintChannelLocations(file,image,BlackPixelChannel,
"Black",
598 statistic_type,locations,channel_statistics);
601 case LinearGRAYColorspace:
604 if ((GetPixelGrayTraits(image) & UpdatePixelTrait) != 0)
605 (void) PrintChannelLocations(file,image,GrayPixelChannel,
"Gray",
606 statistic_type,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,locations,channel_statistics);
622 if (image->alpha_trait != UndefinedPixelTrait)
623 (void) PrintChannelLocations(file,image,AlphaPixelChannel,
"Alpha",
624 statistic_type,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);
756 (void) FormatLocaleFile(file,
" Format: %s (%s)\n",image->magick,
757 GetMagickDescription(magick_info));
758 if (GetMagickMimeType(magick_info) != (
const char *) NULL)
759 (void) FormatLocaleFile(file,
" Mime type: %s\n",GetMagickMimeType(
762 (void) FormatLocaleFile(file,
" Class: %s\n",CommandOptionToMnemonic(
763 MagickClassOptions,(ssize_t) image->storage_class));
764 (void) FormatLocaleFile(file,
" Geometry: %.20gx%.20g%+.20g%+.20g\n",(
double)
765 image->columns,(
double) image->rows,(
double) image->tile_offset.x,(
double)
766 image->tile_offset.y);
767 if ((image->magick_columns != 0) || (image->magick_rows != 0))
768 if ((image->magick_columns != image->columns) ||
769 (image->magick_rows != image->rows))
770 (void) FormatLocaleFile(file,
" Base geometry: %.20gx%.20g\n",(
double)
771 image->magick_columns,(
double) image->magick_rows);
772 if ((image->resolution.x != 0.0) && (image->resolution.y != 0.0))
774 (void) FormatLocaleFile(file,
" Resolution: %gx%g\n",image->resolution.x,
775 image->resolution.y);
776 (void) FormatLocaleFile(file,
" Print size: %gx%g\n",(
double)
777 image->columns/image->resolution.x,(
double) image->rows/
778 image->resolution.y);
780 (void) FormatLocaleFile(file,
" Units: %s\n",CommandOptionToMnemonic(
781 MagickResolutionOptions,(ssize_t) image->units));
782 (void) FormatLocaleFile(file,
" Colorspace: %s\n",CommandOptionToMnemonic(
783 MagickColorspaceOptions,(ssize_t) colorspace));
784 type=IdentifyImageType(image,exception);
785 (void) FormatLocaleFile(file,
" Type: %s\n",CommandOptionToMnemonic(
786 MagickTypeOptions,(ssize_t) type));
787 if (image->type != type)
788 (void) FormatLocaleFile(file,
" Base type: %s\n",CommandOptionToMnemonic(
789 MagickTypeOptions,(ssize_t) image->type));
790 (void) FormatLocaleFile(file,
" Endianness: %s\n",CommandOptionToMnemonic(
791 MagickEndianOptions,(ssize_t) image->endian));
794 if (image->depth == depth)
795 (void) FormatLocaleFile(file,
" Depth: %.20g-bit\n",(
double)
798 (
void) FormatLocaleFile(file,
" Depth: %.20g/%.20g-bit\n",(
double)
799 image->depth,(
double) depth);
801 (void) FormatLocaleFile(file,
" Channels: %g.%g\n",(
double)
802 image->number_channels,(
double) image->number_meta_channels);
808 (void) FormatLocaleFile(file,
" Channel depth:\n");
814 if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0)
815 (void) FormatLocaleFile(file,
" Red: %.20g-bit\n",(
double)
816 channel_statistics[RedPixelChannel].depth);
817 if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0)
818 (void) FormatLocaleFile(file,
" Green: %.20g-bit\n",(
double)
819 channel_statistics[GreenPixelChannel].depth);
820 if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0)
821 (void) FormatLocaleFile(file,
" Blue: %.20g-bit\n",(
double)
822 channel_statistics[BluePixelChannel].depth);
827 if ((GetPixelCyanTraits(image) & UpdatePixelTrait) != 0)
828 (void) FormatLocaleFile(file,
" Cyan: %.20g-bit\n",(
double)
829 channel_statistics[CyanPixelChannel].depth);
830 if ((GetPixelMagentaTraits(image) & UpdatePixelTrait) != 0)
831 (void) FormatLocaleFile(file,
" Magenta: %.20g-bit\n",(
double)
832 channel_statistics[MagentaPixelChannel].depth);
833 if ((GetPixelYellowTraits(image) & UpdatePixelTrait) != 0)
834 (void) FormatLocaleFile(file,
" Yellow: %.20g-bit\n",(
double)
835 channel_statistics[YellowPixelChannel].depth);
836 if ((GetPixelBlackTraits(image) & UpdatePixelTrait) != 0)
837 (void) FormatLocaleFile(file,
" Black: %.20g-bit\n",(
double)
838 channel_statistics[BlackPixelChannel].depth);
841 case LinearGRAYColorspace:
844 if ((GetPixelGrayTraits(image) & UpdatePixelTrait) != 0)
845 (void) FormatLocaleFile(file,
" Gray: %.20g-bit\n",(
double)
846 channel_statistics[GrayPixelChannel].depth);
851 for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
853 PixelChannel channel = GetPixelChannelChannel(image,i);
854 PixelTrait traits = GetPixelChannelTraits(image,channel);
855 if ((traits & UpdatePixelTrait) != 0)
856 (void) FormatLocaleFile(file,
" Channel %.20g: %.20g-bit\n",
857 (
double) i,(
double) channel_statistics[channel].depth);
862 if (image->alpha_trait != UndefinedPixelTrait)
863 (void) FormatLocaleFile(file,
" Alpha: %.20g-bit\n",(
double)
864 channel_statistics[AlphaPixelChannel].depth);
865 if ((image->channels & ReadMaskChannel) != 0)
866 (void) FormatLocaleFile(file,
" Read mask: %.20g-bit\n",(
double)
867 channel_statistics[ReadMaskPixelChannel].depth);
868 if ((image->channels & WriteMaskChannel) != 0)
869 (void) FormatLocaleFile(file,
" Write mask: %.20g-bit\n",(
double)
870 channel_statistics[WriteMaskPixelChannel].depth);
871 if ((image->channels & CompositeMaskChannel) != 0)
872 (void) FormatLocaleFile(file,
" Composite mask: %.20g-bit\n",
873 (
double) channel_statistics[CompositeMaskPixelChannel].depth);
874 if (image->number_meta_channels != 0)
875 for (i=0; i < (ssize_t) image->number_meta_channels; i++)
878 channel = (PixelChannel) (MetaPixelChannels+i);
880 (void) FormatLocaleFile(file,
" Meta channel[%.20g]: %.20g-bit\n",
881 (
double) i,(
double) channel_statistics[channel].depth);
884 if (image->depth <= MAGICKCORE_QUANTUM_DEPTH)
885 scale=(double) (QuantumRange/((
size_t) QuantumRange >> ((
size_t)
886 MAGICKCORE_QUANTUM_DEPTH-image->depth)));
887 (void) FormatLocaleFile(file,
" Channel statistics:\n");
888 (void) FormatLocaleFile(file,
" Pixels: %.20g\n",(
double)
889 image->columns*image->rows);
895 if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0)
896 (void) PrintChannelStatistics(file,RedPixelChannel,
"Red",1.0/
897 scale,channel_statistics);
898 if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0)
899 (void) PrintChannelStatistics(file,GreenPixelChannel,
"Green",1.0/
900 scale,channel_statistics);
901 if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0)
902 (void) PrintChannelStatistics(file,BluePixelChannel,
"Blue",1.0/
903 scale,channel_statistics);
908 if ((GetPixelCyanTraits(image) & UpdatePixelTrait) != 0)
909 (void) PrintChannelStatistics(file,CyanPixelChannel,
"Cyan",1.0/
910 scale,channel_statistics);
911 if ((GetPixelMagentaTraits(image) & UpdatePixelTrait) != 0)
912 (void) PrintChannelStatistics(file,MagentaPixelChannel,
"Magenta",
913 1.0/scale,channel_statistics);
914 if ((GetPixelYellowTraits(image) & UpdatePixelTrait) != 0)
915 (void) PrintChannelStatistics(file,YellowPixelChannel,
"Yellow",1.0/
916 scale,channel_statistics);
917 if ((GetPixelBlackTraits(image) & UpdatePixelTrait) != 0)
918 (void) PrintChannelStatistics(file,BlackPixelChannel,
"Black",1.0/
919 scale,channel_statistics);
922 case LinearGRAYColorspace:
925 if ((GetPixelGrayTraits(image) & UpdatePixelTrait) != 0)
926 (void) PrintChannelStatistics(file,GrayPixelChannel,
"Gray",1.0/
927 scale,channel_statistics);
932 for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
935 label[MagickPathExtent];
937 PixelChannel channel = GetPixelChannelChannel(image,i);
938 PixelTrait traits = GetPixelChannelTraits(image,channel);
939 if ((traits & UpdatePixelTrait) != 0)
941 (void) FormatLocaleString(label,MagickPathExtent,
942 "Channel %.20g",(
double) i);
943 (void) PrintChannelStatistics(file,channel,label,1.0/scale,
950 if (image->alpha_trait != UndefinedPixelTrait)
951 (void) PrintChannelStatistics(file,AlphaPixelChannel,
952 "Alpha",1.0/scale,channel_statistics);
953 if ((image->channels & ReadMaskChannel) != 0)
954 (void) PrintChannelStatistics(file,ReadMaskPixelChannel,
955 "Read mask",1.0/scale,channel_statistics);
956 if ((image->channels & WriteMaskChannel) != 0)
957 (void) PrintChannelStatistics(file,WriteMaskPixelChannel,
958 "Write mask",1.0/scale,channel_statistics);
959 if ((image->channels & CompositeMaskChannel) != 0)
960 (void) PrintChannelStatistics(file,WriteMaskPixelChannel,
961 "Composite mask",1.0/scale,channel_statistics);
962 if (image->number_meta_channels != 0)
963 for (i=0; i < (ssize_t) image->number_meta_channels; i++)
966 label[MagickPathExtent];
969 channel = (PixelChannel) (MetaPixelChannels+i);
971 (void) FormatLocaleString(label,MagickPathExtent,
972 "Meta channel[%.20g]",(
double) i);
973 (void) PrintChannelStatistics(file,channel,label,1.0/scale,
976 if ((colorspace != LinearGRAYColorspace) &&
977 (colorspace != GRAYColorspace))
979 (void) FormatLocaleFile(file,
" Image statistics:\n");
980 (void) PrintChannelStatistics(file,CompositePixelChannel,
"Overall",
981 1.0/scale,channel_statistics);
988 scale=(double) ((1UL << image->depth)-1);
989 (void) FormatLocaleFile(file,
" Channel moments:\n");
995 if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0)
996 (void) PrintChannelMoments(file,RedPixelChannel,
"Red",scale,
998 if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0)
999 (void) PrintChannelMoments(file,GreenPixelChannel,
"Green",scale,
1001 if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0)
1002 (void) PrintChannelMoments(file,BluePixelChannel,
"Blue",scale,
1006 case CMYKColorspace:
1008 if ((GetPixelCyanTraits(image) & UpdatePixelTrait) != 0)
1009 (void) PrintChannelMoments(file,CyanPixelChannel,
"Cyan",scale,
1011 if ((GetPixelMagentaTraits(image) & UpdatePixelTrait) != 0)
1012 (void) PrintChannelMoments(file,MagentaPixelChannel,
"Magenta",scale,
1014 if ((GetPixelYellowTraits(image) & UpdatePixelTrait) != 0)
1015 (void) PrintChannelMoments(file,YellowPixelChannel,
"Yellow",scale,
1017 if ((GetPixelBlackTraits(image) & UpdatePixelTrait) != 0)
1018 (void) PrintChannelMoments(file,BlackPixelChannel,
"Black",scale,
1022 case GRAYColorspace:
1024 if ((GetPixelGrayTraits(image) & UpdatePixelTrait) != 0)
1025 (void) PrintChannelMoments(file,GrayPixelChannel,
"Gray",scale,
1031 for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
1034 label[MagickPathExtent];
1036 PixelChannel channel = GetPixelChannelChannel(image,i);
1037 PixelTrait traits = GetPixelChannelTraits(image,channel);
1038 if ((traits & UpdatePixelTrait) != 0)
1040 (void) FormatLocaleString(label,MagickPathExtent,
1041 "Channel %.20g",(
double) i);
1042 (void) PrintChannelMoments(file,channel,label,scale,
1049 if (image->alpha_trait != UndefinedPixelTrait)
1050 (void) PrintChannelMoments(file,AlphaPixelChannel,
"Alpha",scale,
1052 if (colorspace != GRAYColorspace)
1054 (void) FormatLocaleFile(file,
" Image moments:\n");
1055 (void) PrintChannelMoments(file,CompositePixelChannel,
"Overall",scale,
1063 (void) PrintChannelPerceptualHash(image,file,channel_phash);
1069 (void) FormatLocaleFile(file,
" Channel features (horizontal, vertical, "
1070 "left and right diagonals, average):\n");
1074 case sRGBColorspace:
1076 if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0)
1077 (void) PrintChannelFeatures(file,RedPixelChannel,
"Red",
1079 if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0)
1080 (void) PrintChannelFeatures(file,GreenPixelChannel,
"Green",
1082 if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0)
1083 (void) PrintChannelFeatures(file,BluePixelChannel,
"Blue",
1087 case CMYKColorspace:
1089 if ((GetPixelCyanTraits(image) & UpdatePixelTrait) != 0)
1090 (void) PrintChannelFeatures(file,CyanPixelChannel,
"Cyan",
1092 if ((GetPixelMagentaTraits(image) & UpdatePixelTrait) != 0)
1093 (void) PrintChannelFeatures(file,MagentaPixelChannel,
"Magenta",
1095 if ((GetPixelYellowTraits(image) & UpdatePixelTrait) != 0)
1096 (void) PrintChannelFeatures(file,YellowPixelChannel,
"Yellow",
1098 if ((GetPixelBlackTraits(image) & UpdatePixelTrait) != 0)
1099 (void) PrintChannelFeatures(file,BlackPixelChannel,
"Black",
1103 case GRAYColorspace:
1105 if ((GetPixelGrayTraits(image) & UpdatePixelTrait) != 0)
1106 (void) PrintChannelFeatures(file,GrayPixelChannel,
"Gray",
1112 for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
1115 label[MagickPathExtent];
1117 PixelChannel channel = GetPixelChannelChannel(image,i);
1118 PixelTrait traits = GetPixelChannelTraits(image,channel);
1119 if ((traits & UpdatePixelTrait) != 0)
1121 (void) FormatLocaleString(label,MagickPathExtent,
1122 "Channel %.20g",(
double) i);
1123 (void) PrintChannelFeatures(file,channel,label,
1130 if (image->alpha_trait != UndefinedPixelTrait)
1131 (void) PrintChannelFeatures(file,AlphaPixelChannel,
"Alpha",
1136 if (ping == MagickFalse)
1138 if (colorspace == CMYKColorspace)
1139 (void) FormatLocaleFile(file,
" Total ink density: %.*g%%\n",
1140 GetMagickPrecision(),100.0*GetImageTotalInkDensity(image,exception)/
1141 (
double) QuantumRange);
1143 if (image->alpha_trait != UndefinedPixelTrait)
1146 found = MagickFalse;
1148 p=(
const Quantum *) NULL;
1149 for (y=0; y < (ssize_t) image->rows; y++)
1151 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
1152 if (p == (
const Quantum *) NULL)
1154 for (x=0; x < (ssize_t) image->columns; x++)
1156 if (GetPixelAlpha(image,p) == (Quantum) TransparentAlpha)
1161 p+=(ptrdiff_t) GetPixelChannels(image);
1163 if (found != MagickFalse)
1166 if (found != MagickFalse)
1169 tuple[MagickPathExtent];
1174 GetPixelInfo(image,&pixel);
1175 GetPixelInfoPixel(image,p,&pixel);
1176 (void) QueryColorname(image,&pixel,SVGCompliance,tuple,
1178 (void) FormatLocaleFile(file,
" Alpha: %s ",tuple);
1179 GetColorTuple(&pixel,MagickTrue,tuple);
1180 (void) FormatLocaleFile(file,
" %s\n",tuple);
1183 if (IsHistogramImage(image,exception) != MagickFalse)
1185 (void) FormatLocaleFile(file,
" Colors: %.20g\n",(
double)
1186 GetNumberColors(image,(FILE *) NULL,exception));
1187 (void) FormatLocaleFile(file,
" Histogram:\n");
1188 (void) GetNumberColors(image,file,exception);
1192 artifact=GetImageArtifact(image,
"identify:unique-colors");
1193 if (IsStringTrue(artifact) != MagickFalse)
1194 (void) FormatLocaleFile(file,
" Colors: %.20g\n",(
double)
1195 GetNumberColors(image,(FILE *) NULL,exception));
1198 if (image->storage_class == PseudoClass)
1200 (void) FormatLocaleFile(file,
" Colormap entries: %.20g\n",(
double)
1202 (void) FormatLocaleFile(file,
" Colormap:\n");
1203 if (image->colors <= 1024)
1206 hex[MagickPathExtent],
1207 tuple[MagickPathExtent];
1215 GetPixelInfo(image,&pixel);
1217 for (i=0; i < (ssize_t) image->colors; i++)
1220 (void) CopyMagickString(tuple,
"(",MagickPathExtent);
1221 ConcatenateColorComponent(&pixel,RedPixelChannel,X11Compliance,
1223 (void) ConcatenateMagickString(tuple,
",",MagickPathExtent);
1224 ConcatenateColorComponent(&pixel,GreenPixelChannel,X11Compliance,
1226 (void) ConcatenateMagickString(tuple,
",",MagickPathExtent);
1227 ConcatenateColorComponent(&pixel,BluePixelChannel,X11Compliance,
1229 if (pixel.colorspace == CMYKColorspace)
1231 (void) ConcatenateMagickString(tuple,
",",MagickPathExtent);
1232 ConcatenateColorComponent(&pixel,BlackPixelChannel,
1233 X11Compliance,tuple);
1235 if (pixel.alpha_trait != UndefinedPixelTrait)
1237 (void) ConcatenateMagickString(tuple,
",",MagickPathExtent);
1238 ConcatenateColorComponent(&pixel,AlphaPixelChannel,
1239 X11Compliance,tuple);
1241 (void) ConcatenateMagickString(tuple,
")",MagickPathExtent);
1242 (void) QueryColorname(image,&pixel,SVGCompliance,color,
1244 GetColorTuple(&pixel,MagickTrue,hex);
1245 (void) FormatLocaleFile(file,
" %g: %s %s %s\n",(
double) i,tuple,
1251 if (image->error.mean_error_per_pixel != 0.0)
1252 (void) FormatLocaleFile(file,
" Mean error per pixel: %g\n",
1253 image->error.mean_error_per_pixel);
1254 if (image->error.normalized_mean_error != 0.0)
1255 (void) FormatLocaleFile(file,
" Normalized mean error: %g\n",
1256 image->error.normalized_mean_error);
1257 if (image->error.normalized_maximum_error != 0.0)
1258 (void) FormatLocaleFile(file,
" Normalized maximum error: %g\n",
1259 image->error.normalized_maximum_error);
1260 (void) FormatLocaleFile(file,
" Rendering intent: %s\n",
1261 CommandOptionToMnemonic(MagickIntentOptions,(ssize_t)
1262 image->rendering_intent));
1263 if (image->gamma != 0.0)
1264 (void) FormatLocaleFile(file,
" Gamma: %g\n",image->gamma);
1265 if ((image->chromaticity.red_primary.x != 0.0) ||
1266 (image->chromaticity.green_primary.x != 0.0) ||
1267 (image->chromaticity.blue_primary.x != 0.0) ||
1268 (image->chromaticity.white_point.x != 0.0))
1273 (void) FormatLocaleFile(file,
" Chromaticity:\n");
1274 (void) FormatLocaleFile(file,
" red primary: (%g,%g,%g)\n",
1275 image->chromaticity.red_primary.x,image->chromaticity.red_primary.y,
1276 image->chromaticity.red_primary.z);
1277 (void) FormatLocaleFile(file,
" green primary: (%g,%g,%g)\n",
1278 image->chromaticity.green_primary.x,image->chromaticity.green_primary.y,
1279 image->chromaticity.green_primary.z);
1280 (void) FormatLocaleFile(file,
" blue primary: (%g,%g,%g)\n",
1281 image->chromaticity.blue_primary.x,image->chromaticity.blue_primary.y,
1282 image->chromaticity.blue_primary.z);
1283 (void) FormatLocaleFile(file,
" white point: (%g,%g,%g)\n",
1284 image->chromaticity.white_point.x,image->chromaticity.white_point.y,
1285 image->chromaticity.white_point.z);
1287 if ((image->extract_info.width*image->extract_info.height) != 0)
1288 (void) FormatLocaleFile(file,
" Tile geometry: %.20gx%.20g%+.20g%+.20g\n",
1289 (
double) image->extract_info.width,(
double) image->extract_info.height,
1290 (
double) image->extract_info.x,(
double) image->extract_info.y);
1291 (void) QueryColorname(image,&image->matte_color,SVGCompliance,color,
1293 (void) FormatLocaleFile(file,
" Matte color: %s\n",color);
1294 (void) QueryColorname(image,&image->background_color,SVGCompliance,color,
1296 (void) FormatLocaleFile(file,
" Background color: %s\n",color);
1297 (void) QueryColorname(image,&image->border_color,SVGCompliance,color,
1299 (void) FormatLocaleFile(file,
" Border color: %s\n",color);
1300 (void) QueryColorname(image,&image->transparent_color,SVGCompliance,color,
1302 (void) FormatLocaleFile(file,
" Transparent color: %s\n",color);
1303 (void) FormatLocaleFile(file,
" Interlace: %s\n",CommandOptionToMnemonic(
1304 MagickInterlaceOptions,(ssize_t) image->interlace));
1305 (void) FormatLocaleFile(file,
" Intensity: %s\n",CommandOptionToMnemonic(
1306 MagickPixelIntensityOptions,(ssize_t) image->intensity));
1307 (void) FormatLocaleFile(file,
" Compose: %s\n",CommandOptionToMnemonic(
1308 MagickComposeOptions,(ssize_t) image->compose));
1309 if ((image->page.width != 0) || (image->page.height != 0) ||
1310 (image->page.x != 0) || (image->page.y != 0))
1311 (void) FormatLocaleFile(file,
" Page geometry: %.20gx%.20g%+.20g%+.20g\n",
1312 (
double) image->page.width,(
double) image->page.height,(
double)
1313 image->page.x,(
double) image->page.y);
1314 if ((image->page.x != 0) || (image->page.y != 0))
1315 (void) FormatLocaleFile(file,
" Origin geometry: %+.20g%+.20g\n",(
double)
1316 image->page.x,(
double) image->page.y);
1317 (void) FormatLocaleFile(file,
" Dispose: %s\n",CommandOptionToMnemonic(
1318 MagickDisposeOptions,(ssize_t) image->dispose));
1319 if (image->delay != 0)
1320 (void) FormatLocaleFile(file,
" Delay: %.20gx%.20g\n",(
double) image->delay,
1321 (
double) image->ticks_per_second);
1322 if (image->iterations != 1)
1323 (void) FormatLocaleFile(file,
" Iterations: %.20g\n",(
double)
1325 if (image->duration != 0)
1326 (void) FormatLocaleFile(file,
" Duration: %.20g\n",(
double)
1328 if ((image->next != (
Image *) NULL) || (image->previous != (
Image *) NULL))
1329 (void) FormatLocaleFile(file,
" Scene: %.20g of %.20g\n",(
double)
1330 image->scene,(
double) GetImageListLength(image));
1332 if (image->scene != 0)
1333 (void) FormatLocaleFile(file,
" Scene: %.20g\n",(
double) image->scene);
1334 (void) FormatLocaleFile(file,
" Compression: %s\n",CommandOptionToMnemonic(
1335 MagickCompressOptions,(ssize_t) image->compression));
1336 if (image->quality != UndefinedCompressionQuality)
1337 (void) FormatLocaleFile(file,
" Quality: %.20g\n",(
double) image->quality);
1338 (void) FormatLocaleFile(file,
" Orientation: %s\n",CommandOptionToMnemonic(
1339 MagickOrientationOptions,(ssize_t) image->orientation));
1340 if (image->montage != (
char *) NULL)
1341 (void) FormatLocaleFile(file,
" Montage: %s\n",image->montage);
1342 if (image->directory != (
char *) NULL)
1360 image_info=AcquireImageInfo();
1361 (void) CloneString(&image_info->size,
"64x64");
1362 (void) FormatLocaleFile(file,
" Directory:\n");
1363 for (d=image->directory; *d !=
'\0'; d++)
1366 while ((*q !=
'\xff') && (*q !=
'\0') &&
1367 ((
size_t) (q-d) <
sizeof(image_info->filename)))
1369 (void) CopyMagickString(image_info->filename,d,(
size_t) (q-d+1));
1371 (void) FormatLocaleFile(file,
" %s",image_info->filename);
1372 handler=SetWarningHandler((WarningHandler) NULL);
1373 tile=ReadImage(image_info,exception);
1374 (void) SetWarningHandler(handler);
1375 if (tile == (
Image *) NULL)
1377 (void) FormatLocaleFile(file,
"\n");
1380 (void) FormatLocaleFile(file,
" %.20gx%.20g %s\n",(
double)
1381 tile->magick_columns,(
double) tile->magick_rows,tile->magick);
1382 (void) SignatureImage(tile,exception);
1383 ResetImagePropertyIterator(tile);
1384 property=GetNextImageProperty(tile);
1385 while (property != (
const char *) NULL)
1387 (void) FormatLocaleFile(file,
" %s:\n",property);
1388 value=GetImageProperty(tile,property,exception);
1389 if (value != (
const char *) NULL)
1390 (void) FormatLocaleFile(file,
"%s\n",value);
1391 property=GetNextImageProperty(tile);
1393 tile=DestroyImage(tile);
1395 image_info=DestroyImageInfo(image_info);
1397 (void) FormatLocaleString(key,MagickPathExtent,
"8BIM:1999,2998:#1");
1398 value=GetImageProperty(image,key,exception);
1399 if (value != (
const char *) NULL)
1404 (void) FormatLocaleFile(file,
" Clipping path: ");
1405 if (strlen(value) > 80)
1406 (void) fputc(
'\n',file);
1407 (void) FormatLocaleFile(file,
"%s\n",value);
1409 artifact=GetImageArtifact(image,
"identify:convex-hull");
1410 if (IsStringTrue(artifact) != MagickFalse)
1428 convex_hull=GetImageConvexHull(image,&number_points,exception);
1431 points=AcquireString(
"");
1432 for (n=0; n < (ssize_t) number_points; n++)
1434 (void) FormatLocaleString(buffer,MagickPathExtent,
"%g,%g ",
1435 convex_hull[n].x,convex_hull[n].y);
1436 (void) ConcatenateString(&points,buffer);
1438 convex_hull=(
PointInfo *) RelinquishMagickMemory(convex_hull);
1439 (void) FormatLocaleFile(file,
" Convex hull: ");
1440 (void) FormatLocaleFile(file,
"%s\n",points);
1441 points=DestroyString(points);
1443 bounding_box=GetImageMinimumBoundingBox(image,&number_points,exception);
1446 points=AcquireString(
"");
1447 for (n=0; n < (ssize_t) number_points; n++)
1449 (void) FormatLocaleString(buffer,MagickPathExtent,
"%g,%g ",
1450 bounding_box[n].x,bounding_box[n].y);
1451 (void) ConcatenateString(&points,buffer);
1453 bounding_box=(
PointInfo *) RelinquishMagickMemory(bounding_box);
1454 (void) FormatLocaleFile(file,
" Minimum bounding box: ");
1455 (void) FormatLocaleFile(file,
"%s\n",points);
1456 points=DestroyString(points);
1459 ResetImageProfileIterator(image);
1460 name=GetNextImageProfile(image);
1461 if (name != (
char *) NULL)
1469 (void) FormatLocaleFile(file,
" Profiles:\n");
1470 while (name != (
char *) NULL)
1472 profile=GetImageProfile(image,name);
1475 (void) FormatLocaleFile(file,
" Profile-%s: %.20g bytes\n",name,
1476 (
double) GetStringInfoLength(profile));
1477 if (LocaleCompare(name,
"iptc") == 0)
1498 profile_length=GetStringInfoLength(profile);
1499 for (i=0; i < (ssize_t) profile_length-5; i+=(ssize_t) length)
1502 sentinel=GetStringInfoDatum(profile)[i++];
1503 if (sentinel != 0x1c)
1505 dataset=GetStringInfoDatum(profile)[i++];
1506 record=GetStringInfoDatum(profile)[i++];
1509 case 5: tag=
"Image Name";
break;
1510 case 7: tag=
"Edit Status";
break;
1511 case 10: tag=
"Priority";
break;
1512 case 15: tag=
"Category";
break;
1513 case 20: tag=
"Supplemental Category";
break;
1514 case 22: tag=
"Fixture Identifier";
break;
1515 case 25: tag=
"Keyword";
break;
1516 case 30: tag=
"Release Date";
break;
1517 case 35: tag=
"Release Time";
break;
1518 case 40: tag=
"Special Instructions";
break;
1519 case 45: tag=
"Reference Service";
break;
1520 case 47: tag=
"Reference Date";
break;
1521 case 50: tag=
"Reference Number";
break;
1522 case 55: tag=
"Created Date";
break;
1523 case 60: tag=
"Created Time";
break;
1524 case 65: tag=
"Originating Program";
break;
1525 case 70: tag=
"Program Version";
break;
1526 case 75: tag=
"Object Cycle";
break;
1527 case 80: tag=
"Byline";
break;
1528 case 85: tag=
"Byline Title";
break;
1529 case 90: tag=
"City";
break;
1530 case 92: tag=
"Sub-Location";
break;
1531 case 95: tag=
"Province State";
break;
1532 case 100: tag=
"Country Code";
break;
1533 case 101: tag=
"Country";
break;
1534 case 103: tag=
"Original Transmission Reference";
break;
1535 case 105: tag=
"Headline";
break;
1536 case 110: tag=
"Credit";
break;
1537 case 115: tag=
"Src";
break;
1538 case 116: tag=
"Copyright String";
break;
1539 case 120: tag=
"Caption";
break;
1540 case 121: tag=
"Local Caption";
break;
1541 case 122: tag=
"Caption Writer";
break;
1542 case 200: tag=
"Custom Field 1";
break;
1543 case 201: tag=
"Custom Field 2";
break;
1544 case 202: tag=
"Custom Field 3";
break;
1545 case 203: tag=
"Custom Field 4";
break;
1546 case 204: tag=
"Custom Field 5";
break;
1547 case 205: tag=
"Custom Field 6";
break;
1548 case 206: tag=
"Custom Field 7";
break;
1549 case 207: tag=
"Custom Field 8";
break;
1550 case 208: tag=
"Custom Field 9";
break;
1551 case 209: tag=
"Custom Field 10";
break;
1552 case 210: tag=
"Custom Field 11";
break;
1553 case 211: tag=
"Custom Field 12";
break;
1554 case 212: tag=
"Custom Field 13";
break;
1555 case 213: tag=
"Custom Field 14";
break;
1556 case 214: tag=
"Custom Field 15";
break;
1557 case 215: tag=
"Custom Field 16";
break;
1558 case 216: tag=
"Custom Field 17";
break;
1559 case 217: tag=
"Custom Field 18";
break;
1560 case 218: tag=
"Custom Field 19";
break;
1561 case 219: tag=
"Custom Field 20";
break;
1562 default: tag=
"unknown";
break;
1564 (void) FormatLocaleFile(file,
" %s[%.20g,%.20g]: ",tag,
1565 (
double) dataset,(
double) record);
1566 length=(size_t) (GetStringInfoDatum(profile)[i++] << 8);
1567 length|=GetStringInfoDatum(profile)[i++];
1568 length=MagickMin(length,profile_length-(
size_t) i);
1569 attribute=(
char *) NULL;
1570 if (~length >= (MagickPathExtent-1))
1571 attribute=(
char *) AcquireQuantumMemory(length+MagickPathExtent,
1572 sizeof(*attribute));
1573 if (attribute != (
char *) NULL)
1575 (void) CopyMagickString(attribute,(
char *)
1576 GetStringInfoDatum(profile)+i,length+1);
1577 attribute_list=StringToList(attribute);
1578 if (attribute_list != (
char **) NULL)
1580 for (j=0; attribute_list[j] != (
char *) NULL; j++)
1582 (void) fputs(attribute_list[j],file);
1583 (void) fputs(
"\n",file);
1584 attribute_list[j]=(
char *) RelinquishMagickMemory(
1587 attribute_list=(
char **) RelinquishMagickMemory(
1590 attribute=DestroyString(attribute);
1594 if (image->debug != MagickFalse)
1595 PrintStringInfo(file,name,profile);
1596 name=GetNextImageProfile(image);
1599 ResetImagePropertyIterator(image);
1600 property=GetNextImageProperty(image);
1601 if (property != (
const char *) NULL)
1606 (void) FormatLocaleFile(file,
" Properties:\n");
1607 while (property != (
const char *) NULL)
1609 (void) FormatLocaleFile(file,
" %s: ",property);
1610 value=GetImageProperty(image,property,exception);
1611 if (value != (
const char *) NULL)
1612 (void) FormatLocaleFile(file,
"%s\n",value);
1613 property=GetNextImageProperty(image);
1616 ResetImageArtifactIterator(image);
1617 artifact=GetNextImageArtifact(image);
1618 if (artifact != (
const char *) NULL)
1623 (void) FormatLocaleFile(file,
" Artifacts:\n");
1624 while (artifact != (
const char *) NULL)
1626 (void) FormatLocaleFile(file,
" %s: ",artifact);
1627 value=GetImageArtifact(image,artifact);
1628 if (value != (
const char *) NULL)
1629 (void) FormatLocaleFile(file,
"%s\n",value);
1630 artifact=GetNextImageArtifact(image);
1633 ResetImageRegistryIterator();
1634 registry=GetNextImageRegistry();
1635 if (registry != (
const char *) NULL)
1640 (void) FormatLocaleFile(file,
" Registry:\n");
1641 while (registry != (
const char *) NULL)
1643 (void) FormatLocaleFile(file,
" %s: ",registry);
1644 value=(
const char *) GetImageRegistry(StringRegistryType,registry,
1646 if (value != (
const char *) NULL)
1647 (void) FormatLocaleFile(file,
"%s\n",value);
1648 registry=GetNextImageRegistry();
1651 (void) FormatLocaleFile(file,
" Tainted: %s\n",CommandOptionToMnemonic(
1652 MagickBooleanOptions,(ssize_t) image->taint));
1653 (void) FormatMagickSize(image->extent,MagickTrue,
"B",MagickPathExtent,buffer);
1654 (void) FormatLocaleFile(file,
" Filesize: %s\n",buffer);
1655 (void) FormatMagickSize((MagickSizeType) image->columns*image->rows,
1656 MagickFalse,
"P",MagickPathExtent,buffer);
1657 if (strlen(buffer) > 1)
1658 buffer[strlen(buffer)-1]=
'\0';
1659 (void) FormatLocaleFile(file,
" Number pixels: %s\n",buffer);
1660 (void) FormatLocaleString(buffer,MagickPathExtent,
"%s",
1661 CommandOptionToMnemonic(MagickCacheOptions,(ssize_t)
1662 GetImagePixelCacheType(image)));
1663 (void) FormatLocaleFile(file,
" Pixel cache type: %s\n",buffer);
1664 if (elapsed_time > MagickEpsilon)
1666 (void) FormatMagickSize((MagickSizeType) ((
double) image->columns*
1667 image->rows/elapsed_time+0.5),MagickFalse,
"P",MagickPathExtent,buffer);
1668 (void) FormatLocaleFile(file,
" Pixels per second: %s\n",buffer);
1670 if (image->ttl != (time_t) 0)
1673 iso8601[
sizeof(
"9999-99-99T99:99:99Z")];
1681 (void) GetMagickUTCTime(&image->ttl,×tamp);
1682 (void) strftime(iso8601,
sizeof(iso8601),
"%Y-%m-%dT%H:%M:%SZ",×tamp);
1683 seconds=MagickMax((
int)(image->ttl-GetMagickTime()),0);
1687 (void) FormatLocaleFile(file,
" Time-to-live: %g:%02g:%02g:%02g%c %s\n",
1688 ceil((
double) (seconds/(3600*24))),
1689 ceil((
double) ((seconds % (24*3600))/3600)),
1690 ceil((
double) ((seconds % 3600)/60)),
1691 ceil((
double) ((seconds % 3600) % 60)),expired,iso8601);
1693 (void) FormatLocaleFile(file,
" User time: %0.3fu\n",user_time);
1694 (void) FormatLocaleFile(file,
" Elapsed time: %lu:%02lu.%03lu\n",
1695 (
unsigned long) (elapsed_time/60.0),(
unsigned long) ceil(fmod(elapsed_time,
1696 60.0)),(
unsigned long) (1000.0*(elapsed_time-floor(elapsed_time))));
1697 (void) FormatLocaleFile(file,
" Version: %s\n",GetMagickVersion((
size_t *)
1699 (void) fflush(file);
1700 return(ferror(file) != 0 ? MagickFalse : MagickTrue);