blob: deda2256829b0aeb9ac14a44475fa0cf1c46d904 [file] [log] [blame]
cristy3ed852e2009-09-05 21:47:34 +00001/*
2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3% %
4% %
5% %
6% IIIII DDDD EEEEE N N TTTTT IIIII FFFFF Y Y %
7% I D D E NN N T I F Y Y %
8% I D D EEE N N N T I FFF Y %
9% I D D E N NN T I F Y %
10% IIIII DDDD EEEEE N N T IIIII F Y %
11% %
12% %
13% Identify an Image Format and Characteristics. %
14% %
15% Software Design %
16% John Cristy %
17% September 1994 %
18% %
19% %
20% Copyright 1999-2008 ImageMagick Studio LLC, a non-profit organization %
21% dedicated to making software imaging solutions freely available. %
22% %
23% You may not use this file except in compliance with the License. You may %
24% obtain a copy of the License at %
25% %
26% http://www.imagemagick.org/script/license.php %
27% %
28% Unless required by applicable law or agreed to in writing, software %
29% distributed under the License is distributed on an "AS IS" BASIS, %
30% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %
31% See the License for the specific language governing permissions and %
32% limitations under the License. %
33% %
34%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
35%
36% Identify describes the format and characteristics of one or more image
37% files. It will also report if an image is incomplete or corrupt.
38%
39%
40*/
41
42/*
43 Include declarations.
44*/
45#include "magick/studio.h"
46#include "magick/annotate.h"
47#include "magick/artifact.h"
cristy78e9c762009-10-14 19:36:18 +000048#include "magick/attribute.h"
cristy3ed852e2009-09-05 21:47:34 +000049#include "magick/blob.h"
50#include "magick/cache.h"
51#include "magick/client.h"
52#include "magick/coder.h"
53#include "magick/color.h"
54#include "magick/configure.h"
55#include "magick/constitute.h"
56#include "magick/decorate.h"
57#include "magick/delegate.h"
58#include "magick/draw.h"
59#include "magick/effect.h"
60#include "magick/exception.h"
61#include "magick/exception-private.h"
cristy549a37e2010-01-26 15:24:15 +000062#include "magick/feature.h"
cristy3ed852e2009-09-05 21:47:34 +000063#include "magick/gem.h"
64#include "magick/geometry.h"
cristyf2e11662009-10-14 01:24:43 +000065#include "magick/histogram.h"
cristy3ed852e2009-09-05 21:47:34 +000066#include "magick/identify.h"
67#include "magick/image.h"
68#include "magick/image-private.h"
69#include "magick/list.h"
70#include "magick/locale_.h"
71#include "magick/log.h"
72#include "magick/magic.h"
73#include "magick/magick.h"
74#include "magick/memory_.h"
75#include "magick/module.h"
76#include "magick/monitor.h"
77#include "magick/montage.h"
78#include "magick/option.h"
79#include "magick/pixel-private.h"
80#include "magick/prepress.h"
81#include "magick/profile.h"
82#include "magick/property.h"
83#include "magick/quantize.h"
84#include "magick/quantum.h"
85#include "magick/random_.h"
86#include "magick/registry.h"
87#include "magick/resize.h"
88#include "magick/resource_.h"
89#include "magick/signature.h"
90#include "magick/statistic.h"
91#include "magick/string_.h"
cristycd483f12010-01-26 15:30:08 +000092#include "magick/string-private.h"
cristy3ed852e2009-09-05 21:47:34 +000093#include "magick/timer.h"
94#include "magick/utility.h"
95#include "magick/version.h"
96#if defined(MAGICKCORE_LCMS_DELEGATE)
cristyd09bcf92010-03-25 03:04:45 +000097#if defined(MAGICKCORE_HAVE_LCMS_LCMS2_H)
98#include <lcms/lcms2.h>
99#elif defined(MAGICKCORE_HAVE_LCMS2_H)
100#include "lcms2.h"
101#elif defined(MAGICKCORE_HAVE_LCMS_LCMS_H)
cristy3ed852e2009-09-05 21:47:34 +0000102#include <lcms/lcms.h>
103#else
104#include "lcms.h"
105#endif
106#endif
107
108/*
cristyd09bcf92010-03-25 03:04:45 +0000109 Define declarations.
110*/
111#if defined(MAGICKCORE_LCMS_DELEGATE)
112#if defined(LCMS_VERSION) && (LCMS_VERSION < 2000)
113#define cmsUInt32Number DWORD
114#endif
115#endif
116
117/*
cristy3ed852e2009-09-05 21:47:34 +0000118%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
119% %
120% %
121% %
122% I d e n t i f y I m a g e %
123% %
124% %
125% %
126%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
127%
128% IdentifyImage() identifies an image by printing its attributes to the file.
129% Attributes include the image width, height, size, and others.
130%
131% The format of the IdentifyImage method is:
132%
133% MagickBooleanType IdentifyImage(Image *image,FILE *file,
134% const MagickBooleanType verbose)
135%
136% A description of each parameter follows:
137%
138% o image: the image.
139%
140% o file: the file, typically stdout.
141%
142% o verbose: A value other than zero prints more detailed information
143% about the image.
144%
145*/
146
cristybd822072010-01-27 00:30:00 +0000147static int PrintChannelFeatures(FILE *file,const ChannelType channel,
cristye1897792010-01-29 02:05:50 +0000148 const char *name,const ChannelFeatures *channel_features)
cristy3ed852e2009-09-05 21:47:34 +0000149{
cristye1897792010-01-29 02:05:50 +0000150#define PrintFeature(feature) \
151 GetMagickPrecision(),(feature)[0], \
152 GetMagickPrecision(),(feature)[1], \
153 GetMagickPrecision(),(feature)[2], \
cristye0acabf2010-01-30 00:52:38 +0000154 GetMagickPrecision(),(feature)[3], \
155 GetMagickPrecision(),((feature)[0]+(feature)[1]+(feature)[2]+(feature)[3])/4.0 \
cristye1897792010-01-29 02:05:50 +0000156
cristybd822072010-01-27 00:30:00 +0000157#define FeaturesFormat " %s:\n" \
cristycdf8e1b2010-01-28 01:52:33 +0000158 " Angular Second Moment:\n" \
cristye0acabf2010-01-30 00:52:38 +0000159 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \
cristycdf8e1b2010-01-28 01:52:33 +0000160 " Contrast:\n" \
cristye0acabf2010-01-30 00:52:38 +0000161 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \
cristycdf8e1b2010-01-28 01:52:33 +0000162 " Correlation:\n" \
cristye0acabf2010-01-30 00:52:38 +0000163 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \
cristye1897792010-01-29 02:05:50 +0000164 " Sum of Squares: Variance:\n" \
cristye0acabf2010-01-30 00:52:38 +0000165 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \
cristycf5e6492010-01-28 02:45:28 +0000166 " Inverse Difference Moment:\n" \
cristye0acabf2010-01-30 00:52:38 +0000167 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \
cristye1897792010-01-29 02:05:50 +0000168 " Sum Average:\n" \
cristye0acabf2010-01-30 00:52:38 +0000169 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \
cristye1897792010-01-29 02:05:50 +0000170 " Sum Variance:\n" \
cristye0acabf2010-01-30 00:52:38 +0000171 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \
cristye1897792010-01-29 02:05:50 +0000172 " Sum Entropy:\n" \
cristye0acabf2010-01-30 00:52:38 +0000173 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \
cristye1897792010-01-29 02:05:50 +0000174 " Entropy:\n" \
cristye0acabf2010-01-30 00:52:38 +0000175 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \
cristye1897792010-01-29 02:05:50 +0000176 " Difference Variance:\n" \
cristye0acabf2010-01-30 00:52:38 +0000177 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \
cristye0e19dc2010-01-29 02:13:08 +0000178 " Difference Entropy:\n" \
cristye0acabf2010-01-30 00:52:38 +0000179 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \
cristye0e19dc2010-01-29 02:13:08 +0000180 " Information Measure of Correlation 1:\n" \
cristye0acabf2010-01-30 00:52:38 +0000181 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \
cristye0e19dc2010-01-29 02:13:08 +0000182 " Information Measure of Correlation 2:\n" \
cristye0acabf2010-01-30 00:52:38 +0000183 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \
cristye0e19dc2010-01-29 02:13:08 +0000184 " Maximum Correlation Coefficient:\n" \
cristyc3ec0d42010-04-07 01:18:08 +0000185 " %.*g, %.*g, %.*g, %.*g, %.*g\n"
cristybd822072010-01-27 00:30:00 +0000186
187 int
188 status;
189
190 status=fprintf(file,FeaturesFormat,name,
cristye1897792010-01-29 02:05:50 +0000191 PrintFeature(channel_features[channel].angular_second_moment),
192 PrintFeature(channel_features[channel].contrast),
193 PrintFeature(channel_features[channel].correlation),
194 PrintFeature(channel_features[channel].variance_sum_of_squares),
195 PrintFeature(channel_features[channel].inverse_difference_moment),
196 PrintFeature(channel_features[channel].sum_average),
197 PrintFeature(channel_features[channel].sum_variance),
198 PrintFeature(channel_features[channel].sum_entropy),
199 PrintFeature(channel_features[channel].entropy),
cristye0e19dc2010-01-29 02:13:08 +0000200 PrintFeature(channel_features[channel].difference_variance),
201 PrintFeature(channel_features[channel].difference_entropy),
202 PrintFeature(channel_features[channel].measure_of_correlation_1),
203 PrintFeature(channel_features[channel].measure_of_correlation_2),
204 PrintFeature(channel_features[channel].maximum_correlation_coefficient));
cristybd822072010-01-27 00:30:00 +0000205 return(status);
206}
207
208static int PrintChannelStatistics(FILE *file,const ChannelType channel,
209 const char *name,const double scale,
210 const ChannelStatistics *channel_statistics)
211{
212#define StatisticsFormat " %s:\n min: " QuantumFormat \
cristye7f51092010-01-17 00:39:37 +0000213 " (%g)\n max: " QuantumFormat " (%g)\n" \
214 " mean: %g (%g)\n standard deviation: %g (%g)\n" \
215 " kurtosis: %g\n skewness: %g\n"
cristy3ed852e2009-09-05 21:47:34 +0000216
cristybd822072010-01-27 00:30:00 +0000217 int
218 status;
219
cristyc3ec0d42010-04-07 01:18:08 +0000220 if (channel == AlphaChannel)
221 {
222 status=fprintf(file,StatisticsFormat,name,ClampToQuantum(scale*
223 (QuantumRange-channel_statistics[channel].minima)),
224 (QuantumRange-channel_statistics[channel].minima)/(double) QuantumRange,
225 ClampToQuantum(scale*(QuantumRange-channel_statistics[channel].maxima)),
226 (QuantumRange-channel_statistics[channel].maxima)/(double) QuantumRange, scale*(QuantumRange-channel_statistics[channel].mean),
227 (QuantumRange-channel_statistics[channel].mean)/(double) QuantumRange,
228 scale*channel_statistics[channel].standard_deviation,
229 channel_statistics[channel].standard_deviation/(double) QuantumRange,
230 channel_statistics[channel].kurtosis,
231 channel_statistics[channel].skewness);
232 return(status);
233 }
cristya45da3b2010-03-31 02:06:45 +0000234 status=fprintf(file,StatisticsFormat,name,ClampToQuantum(scale*
235 channel_statistics[channel].minima),channel_statistics[channel].minima/
236 (double) QuantumRange,ClampToQuantum(scale*
237 channel_statistics[channel].maxima),channel_statistics[channel].maxima/
238 (double) QuantumRange,scale*channel_statistics[channel].mean,
239 channel_statistics[channel].mean/(double) QuantumRange,scale*
240 channel_statistics[channel].standard_deviation,
cristy75b5a252010-02-26 02:40:46 +0000241 channel_statistics[channel].standard_deviation/(double) QuantumRange,
242 channel_statistics[channel].kurtosis,channel_statistics[channel].skewness);
cristybd822072010-01-27 00:30:00 +0000243 return(status);
244}
245
246MagickExport MagickBooleanType IdentifyImage(Image *image,FILE *file,
247 const MagickBooleanType verbose)
248{
cristy3ed852e2009-09-05 21:47:34 +0000249 char
250 color[MaxTextExtent],
251 format[MaxTextExtent],
252 key[MaxTextExtent];
253
cristybd822072010-01-27 00:30:00 +0000254 ChannelFeatures
255 *channel_features;
256
257 ChannelStatistics
258 *channel_statistics;
259
cristy3ed852e2009-09-05 21:47:34 +0000260 ColorspaceType
261 colorspace;
262
263 const char
264 *artifact,
265 *name,
266 *property,
267 *registry,
268 *value;
269
270 const MagickInfo
271 *magick_info;
272
273 const PixelPacket
274 *pixels;
275
276 double
277 elapsed_time,
278 user_time;
279
280 ExceptionInfo
281 *exception;
282
283 ImageType
284 type;
285
286 long
287 y;
288
289 MagickBooleanType
290 ping;
291
292 register long
293 i,
294 x;
295
296 unsigned long
cristybd822072010-01-27 00:30:00 +0000297 distance,
cristy3ed852e2009-09-05 21:47:34 +0000298 scale;
299
300 assert(image != (Image *) NULL);
301 assert(image->signature == MagickSignature);
302 if (image->debug != MagickFalse)
303 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
304 if (file == (FILE *) NULL)
305 file=stdout;
306 *format='\0';
307 elapsed_time=GetElapsedTime(&image->timer);
308 user_time=GetUserTime(&image->timer);
309 GetTimerInfo(&image->timer);
310 if (verbose == MagickFalse)
311 {
312 /*
313 Display summary info about the image.
314 */
315 if (*image->magick_filename != '\0')
316 if (LocaleCompare(image->magick_filename,image->filename) != 0)
317 (void) fprintf(file,"%s=>",image->magick_filename);
318 if ((GetPreviousImageInList(image) == (Image *) NULL) &&
cristy81b8ce52010-02-05 01:53:17 +0000319 (GetNextImageInList(image) == (Image *) NULL) &&
320 (image->scene == 0))
cristy3ed852e2009-09-05 21:47:34 +0000321 (void) fprintf(file,"%s ",image->filename);
322 else
323 (void) fprintf(file,"%s[%lu] ",image->filename,image->scene);
324 (void) fprintf(file,"%s ",image->magick);
325 if ((image->magick_columns != 0) || (image->magick_rows != 0))
326 if ((image->magick_columns != image->columns) ||
327 (image->magick_rows != image->rows))
328 (void) fprintf(file,"%lux%lu=>",image->magick_columns,
329 image->magick_rows);
330 (void) fprintf(file,"%lux%lu ",image->columns,image->rows);
331 if ((image->page.width != 0) || (image->page.height != 0) ||
332 (image->page.x != 0) || (image->page.y != 0))
333 (void) fprintf(file,"%lux%lu%+ld%+ld ",image->page.width,
334 image->page.height,image->page.x,image->page.y);
335 (void) fprintf(file,"%lu-bit ",image->depth);
336 if (image->type != UndefinedType)
337 (void) fprintf(file,"%s ",MagickOptionToMnemonic(MagickTypeOptions,
338 (long) image->type));
339 if (image->storage_class == DirectClass)
340 {
341 (void) fprintf(file,"DirectClass ");
342 if (image->total_colors != 0)
343 {
cristyb9080c92009-12-01 20:13:26 +0000344 (void) FormatMagickSize(image->total_colors,MagickFalse,format);
cristy3ed852e2009-09-05 21:47:34 +0000345 (void) fprintf(file,"%s ",format);
346 }
347 }
348 else
349 if (image->total_colors <= image->colors)
350 (void) fprintf(file,"PseudoClass %luc ",image->colors);
351 else
352 (void) fprintf(file,"PseudoClass %lu=>%luc ",image->total_colors,
353 image->colors);
354 if (image->error.mean_error_per_pixel != 0.0)
355 (void) fprintf(file,"%ld/%f/%fdb ",(long)
356 (image->error.mean_error_per_pixel+0.5),
357 image->error.normalized_mean_error,
358 image->error.normalized_maximum_error);
359 if (GetBlobSize(image) != 0)
360 {
cristyb9080c92009-12-01 20:13:26 +0000361 (void) FormatMagickSize(GetBlobSize(image),MagickFalse,format);
cristy2ce15c92010-03-12 14:03:41 +0000362 (void) fprintf(file,"%sB ",format);
cristy3ed852e2009-09-05 21:47:34 +0000363 }
cristy3d231692009-09-29 01:05:22 +0000364 (void) fprintf(file,"%0.3fu %ld:%02ld.%03ld",user_time,(long)
365 (elapsed_time/60.0),(long) floor(fmod(elapsed_time,60.0)),
366 (long) (1000.0*(elapsed_time-floor(elapsed_time))));
cristy3ed852e2009-09-05 21:47:34 +0000367 (void) fprintf(file,"\n");
368 (void) fflush(file);
369 return(ferror(file) != 0 ? MagickFalse : MagickTrue);
370 }
371 /*
372 Display verbose info about the image.
373 */
374 exception=AcquireExceptionInfo();
375 pixels=GetVirtualPixels(image,0,0,1,1,exception);
376 exception=DestroyExceptionInfo(exception);
377 ping=pixels == (const PixelPacket *) NULL ? MagickTrue : MagickFalse;
378 type=GetImageType(image,&image->exception);
379 (void) SignatureImage(image);
380 (void) fprintf(file,"Image: %s\n",image->filename);
381 if (*image->magick_filename != '\0')
382 if (LocaleCompare(image->magick_filename,image->filename) != 0)
383 {
384 char
385 filename[MaxTextExtent];
386
387 GetPathComponent(image->magick_filename,TailPath,filename);
388 (void) fprintf(file," Base filename: %s\n",filename);
389 }
390 magick_info=GetMagickInfo(image->magick,&image->exception);
391 if ((magick_info == (const MagickInfo *) NULL) ||
392 (*GetMagickDescription(magick_info) == '\0'))
393 (void) fprintf(file," Format: %s\n",image->magick);
394 else
395 (void) fprintf(file," Format: %s (%s)\n",image->magick,
396 GetMagickDescription(magick_info));
397 (void) fprintf(file," Class: %s\n",MagickOptionToMnemonic(MagickClassOptions,
398 (long) image->storage_class));
399 (void) fprintf(file," Geometry: %lux%lu%+ld%+ld\n",image->columns,
400 image->rows,image->tile_offset.x,image->tile_offset.y);
401 if ((image->magick_columns != 0) || (image->magick_rows != 0))
402 if ((image->magick_columns != image->columns) ||
403 (image->magick_rows != image->rows))
404 (void) fprintf(file," Base geometry: %lux%lu\n",image->magick_columns,
405 image->magick_rows);
406 if ((image->x_resolution != 0.0) && (image->y_resolution != 0.0))
407 {
cristye7f51092010-01-17 00:39:37 +0000408 (void) fprintf(file," Resolution: %gx%g\n",image->x_resolution,
cristy3ed852e2009-09-05 21:47:34 +0000409 image->y_resolution);
cristye7f51092010-01-17 00:39:37 +0000410 (void) fprintf(file," Print size: %gx%g\n",(double) image->columns/
cristy3ed852e2009-09-05 21:47:34 +0000411 image->x_resolution,(double) image->rows/image->y_resolution);
412 }
413 (void) fprintf(file," Units: %s\n",MagickOptionToMnemonic(
414 MagickResolutionOptions,(long) image->units));
415 (void) fprintf(file," Type: %s\n",MagickOptionToMnemonic(MagickTypeOptions,
416 (long) type));
417 if (image->type != UndefinedType)
418 (void) fprintf(file," Base type: %s\n",MagickOptionToMnemonic(
419 MagickTypeOptions,(long) image->type));
420 (void) fprintf(file," Endianess: %s\n",MagickOptionToMnemonic(
421 MagickEndianOptions,(long) image->endian));
422 /*
423 Detail channel depth and extrema.
424 */
425 (void) fprintf(file," Colorspace: %s\n",MagickOptionToMnemonic(
426 MagickColorspaceOptions,(long) image->colorspace));
cristybd822072010-01-27 00:30:00 +0000427 channel_statistics=(ChannelStatistics *) NULL;
cristy15a88782010-01-31 23:24:49 +0000428 channel_features=(ChannelFeatures *) NULL;
429 colorspace=image->colorspace;
cristy3ed852e2009-09-05 21:47:34 +0000430 if (ping == MagickFalse)
431 {
cristy3ed852e2009-09-05 21:47:34 +0000432 unsigned long
433 depth;
434
cristy15a88782010-01-31 23:24:49 +0000435 channel_statistics=GetImageChannelStatistics(image,&image->exception);
436 artifact=GetImageArtifact(image,"identify:features");
437 if (artifact != (const char *) NULL)
438 {
439 distance=StringToUnsignedLong(artifact);
440 channel_features=GetImageChannelFeatures(image,distance,
441 &image->exception);
442 }
cristy3ed852e2009-09-05 21:47:34 +0000443 depth=GetImageDepth(image,&image->exception);
444 if (image->depth == depth)
445 (void) fprintf(file," Depth: %lu-bit\n",image->depth);
446 else
447 (void) fprintf(file," Depth: %lu/%lu-bit\n",image->depth,depth);
cristy3ed852e2009-09-05 21:47:34 +0000448 (void) fprintf(file," Channel depth:\n");
cristy3ed852e2009-09-05 21:47:34 +0000449 if (IsGrayImage(image,&image->exception) != MagickFalse)
450 colorspace=GRAYColorspace;
451 switch (colorspace)
452 {
453 case RGBColorspace:
454 default:
455 {
456 (void) fprintf(file," red: %lu-bit\n",
457 channel_statistics[RedChannel].depth);
458 (void) fprintf(file," green: %lu-bit\n",
459 channel_statistics[GreenChannel].depth);
460 (void) fprintf(file," blue: %lu-bit\n",
461 channel_statistics[BlueChannel].depth);
462 if (image->matte != MagickFalse)
463 (void) fprintf(file," alpha: %lu-bit\n",
464 channel_statistics[OpacityChannel].depth);
465 break;
466 }
467 case CMYKColorspace:
468 {
469 (void) fprintf(file," cyan: %lu-bit\n",
470 channel_statistics[CyanChannel].depth);
471 (void) fprintf(file," magenta: %lu-bit\n",
472 channel_statistics[MagentaChannel].depth);
473 (void) fprintf(file," yellow: %lu-bit\n",
474 channel_statistics[YellowChannel].depth);
475 (void) fprintf(file," black: %lu-bit\n",
476 channel_statistics[BlackChannel].depth);
477 if (image->matte != MagickFalse)
478 (void) fprintf(file," alpha: %lu-bit\n",
479 channel_statistics[OpacityChannel].depth);
480 break;
481 }
482 case GRAYColorspace:
483 {
484 (void) fprintf(file," gray: %lu-bit\n",
485 channel_statistics[GrayChannel].depth);
486 if (image->matte != MagickFalse)
487 (void) fprintf(file," alpha: %lu-bit\n",
488 channel_statistics[OpacityChannel].depth);
489 break;
490 }
491 }
492 scale=1;
493 if (image->depth <= MAGICKCORE_QUANTUM_DEPTH)
494 scale=QuantumRange/((unsigned long) QuantumRange >> ((unsigned long)
495 MAGICKCORE_QUANTUM_DEPTH-image->depth));
cristy15a88782010-01-31 23:24:49 +0000496 }
497 if (channel_statistics != (ChannelStatistics *) NULL)
498 {
cristy3ed852e2009-09-05 21:47:34 +0000499 (void) fprintf(file," Channel statistics:\n");
500 switch (colorspace)
501 {
502 case RGBColorspace:
503 default:
504 {
cristybd822072010-01-27 00:30:00 +0000505 (void) PrintChannelStatistics(file,RedChannel,"Red",1.0/scale,
506 channel_statistics);
507 (void) PrintChannelStatistics(file,GreenChannel,"Green",1.0/scale,
508 channel_statistics);
509 (void) PrintChannelStatistics(file,BlueChannel,"Blue",1.0/scale,
510 channel_statistics);
cristy3ed852e2009-09-05 21:47:34 +0000511 break;
512 }
513 case CMYKColorspace:
514 {
cristybd822072010-01-27 00:30:00 +0000515 (void) PrintChannelStatistics(file,CyanChannel,"Cyan",1.0/scale,
516 channel_statistics);
517 (void) PrintChannelStatistics(file,MagentaChannel,"Magenta",1.0/scale,
518 channel_statistics);
519 (void) PrintChannelStatistics(file,YellowChannel,"Yellow",1.0/scale,
520 channel_statistics);
521 (void) PrintChannelStatistics(file,BlackChannel,"Black",1.0/scale,
522 channel_statistics);
cristy3ed852e2009-09-05 21:47:34 +0000523 break;
524 }
525 case GRAYColorspace:
526 {
cristybd822072010-01-27 00:30:00 +0000527 (void) PrintChannelStatistics(file,GrayChannel,"Gray",1.0/scale,
528 channel_statistics);
cristy3ed852e2009-09-05 21:47:34 +0000529 break;
530 }
531 }
532 if (image->matte != MagickFalse)
cristybd822072010-01-27 00:30:00 +0000533 (void) PrintChannelStatistics(file,AlphaChannel,"Alpha",1.0/scale,
534 channel_statistics);
cristy3ed852e2009-09-05 21:47:34 +0000535 if (colorspace != GRAYColorspace)
536 {
537 (void) fprintf(file," Image statistics:\n");
cristybd822072010-01-27 00:30:00 +0000538 (void) PrintChannelStatistics(file,AllChannels,"Overall",1.0/scale,
539 channel_statistics);
cristy3ed852e2009-09-05 21:47:34 +0000540 }
541 channel_statistics=(ChannelStatistics *) RelinquishMagickMemory(
542 channel_statistics);
cristybd822072010-01-27 00:30:00 +0000543 }
cristybd822072010-01-27 00:30:00 +0000544 if (channel_features != (ChannelFeatures *) NULL)
545 {
cristye0acabf2010-01-30 00:52:38 +0000546 (void) fprintf(file," Channel features (horizontal, vertical, left and right diagonals, average):\n");
cristybd822072010-01-27 00:30:00 +0000547 switch (colorspace)
548 {
549 case RGBColorspace:
550 default:
cristy549a37e2010-01-26 15:24:15 +0000551 {
cristye1897792010-01-29 02:05:50 +0000552 (void) PrintChannelFeatures(file,RedChannel,"Red",channel_features);
553 (void) PrintChannelFeatures(file,GreenChannel,"Green",
cristybd822072010-01-27 00:30:00 +0000554 channel_features);
cristye1897792010-01-29 02:05:50 +0000555 (void) PrintChannelFeatures(file,BlueChannel,"Blue",channel_features);
cristybd822072010-01-27 00:30:00 +0000556 break;
557 }
558 case CMYKColorspace:
559 {
cristye1897792010-01-29 02:05:50 +0000560 (void) PrintChannelFeatures(file,CyanChannel,"Cyan",channel_features);
561 (void) PrintChannelFeatures(file,MagentaChannel,"Magenta",
cristybd822072010-01-27 00:30:00 +0000562 channel_features);
cristye1897792010-01-29 02:05:50 +0000563 (void) PrintChannelFeatures(file,YellowChannel,"Yellow",
cristybd822072010-01-27 00:30:00 +0000564 channel_features);
cristye1897792010-01-29 02:05:50 +0000565 (void) PrintChannelFeatures(file,BlackChannel,"Black",
cristybd822072010-01-27 00:30:00 +0000566 channel_features);
567 break;
568 }
569 case GRAYColorspace:
570 {
cristye1897792010-01-29 02:05:50 +0000571 (void) PrintChannelFeatures(file,GrayChannel,"Gray",channel_features);
cristybd822072010-01-27 00:30:00 +0000572 break;
573 }
574 }
575 if (image->matte != MagickFalse)
cristye1897792010-01-29 02:05:50 +0000576 (void) PrintChannelFeatures(file,AlphaChannel,"Alpha",channel_features);
cristybd822072010-01-27 00:30:00 +0000577 channel_features=(ChannelFeatures *) RelinquishMagickMemory(
578 channel_features);
579 }
580 if (ping == MagickFalse)
581 {
cristy3ed852e2009-09-05 21:47:34 +0000582 if (image->colorspace == CMYKColorspace)
583 (void) fprintf(file," Total ink density: %.0f%%\n",100.0*
584 GetImageTotalInkDensity(image)/(double) QuantumRange);
585 x=0;
586 if (image->matte != MagickFalse)
587 {
588 register const IndexPacket
589 *indexes;
590
591 register const PixelPacket
592 *p;
593
594 p=(PixelPacket *) NULL;
595 indexes=(IndexPacket *) NULL;
596 for (y=0; y < (long) image->rows; y++)
597 {
598 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
599 if (p == (const PixelPacket *) NULL)
600 break;
601 indexes=GetVirtualIndexQueue(image);
602 for (x=0; x < (long) image->columns; x++)
603 {
604 if (p->opacity == (Quantum) TransparentOpacity)
605 break;
606 p++;
607 }
608 if (x < (long) image->columns)
609 break;
610 }
611 if ((x < (long) image->columns) || (y < (long) image->rows))
612 {
613 char
614 tuple[MaxTextExtent];
615
616 MagickPixelPacket
617 pixel;
618
619 GetMagickPixelPacket(image,&pixel);
620 SetMagickPixelPacket(image,p,indexes+x,&pixel);
621 (void) QueryMagickColorname(image,&pixel,SVGCompliance,tuple,
622 &image->exception);
623 (void) fprintf(file," Alpha: %s ",tuple);
624 GetColorTuple(&pixel,MagickTrue,tuple);
625 (void) fprintf(file," %s\n",tuple);
626 }
627 }
cristy549a37e2010-01-26 15:24:15 +0000628 artifact=GetImageArtifact(image,"identify:unique");
629 if ((artifact != (const char *) NULL) &&
630 (IsMagickTrue(artifact) != MagickFalse))
631 (void) fprintf(file," Colors: %lu\n",GetNumberColors(image,
632 (FILE *) NULL,&image->exception));
633 if (IsHistogramImage(image,&image->exception) != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +0000634 {
cristy549a37e2010-01-26 15:24:15 +0000635 (void) fprintf(file," Histogram:\n");
636 (void) GetNumberColors(image,file,&image->exception);
cristy3ed852e2009-09-05 21:47:34 +0000637 }
638 }
639 if (image->storage_class == PseudoClass)
640 {
641 (void) fprintf(file," Colormap: %lu\n",image->colors);
642 if (image->colors <= 1024)
643 {
644 char
645 color[MaxTextExtent],
646 hex[MaxTextExtent],
647 tuple[MaxTextExtent];
648
649 MagickPixelPacket
650 pixel;
651
652 register PixelPacket
cristyc47d1f82009-11-26 01:44:43 +0000653 *restrict p;
cristy3ed852e2009-09-05 21:47:34 +0000654
655 GetMagickPixelPacket(image,&pixel);
656 p=image->colormap;
657 for (i=0; i < (long) image->colors; i++)
658 {
659 SetMagickPixelPacket(image,p,(IndexPacket *) NULL,&pixel);
660 (void) CopyMagickString(tuple,"(",MaxTextExtent);
661 ConcatenateColorComponent(&pixel,RedChannel,X11Compliance,tuple);
662 (void) ConcatenateMagickString(tuple,",",MaxTextExtent);
663 ConcatenateColorComponent(&pixel,GreenChannel,X11Compliance,tuple);
664 (void) ConcatenateMagickString(tuple,",",MaxTextExtent);
665 ConcatenateColorComponent(&pixel,BlueChannel,X11Compliance,tuple);
666 if (pixel.colorspace == CMYKColorspace)
667 {
668 (void) ConcatenateMagickString(tuple,",",MaxTextExtent);
669 ConcatenateColorComponent(&pixel,IndexChannel,X11Compliance,
670 tuple);
671 }
672 if (pixel.matte != MagickFalse)
673 {
674 (void) ConcatenateMagickString(tuple,",",MaxTextExtent);
cristyc3ec0d42010-04-07 01:18:08 +0000675 ConcatenateColorComponent(&pixel,AlphaChannel,X11Compliance,
cristy3ed852e2009-09-05 21:47:34 +0000676 tuple);
677 }
678 (void) ConcatenateMagickString(tuple,")",MaxTextExtent);
679 (void) QueryMagickColorname(image,&pixel,SVGCompliance,color,
680 &image->exception);
681 GetColorTuple(&pixel,MagickTrue,hex);
682 (void) fprintf(file," %8ld: %s %s %s\n",i,tuple,hex,color);
683 p++;
684 }
685 }
686 }
687 if (image->error.mean_error_per_pixel != 0.0)
cristye7f51092010-01-17 00:39:37 +0000688 (void) fprintf(file," Mean error per pixel: %g\n",
cristy3ed852e2009-09-05 21:47:34 +0000689 image->error.mean_error_per_pixel);
690 if (image->error.normalized_mean_error != 0.0)
cristye7f51092010-01-17 00:39:37 +0000691 (void) fprintf(file," Normalized mean error: %g\n",
cristy3ed852e2009-09-05 21:47:34 +0000692 image->error.normalized_mean_error);
693 if (image->error.normalized_maximum_error != 0.0)
cristye7f51092010-01-17 00:39:37 +0000694 (void) fprintf(file," Normalized maximum error: %g\n",
cristy3ed852e2009-09-05 21:47:34 +0000695 image->error.normalized_maximum_error);
696 (void) fprintf(file," Rendering intent: %s\n",MagickOptionToMnemonic(
697 MagickIntentOptions,(long) image->rendering_intent));
698 if (image->gamma != 0.0)
cristye7f51092010-01-17 00:39:37 +0000699 (void) fprintf(file," Gamma: %g\n",image->gamma);
cristy3ed852e2009-09-05 21:47:34 +0000700 if ((image->chromaticity.red_primary.x != 0.0) ||
701 (image->chromaticity.green_primary.x != 0.0) ||
702 (image->chromaticity.blue_primary.x != 0.0) ||
703 (image->chromaticity.white_point.x != 0.0))
704 {
705 /*
706 Display image chromaticity.
707 */
708 (void) fprintf(file," Chromaticity:\n");
cristye7f51092010-01-17 00:39:37 +0000709 (void) fprintf(file," red primary: (%g,%g)\n",
cristy3ed852e2009-09-05 21:47:34 +0000710 image->chromaticity.red_primary.x,image->chromaticity.red_primary.y);
cristye7f51092010-01-17 00:39:37 +0000711 (void) fprintf(file," green primary: (%g,%g)\n",
cristy3ed852e2009-09-05 21:47:34 +0000712 image->chromaticity.green_primary.x,
713 image->chromaticity.green_primary.y);
cristye7f51092010-01-17 00:39:37 +0000714 (void) fprintf(file," blue primary: (%g,%g)\n",
cristy3ed852e2009-09-05 21:47:34 +0000715 image->chromaticity.blue_primary.x,image->chromaticity.blue_primary.y);
cristye7f51092010-01-17 00:39:37 +0000716 (void) fprintf(file," white point: (%g,%g)\n",
cristy3ed852e2009-09-05 21:47:34 +0000717 image->chromaticity.white_point.x,image->chromaticity.white_point.y);
718 }
719 if ((image->extract_info.width*image->extract_info.height) != 0)
720 (void) fprintf(file," Tile geometry: %lux%lu%+ld%+ld\n",
721 image->extract_info.width,image->extract_info.height,
722 image->extract_info.x,image->extract_info.y);
723 (void) fprintf(file," Interlace: %s\n",MagickOptionToMnemonic(
724 MagickInterlaceOptions,(long) image->interlace));
725 (void) QueryColorname(image,&image->background_color,SVGCompliance,color,
726 &image->exception);
727 (void) fprintf(file," Background color: %s\n",color);
728 (void) QueryColorname(image,&image->border_color,SVGCompliance,color,
729 &image->exception);
730 (void) fprintf(file," Border color: %s\n",color);
731 (void) QueryColorname(image,&image->matte_color,SVGCompliance,color,
732 &image->exception);
733 (void) fprintf(file," Matte color: %s\n",color);
734 (void) QueryColorname(image,&image->transparent_color,SVGCompliance,color,
735 &image->exception);
736 (void) fprintf(file," Transparent color: %s\n",color);
cristy11a77682009-10-11 21:50:20 +0000737 (void) fprintf(file," Compose: %s\n",MagickOptionToMnemonic(
738 MagickComposeOptions,(long) image->compose));
cristy3ed852e2009-09-05 21:47:34 +0000739 if ((image->page.width != 0) || (image->page.height != 0) ||
740 (image->page.x != 0) || (image->page.y != 0))
741 (void) fprintf(file," Page geometry: %lux%lu%+ld%+ld\n",image->page.width,
742 image->page.height,image->page.x,image->page.y);
743 if ((image->page.x != 0) || (image->page.y != 0))
744 (void) fprintf(file," Origin geometry: %+ld%+ld\n",image->page.x,
745 image->page.y);
746 (void) fprintf(file," Dispose: %s\n",MagickOptionToMnemonic(
747 MagickDisposeOptions,(long) image->dispose));
748 if (image->delay != 0)
749 (void) fprintf(file," Delay: %lux%ld\n",image->delay,
750 image->ticks_per_second);
751 if (image->iterations != 1)
752 (void) fprintf(file," Iterations: %lu\n",image->iterations);
753 if ((image->next != (Image *) NULL) || (image->previous != (Image *) NULL))
754 (void) fprintf(file," Scene: %lu of %lu\n",image->scene,
755 GetImageListLength(image));
756 else
757 if (image->scene != 0)
758 (void) fprintf(file," Scene: %lu\n",image->scene);
759 (void) fprintf(file," Compression: %s\n",MagickOptionToMnemonic(
760 MagickCompressOptions,(long) image->compression));
761 if (image->quality != UndefinedCompressionQuality)
762 (void) fprintf(file," Quality: %lu\n",image->quality);
763 (void) fprintf(file," Orientation: %s\n",MagickOptionToMnemonic(
764 MagickOrientationOptions,(long) image->orientation));
765 if (image->montage != (char *) NULL)
766 (void) fprintf(file," Montage: %s\n",image->montage);
767 if (image->directory != (char *) NULL)
768 {
769 Image
770 *tile;
771
772 ImageInfo
773 *image_info;
774
775 register char
776 *p,
777 *q;
778
779 WarningHandler
780 handler;
781
782 /*
783 Display visual image directory.
784 */
785 image_info=AcquireImageInfo();
786 (void) CloneString(&image_info->size,"64x64");
787 (void) fprintf(file," Directory:\n");
788 for (p=image->directory; *p != '\0'; p++)
789 {
790 q=p;
791 while ((*q != '\n') && (*q != '\0'))
792 q++;
793 (void) CopyMagickString(image_info->filename,p,(size_t) (q-p+1));
794 p=q;
795 (void) fprintf(file," %s",image_info->filename);
796 handler=SetWarningHandler((WarningHandler) NULL);
797 tile=ReadImage(image_info,&image->exception);
798 (void) SetWarningHandler(handler);
799 if (tile == (Image *) NULL)
800 {
801 (void) fprintf(file,"\n");
802 continue;
803 }
804 (void) fprintf(file," %lux%lu %s\n",tile->magick_columns,
805 tile->magick_rows,tile->magick);
806 (void) SignatureImage(tile);
807 ResetImagePropertyIterator(tile);
808 property=GetNextImageProperty(tile);
809 while (property != (const char *) NULL)
810 {
811 (void) fprintf(file," %s:\n",property);
812 value=GetImageProperty(tile,property);
813 if (value != (const char *) NULL)
814 (void) fprintf(file,"%s\n",value);
815 property=GetNextImageProperty(tile);
816 }
817 tile=DestroyImage(tile);
818 }
819 image_info=DestroyImageInfo(image_info);
820 }
821 (void) GetImageProperty(image,"exif:*");
822 ResetImagePropertyIterator(image);
823 property=GetNextImageProperty(image);
824 if (property != (const char *) NULL)
825 {
826 /*
827 Display image properties.
828 */
829 (void) fprintf(file," Properties:\n");
830 while (property != (const char *) NULL)
831 {
832 (void) fprintf(file," %c",*property);
833 if (strlen(property) > 1)
834 (void) fprintf(file,"%s: ",property+1);
835 if (strlen(property) > 80)
836 (void) fputc('\n',file);
837 value=GetImageProperty(image,property);
838 if (value != (const char *) NULL)
839 (void) fprintf(file,"%s\n",value);
840 property=GetNextImageProperty(image);
841 }
842 }
843 (void) FormatMagickString(key,MaxTextExtent,"8BIM:1999,2998:#1");
844 value=GetImageProperty(image,key);
845 if (value != (const char *) NULL)
846 {
847 /*
848 Display clipping path.
849 */
850 (void) fprintf(file," Clipping path: ");
851 if (strlen(value) > 80)
852 (void) fputc('\n',file);
853 (void) fprintf(file,"%s\n",value);
854 }
855 ResetImageProfileIterator(image);
856 name=GetNextImageProfile(image);
857 if (name != (char *) NULL)
858 {
859 const StringInfo
860 *profile;
861
862 /*
863 Identify image profiles.
864 */
865 (void) fprintf(file," Profiles:\n");
866 while (name != (char *) NULL)
867 {
868 profile=GetImageProfile(image,name);
869 if (profile == (StringInfo *) NULL)
870 continue;
871 (void) fprintf(file," Profile-%s: %lu bytes\n",name,(unsigned long)
872 GetStringInfoLength(profile));
873#if defined(MAGICKCORE_LCMS_DELEGATE)
874 if ((LocaleCompare(name,"icc") == 0) ||
875 (LocaleCompare(name,"icm") == 0))
876 {
877 cmsHPROFILE
878 icc_profile;
879
880 icc_profile=cmsOpenProfileFromMem(GetStringInfoDatum(profile),
cristyd09bcf92010-03-25 03:04:45 +0000881 (cmsUInt32Number) GetStringInfoLength(profile));
cristy3ed852e2009-09-05 21:47:34 +0000882 if (icc_profile != (cmsHPROFILE *) NULL)
883 {
cristyd09bcf92010-03-25 03:04:45 +0000884#if defined(LCMS_VERSION) && (LCMS_VERSION < 2000)
cristy3ed852e2009-09-05 21:47:34 +0000885 const char
886 *name;
887
888 name=cmsTakeProductName(icc_profile);
889 if (name != (const char *) NULL)
890 (void) fprintf(file," %s\n",name);
cristyd09bcf92010-03-25 03:04:45 +0000891#else
892 char
893 info[MaxTextExtent];
894
895 (void) cmsGetProfileInfoASCII(icc_profile,cmsInfoDescription,
896 "en","US",info,MaxTextExtent);
897 (void) fprintf(file," Description: %s\n",info);
898 (void) cmsGetProfileInfoASCII(icc_profile,cmsInfoManufacturer,
899 "en","US",info,MaxTextExtent);
900 (void) fprintf(file," Manufacturer: %s\n",info);
901 (void) cmsGetProfileInfoASCII(icc_profile,cmsInfoModel,"en",
902 "US",info,MaxTextExtent);
903 (void) fprintf(file," Model: %s\n",info);
904 (void) cmsGetProfileInfoASCII(icc_profile,cmsInfoCopyright,
905 "en","US",info,MaxTextExtent);
906 (void) fprintf(file," Copyright: %s\n",info);
907#endif
cristy3ed852e2009-09-05 21:47:34 +0000908 (void) cmsCloseProfile(icc_profile);
909 }
910 }
911#endif
912 if (LocaleCompare(name,"iptc") == 0)
913 {
914 char
915 *attribute,
916 **attribute_list;
917
918 const char
919 *tag;
920
921 long
922 dataset,
923 record,
924 sentinel;
925
926 register long
927 j;
928
929 size_t
930 length,
931 profile_length;
932
933 profile_length=GetStringInfoLength(profile);
934 for (i=0; i < (long) profile_length; i+=(long) length)
935 {
936 length=1;
937 sentinel=GetStringInfoDatum(profile)[i++];
938 if (sentinel != 0x1c)
939 continue;
940 dataset=GetStringInfoDatum(profile)[i++];
941 record=GetStringInfoDatum(profile)[i++];
942 switch (record)
943 {
944 case 5: tag="Image Name"; break;
945 case 7: tag="Edit Status"; break;
946 case 10: tag="Priority"; break;
947 case 15: tag="Category"; break;
948 case 20: tag="Supplemental Category"; break;
949 case 22: tag="Fixture Identifier"; break;
950 case 25: tag="Keyword"; break;
951 case 30: tag="Release Date"; break;
952 case 35: tag="Release Time"; break;
953 case 40: tag="Special Instructions"; break;
954 case 45: tag="Reference Service"; break;
955 case 47: tag="Reference Date"; break;
956 case 50: tag="Reference Number"; break;
957 case 55: tag="Created Date"; break;
958 case 60: tag="Created Time"; break;
959 case 65: tag="Originating Program"; break;
960 case 70: tag="Program Version"; break;
961 case 75: tag="Object Cycle"; break;
962 case 80: tag="Byline"; break;
963 case 85: tag="Byline Title"; break;
964 case 90: tag="City"; break;
965 case 95: tag="Province State"; break;
966 case 100: tag="Country Code"; break;
967 case 101: tag="Country"; break;
968 case 103: tag="Original Transmission Reference"; break;
969 case 105: tag="Headline"; break;
970 case 110: tag="Credit"; break;
971 case 115: tag="Src"; break;
972 case 116: tag="Copyright String"; break;
973 case 120: tag="Caption"; break;
974 case 121: tag="Local Caption"; break;
975 case 122: tag="Caption Writer"; break;
976 case 200: tag="Custom Field 1"; break;
977 case 201: tag="Custom Field 2"; break;
978 case 202: tag="Custom Field 3"; break;
979 case 203: tag="Custom Field 4"; break;
980 case 204: tag="Custom Field 5"; break;
981 case 205: tag="Custom Field 6"; break;
982 case 206: tag="Custom Field 7"; break;
983 case 207: tag="Custom Field 8"; break;
984 case 208: tag="Custom Field 9"; break;
985 case 209: tag="Custom Field 10"; break;
986 case 210: tag="Custom Field 11"; break;
987 case 211: tag="Custom Field 12"; break;
988 case 212: tag="Custom Field 13"; break;
989 case 213: tag="Custom Field 14"; break;
990 case 214: tag="Custom Field 15"; break;
991 case 215: tag="Custom Field 16"; break;
992 case 216: tag="Custom Field 17"; break;
993 case 217: tag="Custom Field 18"; break;
994 case 218: tag="Custom Field 19"; break;
995 case 219: tag="Custom Field 20"; break;
996 default: tag="unknown"; break;
997 }
998 (void) fprintf(file," %s[%ld,%ld]: ",tag,dataset,record);
999 length=(size_t) (GetStringInfoDatum(profile)[i++] << 8);
1000 length|=GetStringInfoDatum(profile)[i++];
1001 attribute=(char *) NULL;
1002 if (~length >= MaxTextExtent)
1003 attribute=(char *) AcquireQuantumMemory(length+
1004 MaxTextExtent,sizeof(*attribute));
1005 if (attribute != (char *) NULL)
1006 {
1007 (void) CopyMagickString(attribute,(char *)
1008 GetStringInfoDatum(profile)+i,length+1);
1009 attribute_list=StringToList(attribute);
1010 if (attribute_list != (char **) NULL)
1011 {
1012 for (j=0; attribute_list[j] != (char *) NULL; j++)
1013 {
1014 (void) fputs(attribute_list[j],file);
1015 (void) fputs("\n",file);
1016 attribute_list[j]=(char *) RelinquishMagickMemory(
1017 attribute_list[j]);
1018 }
1019 attribute_list=(char **) RelinquishMagickMemory(
1020 attribute_list);
1021 }
1022 attribute=DestroyString(attribute);
1023 }
1024 }
1025 }
1026 if (image->debug != MagickFalse)
1027 PrintStringInfo(file,name,profile);
1028 name=GetNextImageProfile(image);
1029 }
1030 }
1031 ResetImageArtifactIterator(image);
1032 artifact=GetNextImageArtifact(image);
1033 if (artifact != (const char *) NULL)
1034 {
1035 /*
1036 Display image artifacts.
1037 */
1038 (void) fprintf(file," Artifacts:\n");
1039 while (artifact != (const char *) NULL)
1040 {
1041 (void) fprintf(file," %c",*artifact);
1042 if (strlen(artifact) > 1)
1043 (void) fprintf(file,"%s: ",artifact+1);
1044 if (strlen(artifact) > 80)
1045 (void) fputc('\n',file);
1046 value=GetImageArtifact(image,artifact);
1047 if (value != (const char *) NULL)
1048 (void) fprintf(file,"%s\n",value);
1049 artifact=GetNextImageArtifact(image);
1050 }
1051 }
1052 ResetImageRegistryIterator();
1053 registry=GetNextImageRegistry();
1054 if (registry != (const char *) NULL)
1055 {
1056 /*
1057 Display image registry.
1058 */
1059 (void) fprintf(file," Registry:\n");
1060 while (registry != (const char *) NULL)
1061 {
1062 (void) fprintf(file," %c",*registry);
1063 if (strlen(registry) > 1)
1064 (void) fprintf(file,"%s: ",registry+1);
1065 if (strlen(registry) > 80)
1066 (void) fputc('\n',file);
1067 value=(const char *) GetImageRegistry(StringRegistryType,registry,
1068 &image->exception);
1069 if (value != (const char *) NULL)
1070 (void) fprintf(file,"%s\n",value);
1071 registry=GetNextImageRegistry();
1072 }
1073 }
1074 (void) fprintf(file," Tainted: %s\n",MagickOptionToMnemonic(
1075 MagickBooleanOptions,(long) image->taint));
cristyb9080c92009-12-01 20:13:26 +00001076 (void) FormatMagickSize(GetBlobSize(image),MagickFalse,format);
cristy2ce15c92010-03-12 14:03:41 +00001077 (void) fprintf(file," Filesize: %sB\n",format);
cristyb9080c92009-12-01 20:13:26 +00001078 (void) FormatMagickSize((MagickSizeType) image->columns*image->rows,
1079 MagickFalse,format);
cristy3ed852e2009-09-05 21:47:34 +00001080 (void) fprintf(file," Number pixels: %s\n",format);
cristy3d231692009-09-29 01:05:22 +00001081 (void) FormatMagickSize((MagickSizeType) ((double) image->columns*image->rows/
cristyb9080c92009-12-01 20:13:26 +00001082 elapsed_time+0.5),MagickFalse,format);
cristy3d231692009-09-29 01:05:22 +00001083 (void) fprintf(file," Pixels per second: %s\n",format);
1084 (void) fprintf(file," User time: %0.3fu\n",user_time);
1085 (void) fprintf(file," Elapsed time: %ld:%02ld.%03ld\n",(long)
1086 (elapsed_time/60.0),(long) ceil(fmod(elapsed_time,60.0)),(long)
1087 (1000.0*(elapsed_time-floor(elapsed_time))));
1088 (void) fprintf(file," Version: %s\n",GetMagickVersion((unsigned long *)
1089 NULL));
cristy3ed852e2009-09-05 21:47:34 +00001090 (void) fflush(file);
1091 return(ferror(file) != 0 ? MagickFalse : MagickTrue);
1092}