blob: cd9e4956e9067faf316cea3ef1876ccdd09d4d26 [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)
97#if defined(MAGICKCORE_HAVE_LCMS_LCMS_H)
98#include <lcms/lcms.h>
99#else
100#include "lcms.h"
101#endif
102#endif
103
104/*
105%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
106% %
107% %
108% %
109% I d e n t i f y I m a g e %
110% %
111% %
112% %
113%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
114%
115% IdentifyImage() identifies an image by printing its attributes to the file.
116% Attributes include the image width, height, size, and others.
117%
118% The format of the IdentifyImage method is:
119%
120% MagickBooleanType IdentifyImage(Image *image,FILE *file,
121% const MagickBooleanType verbose)
122%
123% A description of each parameter follows:
124%
125% o image: the image.
126%
127% o file: the file, typically stdout.
128%
129% o verbose: A value other than zero prints more detailed information
130% about the image.
131%
132*/
133
cristybd822072010-01-27 00:30:00 +0000134static int PrintChannelFeatures(FILE *file,const ChannelType channel,
cristye1897792010-01-29 02:05:50 +0000135 const char *name,const ChannelFeatures *channel_features)
cristy3ed852e2009-09-05 21:47:34 +0000136{
cristye1897792010-01-29 02:05:50 +0000137#define PrintFeature(feature) \
138 GetMagickPrecision(),(feature)[0], \
139 GetMagickPrecision(),(feature)[1], \
140 GetMagickPrecision(),(feature)[2], \
cristye0acabf2010-01-30 00:52:38 +0000141 GetMagickPrecision(),(feature)[3], \
142 GetMagickPrecision(),((feature)[0]+(feature)[1]+(feature)[2]+(feature)[3])/4.0 \
cristye1897792010-01-29 02:05:50 +0000143
cristybd822072010-01-27 00:30:00 +0000144#define FeaturesFormat " %s:\n" \
cristycdf8e1b2010-01-28 01:52:33 +0000145 " Angular Second Moment:\n" \
cristye0acabf2010-01-30 00:52:38 +0000146 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \
cristycdf8e1b2010-01-28 01:52:33 +0000147 " Contrast:\n" \
cristye0acabf2010-01-30 00:52:38 +0000148 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \
cristycdf8e1b2010-01-28 01:52:33 +0000149 " Correlation:\n" \
cristye0acabf2010-01-30 00:52:38 +0000150 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \
cristye1897792010-01-29 02:05:50 +0000151 " Sum of Squares: Variance:\n" \
cristye0acabf2010-01-30 00:52:38 +0000152 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \
cristycf5e6492010-01-28 02:45:28 +0000153 " Inverse Difference Moment:\n" \
cristye0acabf2010-01-30 00:52:38 +0000154 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \
cristye1897792010-01-29 02:05:50 +0000155 " Sum Average:\n" \
cristye0acabf2010-01-30 00:52:38 +0000156 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \
cristye1897792010-01-29 02:05:50 +0000157 " Sum Variance:\n" \
cristye0acabf2010-01-30 00:52:38 +0000158 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \
cristye1897792010-01-29 02:05:50 +0000159 " Sum Entropy:\n" \
cristye0acabf2010-01-30 00:52:38 +0000160 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \
cristye1897792010-01-29 02:05:50 +0000161 " Entropy:\n" \
cristye0acabf2010-01-30 00:52:38 +0000162 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \
cristye1897792010-01-29 02:05:50 +0000163 " Difference Variance:\n" \
cristye0acabf2010-01-30 00:52:38 +0000164 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \
cristye0e19dc2010-01-29 02:13:08 +0000165 " Difference Entropy:\n" \
cristye0acabf2010-01-30 00:52:38 +0000166 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \
cristye0e19dc2010-01-29 02:13:08 +0000167 " Information Measure of Correlation 1:\n" \
cristye0acabf2010-01-30 00:52:38 +0000168 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \
cristye0e19dc2010-01-29 02:13:08 +0000169 " Information Measure of Correlation 2:\n" \
cristye0acabf2010-01-30 00:52:38 +0000170 " %.*g, %.*g, %.*g, %.*g, %.*g\n" \
cristye0e19dc2010-01-29 02:13:08 +0000171 " Maximum Correlation Coefficient:\n" \
cristye0acabf2010-01-30 00:52:38 +0000172 " %.*g, %.*g, %.*g, %.*g, %.*g\n"
cristybd822072010-01-27 00:30:00 +0000173
174 int
175 status;
176
177 status=fprintf(file,FeaturesFormat,name,
cristye1897792010-01-29 02:05:50 +0000178 PrintFeature(channel_features[channel].angular_second_moment),
179 PrintFeature(channel_features[channel].contrast),
180 PrintFeature(channel_features[channel].correlation),
181 PrintFeature(channel_features[channel].variance_sum_of_squares),
182 PrintFeature(channel_features[channel].inverse_difference_moment),
183 PrintFeature(channel_features[channel].sum_average),
184 PrintFeature(channel_features[channel].sum_variance),
185 PrintFeature(channel_features[channel].sum_entropy),
186 PrintFeature(channel_features[channel].entropy),
cristye0e19dc2010-01-29 02:13:08 +0000187 PrintFeature(channel_features[channel].difference_variance),
188 PrintFeature(channel_features[channel].difference_entropy),
189 PrintFeature(channel_features[channel].measure_of_correlation_1),
190 PrintFeature(channel_features[channel].measure_of_correlation_2),
191 PrintFeature(channel_features[channel].maximum_correlation_coefficient));
cristybd822072010-01-27 00:30:00 +0000192 return(status);
193}
194
195static int PrintChannelStatistics(FILE *file,const ChannelType channel,
196 const char *name,const double scale,
197 const ChannelStatistics *channel_statistics)
198{
199#define StatisticsFormat " %s:\n min: " QuantumFormat \
cristye7f51092010-01-17 00:39:37 +0000200 " (%g)\n max: " QuantumFormat " (%g)\n" \
201 " mean: %g (%g)\n standard deviation: %g (%g)\n" \
202 " kurtosis: %g\n skewness: %g\n"
cristy3ed852e2009-09-05 21:47:34 +0000203
cristybd822072010-01-27 00:30:00 +0000204 double
205 maxima,
206 mean,
207 minima;
208
209 int
210 status;
211
212 minima=channel_statistics[channel].minima;
213 maxima=channel_statistics[channel].maxima;
214 mean=channel_statistics[channel].mean;
215 if (channel == AlphaChannel)
216 {
217 minima=QuantumRange-minima;
218 maxima=QuantumRange-maxima;
219 mean=QuantumRange-mean;
220 }
cristy75b5a252010-02-26 02:40:46 +0000221 status=fprintf(file,StatisticsFormat,name,(Quantum) (scale*minima+0.5),minima/
222 (double) QuantumRange,(Quantum) (scale*maxima+0.5),maxima/(double)
223 QuantumRange,scale*mean,mean/(double) QuantumRange,scale*
224 channel_statistics[channel].standard_deviation,
225 channel_statistics[channel].standard_deviation/(double) QuantumRange,
226 channel_statistics[channel].kurtosis,channel_statistics[channel].skewness);
cristybd822072010-01-27 00:30:00 +0000227 return(status);
228}
229
230MagickExport MagickBooleanType IdentifyImage(Image *image,FILE *file,
231 const MagickBooleanType verbose)
232{
cristy3ed852e2009-09-05 21:47:34 +0000233 char
234 color[MaxTextExtent],
235 format[MaxTextExtent],
236 key[MaxTextExtent];
237
cristybd822072010-01-27 00:30:00 +0000238 ChannelFeatures
239 *channel_features;
240
241 ChannelStatistics
242 *channel_statistics;
243
cristy3ed852e2009-09-05 21:47:34 +0000244 ColorspaceType
245 colorspace;
246
247 const char
248 *artifact,
249 *name,
250 *property,
251 *registry,
252 *value;
253
254 const MagickInfo
255 *magick_info;
256
257 const PixelPacket
258 *pixels;
259
260 double
261 elapsed_time,
262 user_time;
263
264 ExceptionInfo
265 *exception;
266
267 ImageType
268 type;
269
270 long
271 y;
272
273 MagickBooleanType
274 ping;
275
276 register long
277 i,
278 x;
279
280 unsigned long
cristybd822072010-01-27 00:30:00 +0000281 distance,
cristy3ed852e2009-09-05 21:47:34 +0000282 scale;
283
284 assert(image != (Image *) NULL);
285 assert(image->signature == MagickSignature);
286 if (image->debug != MagickFalse)
287 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
288 if (file == (FILE *) NULL)
289 file=stdout;
290 *format='\0';
291 elapsed_time=GetElapsedTime(&image->timer);
292 user_time=GetUserTime(&image->timer);
293 GetTimerInfo(&image->timer);
294 if (verbose == MagickFalse)
295 {
296 /*
297 Display summary info about the image.
298 */
299 if (*image->magick_filename != '\0')
300 if (LocaleCompare(image->magick_filename,image->filename) != 0)
301 (void) fprintf(file,"%s=>",image->magick_filename);
302 if ((GetPreviousImageInList(image) == (Image *) NULL) &&
cristy81b8ce52010-02-05 01:53:17 +0000303 (GetNextImageInList(image) == (Image *) NULL) &&
304 (image->scene == 0))
cristy3ed852e2009-09-05 21:47:34 +0000305 (void) fprintf(file,"%s ",image->filename);
306 else
307 (void) fprintf(file,"%s[%lu] ",image->filename,image->scene);
308 (void) fprintf(file,"%s ",image->magick);
309 if ((image->magick_columns != 0) || (image->magick_rows != 0))
310 if ((image->magick_columns != image->columns) ||
311 (image->magick_rows != image->rows))
312 (void) fprintf(file,"%lux%lu=>",image->magick_columns,
313 image->magick_rows);
314 (void) fprintf(file,"%lux%lu ",image->columns,image->rows);
315 if ((image->page.width != 0) || (image->page.height != 0) ||
316 (image->page.x != 0) || (image->page.y != 0))
317 (void) fprintf(file,"%lux%lu%+ld%+ld ",image->page.width,
318 image->page.height,image->page.x,image->page.y);
319 (void) fprintf(file,"%lu-bit ",image->depth);
320 if (image->type != UndefinedType)
321 (void) fprintf(file,"%s ",MagickOptionToMnemonic(MagickTypeOptions,
322 (long) image->type));
323 if (image->storage_class == DirectClass)
324 {
325 (void) fprintf(file,"DirectClass ");
326 if (image->total_colors != 0)
327 {
cristyb9080c92009-12-01 20:13:26 +0000328 (void) FormatMagickSize(image->total_colors,MagickFalse,format);
cristy3ed852e2009-09-05 21:47:34 +0000329 (void) fprintf(file,"%s ",format);
330 }
331 }
332 else
333 if (image->total_colors <= image->colors)
334 (void) fprintf(file,"PseudoClass %luc ",image->colors);
335 else
336 (void) fprintf(file,"PseudoClass %lu=>%luc ",image->total_colors,
337 image->colors);
338 if (image->error.mean_error_per_pixel != 0.0)
339 (void) fprintf(file,"%ld/%f/%fdb ",(long)
340 (image->error.mean_error_per_pixel+0.5),
341 image->error.normalized_mean_error,
342 image->error.normalized_maximum_error);
343 if (GetBlobSize(image) != 0)
344 {
cristyb9080c92009-12-01 20:13:26 +0000345 (void) FormatMagickSize(GetBlobSize(image),MagickFalse,format);
cristy3ed852e2009-09-05 21:47:34 +0000346 (void) fprintf(file,"%s ",format);
347 }
cristy3d231692009-09-29 01:05:22 +0000348 (void) fprintf(file,"%0.3fu %ld:%02ld.%03ld",user_time,(long)
349 (elapsed_time/60.0),(long) floor(fmod(elapsed_time,60.0)),
350 (long) (1000.0*(elapsed_time-floor(elapsed_time))));
cristy3ed852e2009-09-05 21:47:34 +0000351 (void) fprintf(file,"\n");
352 (void) fflush(file);
353 return(ferror(file) != 0 ? MagickFalse : MagickTrue);
354 }
355 /*
356 Display verbose info about the image.
357 */
358 exception=AcquireExceptionInfo();
359 pixels=GetVirtualPixels(image,0,0,1,1,exception);
360 exception=DestroyExceptionInfo(exception);
361 ping=pixels == (const PixelPacket *) NULL ? MagickTrue : MagickFalse;
362 type=GetImageType(image,&image->exception);
363 (void) SignatureImage(image);
364 (void) fprintf(file,"Image: %s\n",image->filename);
365 if (*image->magick_filename != '\0')
366 if (LocaleCompare(image->magick_filename,image->filename) != 0)
367 {
368 char
369 filename[MaxTextExtent];
370
371 GetPathComponent(image->magick_filename,TailPath,filename);
372 (void) fprintf(file," Base filename: %s\n",filename);
373 }
374 magick_info=GetMagickInfo(image->magick,&image->exception);
375 if ((magick_info == (const MagickInfo *) NULL) ||
376 (*GetMagickDescription(magick_info) == '\0'))
377 (void) fprintf(file," Format: %s\n",image->magick);
378 else
379 (void) fprintf(file," Format: %s (%s)\n",image->magick,
380 GetMagickDescription(magick_info));
381 (void) fprintf(file," Class: %s\n",MagickOptionToMnemonic(MagickClassOptions,
382 (long) image->storage_class));
383 (void) fprintf(file," Geometry: %lux%lu%+ld%+ld\n",image->columns,
384 image->rows,image->tile_offset.x,image->tile_offset.y);
385 if ((image->magick_columns != 0) || (image->magick_rows != 0))
386 if ((image->magick_columns != image->columns) ||
387 (image->magick_rows != image->rows))
388 (void) fprintf(file," Base geometry: %lux%lu\n",image->magick_columns,
389 image->magick_rows);
390 if ((image->x_resolution != 0.0) && (image->y_resolution != 0.0))
391 {
cristye7f51092010-01-17 00:39:37 +0000392 (void) fprintf(file," Resolution: %gx%g\n",image->x_resolution,
cristy3ed852e2009-09-05 21:47:34 +0000393 image->y_resolution);
cristye7f51092010-01-17 00:39:37 +0000394 (void) fprintf(file," Print size: %gx%g\n",(double) image->columns/
cristy3ed852e2009-09-05 21:47:34 +0000395 image->x_resolution,(double) image->rows/image->y_resolution);
396 }
397 (void) fprintf(file," Units: %s\n",MagickOptionToMnemonic(
398 MagickResolutionOptions,(long) image->units));
399 (void) fprintf(file," Type: %s\n",MagickOptionToMnemonic(MagickTypeOptions,
400 (long) type));
401 if (image->type != UndefinedType)
402 (void) fprintf(file," Base type: %s\n",MagickOptionToMnemonic(
403 MagickTypeOptions,(long) image->type));
404 (void) fprintf(file," Endianess: %s\n",MagickOptionToMnemonic(
405 MagickEndianOptions,(long) image->endian));
406 /*
407 Detail channel depth and extrema.
408 */
409 (void) fprintf(file," Colorspace: %s\n",MagickOptionToMnemonic(
410 MagickColorspaceOptions,(long) image->colorspace));
cristybd822072010-01-27 00:30:00 +0000411 channel_statistics=(ChannelStatistics *) NULL;
cristy15a88782010-01-31 23:24:49 +0000412 channel_features=(ChannelFeatures *) NULL;
413 colorspace=image->colorspace;
cristy3ed852e2009-09-05 21:47:34 +0000414 if (ping == MagickFalse)
415 {
cristy3ed852e2009-09-05 21:47:34 +0000416 unsigned long
417 depth;
418
cristy15a88782010-01-31 23:24:49 +0000419 channel_statistics=GetImageChannelStatistics(image,&image->exception);
420 artifact=GetImageArtifact(image,"identify:features");
421 if (artifact != (const char *) NULL)
422 {
423 distance=StringToUnsignedLong(artifact);
424 channel_features=GetImageChannelFeatures(image,distance,
425 &image->exception);
426 }
cristy3ed852e2009-09-05 21:47:34 +0000427 depth=GetImageDepth(image,&image->exception);
428 if (image->depth == depth)
429 (void) fprintf(file," Depth: %lu-bit\n",image->depth);
430 else
431 (void) fprintf(file," Depth: %lu/%lu-bit\n",image->depth,depth);
cristy3ed852e2009-09-05 21:47:34 +0000432 (void) fprintf(file," Channel depth:\n");
cristy3ed852e2009-09-05 21:47:34 +0000433 if (IsGrayImage(image,&image->exception) != MagickFalse)
434 colorspace=GRAYColorspace;
435 switch (colorspace)
436 {
437 case RGBColorspace:
438 default:
439 {
440 (void) fprintf(file," red: %lu-bit\n",
441 channel_statistics[RedChannel].depth);
442 (void) fprintf(file," green: %lu-bit\n",
443 channel_statistics[GreenChannel].depth);
444 (void) fprintf(file," blue: %lu-bit\n",
445 channel_statistics[BlueChannel].depth);
446 if (image->matte != MagickFalse)
447 (void) fprintf(file," alpha: %lu-bit\n",
448 channel_statistics[OpacityChannel].depth);
449 break;
450 }
451 case CMYKColorspace:
452 {
453 (void) fprintf(file," cyan: %lu-bit\n",
454 channel_statistics[CyanChannel].depth);
455 (void) fprintf(file," magenta: %lu-bit\n",
456 channel_statistics[MagentaChannel].depth);
457 (void) fprintf(file," yellow: %lu-bit\n",
458 channel_statistics[YellowChannel].depth);
459 (void) fprintf(file," black: %lu-bit\n",
460 channel_statistics[BlackChannel].depth);
461 if (image->matte != MagickFalse)
462 (void) fprintf(file," alpha: %lu-bit\n",
463 channel_statistics[OpacityChannel].depth);
464 break;
465 }
466 case GRAYColorspace:
467 {
468 (void) fprintf(file," gray: %lu-bit\n",
469 channel_statistics[GrayChannel].depth);
470 if (image->matte != MagickFalse)
471 (void) fprintf(file," alpha: %lu-bit\n",
472 channel_statistics[OpacityChannel].depth);
473 break;
474 }
475 }
476 scale=1;
477 if (image->depth <= MAGICKCORE_QUANTUM_DEPTH)
478 scale=QuantumRange/((unsigned long) QuantumRange >> ((unsigned long)
479 MAGICKCORE_QUANTUM_DEPTH-image->depth));
cristy15a88782010-01-31 23:24:49 +0000480 }
481 if (channel_statistics != (ChannelStatistics *) NULL)
482 {
cristy3ed852e2009-09-05 21:47:34 +0000483 (void) fprintf(file," Channel statistics:\n");
484 switch (colorspace)
485 {
486 case RGBColorspace:
487 default:
488 {
cristybd822072010-01-27 00:30:00 +0000489 (void) PrintChannelStatistics(file,RedChannel,"Red",1.0/scale,
490 channel_statistics);
491 (void) PrintChannelStatistics(file,GreenChannel,"Green",1.0/scale,
492 channel_statistics);
493 (void) PrintChannelStatistics(file,BlueChannel,"Blue",1.0/scale,
494 channel_statistics);
cristy3ed852e2009-09-05 21:47:34 +0000495 break;
496 }
497 case CMYKColorspace:
498 {
cristybd822072010-01-27 00:30:00 +0000499 (void) PrintChannelStatistics(file,CyanChannel,"Cyan",1.0/scale,
500 channel_statistics);
501 (void) PrintChannelStatistics(file,MagentaChannel,"Magenta",1.0/scale,
502 channel_statistics);
503 (void) PrintChannelStatistics(file,YellowChannel,"Yellow",1.0/scale,
504 channel_statistics);
505 (void) PrintChannelStatistics(file,BlackChannel,"Black",1.0/scale,
506 channel_statistics);
cristy3ed852e2009-09-05 21:47:34 +0000507 break;
508 }
509 case GRAYColorspace:
510 {
cristybd822072010-01-27 00:30:00 +0000511 (void) PrintChannelStatistics(file,GrayChannel,"Gray",1.0/scale,
512 channel_statistics);
cristy3ed852e2009-09-05 21:47:34 +0000513 break;
514 }
515 }
516 if (image->matte != MagickFalse)
cristybd822072010-01-27 00:30:00 +0000517 (void) PrintChannelStatistics(file,AlphaChannel,"Alpha",1.0/scale,
518 channel_statistics);
cristy3ed852e2009-09-05 21:47:34 +0000519 if (colorspace != GRAYColorspace)
520 {
521 (void) fprintf(file," Image statistics:\n");
cristybd822072010-01-27 00:30:00 +0000522 (void) PrintChannelStatistics(file,AllChannels,"Overall",1.0/scale,
523 channel_statistics);
cristy3ed852e2009-09-05 21:47:34 +0000524 }
525 channel_statistics=(ChannelStatistics *) RelinquishMagickMemory(
526 channel_statistics);
cristybd822072010-01-27 00:30:00 +0000527 }
cristybd822072010-01-27 00:30:00 +0000528 if (channel_features != (ChannelFeatures *) NULL)
529 {
cristye0acabf2010-01-30 00:52:38 +0000530 (void) fprintf(file," Channel features (horizontal, vertical, left and right diagonals, average):\n");
cristybd822072010-01-27 00:30:00 +0000531 switch (colorspace)
532 {
533 case RGBColorspace:
534 default:
cristy549a37e2010-01-26 15:24:15 +0000535 {
cristye1897792010-01-29 02:05:50 +0000536 (void) PrintChannelFeatures(file,RedChannel,"Red",channel_features);
537 (void) PrintChannelFeatures(file,GreenChannel,"Green",
cristybd822072010-01-27 00:30:00 +0000538 channel_features);
cristye1897792010-01-29 02:05:50 +0000539 (void) PrintChannelFeatures(file,BlueChannel,"Blue",channel_features);
cristybd822072010-01-27 00:30:00 +0000540 break;
541 }
542 case CMYKColorspace:
543 {
cristye1897792010-01-29 02:05:50 +0000544 (void) PrintChannelFeatures(file,CyanChannel,"Cyan",channel_features);
545 (void) PrintChannelFeatures(file,MagentaChannel,"Magenta",
cristybd822072010-01-27 00:30:00 +0000546 channel_features);
cristye1897792010-01-29 02:05:50 +0000547 (void) PrintChannelFeatures(file,YellowChannel,"Yellow",
cristybd822072010-01-27 00:30:00 +0000548 channel_features);
cristye1897792010-01-29 02:05:50 +0000549 (void) PrintChannelFeatures(file,BlackChannel,"Black",
cristybd822072010-01-27 00:30:00 +0000550 channel_features);
551 break;
552 }
553 case GRAYColorspace:
554 {
cristye1897792010-01-29 02:05:50 +0000555 (void) PrintChannelFeatures(file,GrayChannel,"Gray",channel_features);
cristybd822072010-01-27 00:30:00 +0000556 break;
557 }
558 }
559 if (image->matte != MagickFalse)
cristye1897792010-01-29 02:05:50 +0000560 (void) PrintChannelFeatures(file,AlphaChannel,"Alpha",channel_features);
cristybd822072010-01-27 00:30:00 +0000561 channel_features=(ChannelFeatures *) RelinquishMagickMemory(
562 channel_features);
563 }
564 if (ping == MagickFalse)
565 {
cristy3ed852e2009-09-05 21:47:34 +0000566 if (image->colorspace == CMYKColorspace)
567 (void) fprintf(file," Total ink density: %.0f%%\n",100.0*
568 GetImageTotalInkDensity(image)/(double) QuantumRange);
569 x=0;
570 if (image->matte != MagickFalse)
571 {
572 register const IndexPacket
573 *indexes;
574
575 register const PixelPacket
576 *p;
577
578 p=(PixelPacket *) NULL;
579 indexes=(IndexPacket *) NULL;
580 for (y=0; y < (long) image->rows; y++)
581 {
582 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
583 if (p == (const PixelPacket *) NULL)
584 break;
585 indexes=GetVirtualIndexQueue(image);
586 for (x=0; x < (long) image->columns; x++)
587 {
588 if (p->opacity == (Quantum) TransparentOpacity)
589 break;
590 p++;
591 }
592 if (x < (long) image->columns)
593 break;
594 }
595 if ((x < (long) image->columns) || (y < (long) image->rows))
596 {
597 char
598 tuple[MaxTextExtent];
599
600 MagickPixelPacket
601 pixel;
602
603 GetMagickPixelPacket(image,&pixel);
604 SetMagickPixelPacket(image,p,indexes+x,&pixel);
605 (void) QueryMagickColorname(image,&pixel,SVGCompliance,tuple,
606 &image->exception);
607 (void) fprintf(file," Alpha: %s ",tuple);
608 GetColorTuple(&pixel,MagickTrue,tuple);
609 (void) fprintf(file," %s\n",tuple);
610 }
611 }
cristy549a37e2010-01-26 15:24:15 +0000612 artifact=GetImageArtifact(image,"identify:unique");
613 if ((artifact != (const char *) NULL) &&
614 (IsMagickTrue(artifact) != MagickFalse))
615 (void) fprintf(file," Colors: %lu\n",GetNumberColors(image,
616 (FILE *) NULL,&image->exception));
617 if (IsHistogramImage(image,&image->exception) != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +0000618 {
cristy549a37e2010-01-26 15:24:15 +0000619 (void) fprintf(file," Histogram:\n");
620 (void) GetNumberColors(image,file,&image->exception);
cristy3ed852e2009-09-05 21:47:34 +0000621 }
622 }
623 if (image->storage_class == PseudoClass)
624 {
625 (void) fprintf(file," Colormap: %lu\n",image->colors);
626 if (image->colors <= 1024)
627 {
628 char
629 color[MaxTextExtent],
630 hex[MaxTextExtent],
631 tuple[MaxTextExtent];
632
633 MagickPixelPacket
634 pixel;
635
636 register PixelPacket
cristyc47d1f82009-11-26 01:44:43 +0000637 *restrict p;
cristy3ed852e2009-09-05 21:47:34 +0000638
639 GetMagickPixelPacket(image,&pixel);
640 p=image->colormap;
641 for (i=0; i < (long) image->colors; i++)
642 {
643 SetMagickPixelPacket(image,p,(IndexPacket *) NULL,&pixel);
644 (void) CopyMagickString(tuple,"(",MaxTextExtent);
645 ConcatenateColorComponent(&pixel,RedChannel,X11Compliance,tuple);
646 (void) ConcatenateMagickString(tuple,",",MaxTextExtent);
647 ConcatenateColorComponent(&pixel,GreenChannel,X11Compliance,tuple);
648 (void) ConcatenateMagickString(tuple,",",MaxTextExtent);
649 ConcatenateColorComponent(&pixel,BlueChannel,X11Compliance,tuple);
650 if (pixel.colorspace == CMYKColorspace)
651 {
652 (void) ConcatenateMagickString(tuple,",",MaxTextExtent);
653 ConcatenateColorComponent(&pixel,IndexChannel,X11Compliance,
654 tuple);
655 }
656 if (pixel.matte != MagickFalse)
657 {
658 (void) ConcatenateMagickString(tuple,",",MaxTextExtent);
659 ConcatenateColorComponent(&pixel,OpacityChannel,X11Compliance,
660 tuple);
661 }
662 (void) ConcatenateMagickString(tuple,")",MaxTextExtent);
663 (void) QueryMagickColorname(image,&pixel,SVGCompliance,color,
664 &image->exception);
665 GetColorTuple(&pixel,MagickTrue,hex);
666 (void) fprintf(file," %8ld: %s %s %s\n",i,tuple,hex,color);
667 p++;
668 }
669 }
670 }
671 if (image->error.mean_error_per_pixel != 0.0)
cristye7f51092010-01-17 00:39:37 +0000672 (void) fprintf(file," Mean error per pixel: %g\n",
cristy3ed852e2009-09-05 21:47:34 +0000673 image->error.mean_error_per_pixel);
674 if (image->error.normalized_mean_error != 0.0)
cristye7f51092010-01-17 00:39:37 +0000675 (void) fprintf(file," Normalized mean error: %g\n",
cristy3ed852e2009-09-05 21:47:34 +0000676 image->error.normalized_mean_error);
677 if (image->error.normalized_maximum_error != 0.0)
cristye7f51092010-01-17 00:39:37 +0000678 (void) fprintf(file," Normalized maximum error: %g\n",
cristy3ed852e2009-09-05 21:47:34 +0000679 image->error.normalized_maximum_error);
680 (void) fprintf(file," Rendering intent: %s\n",MagickOptionToMnemonic(
681 MagickIntentOptions,(long) image->rendering_intent));
682 if (image->gamma != 0.0)
cristye7f51092010-01-17 00:39:37 +0000683 (void) fprintf(file," Gamma: %g\n",image->gamma);
cristy3ed852e2009-09-05 21:47:34 +0000684 if ((image->chromaticity.red_primary.x != 0.0) ||
685 (image->chromaticity.green_primary.x != 0.0) ||
686 (image->chromaticity.blue_primary.x != 0.0) ||
687 (image->chromaticity.white_point.x != 0.0))
688 {
689 /*
690 Display image chromaticity.
691 */
692 (void) fprintf(file," Chromaticity:\n");
cristye7f51092010-01-17 00:39:37 +0000693 (void) fprintf(file," red primary: (%g,%g)\n",
cristy3ed852e2009-09-05 21:47:34 +0000694 image->chromaticity.red_primary.x,image->chromaticity.red_primary.y);
cristye7f51092010-01-17 00:39:37 +0000695 (void) fprintf(file," green primary: (%g,%g)\n",
cristy3ed852e2009-09-05 21:47:34 +0000696 image->chromaticity.green_primary.x,
697 image->chromaticity.green_primary.y);
cristye7f51092010-01-17 00:39:37 +0000698 (void) fprintf(file," blue primary: (%g,%g)\n",
cristy3ed852e2009-09-05 21:47:34 +0000699 image->chromaticity.blue_primary.x,image->chromaticity.blue_primary.y);
cristye7f51092010-01-17 00:39:37 +0000700 (void) fprintf(file," white point: (%g,%g)\n",
cristy3ed852e2009-09-05 21:47:34 +0000701 image->chromaticity.white_point.x,image->chromaticity.white_point.y);
702 }
703 if ((image->extract_info.width*image->extract_info.height) != 0)
704 (void) fprintf(file," Tile geometry: %lux%lu%+ld%+ld\n",
705 image->extract_info.width,image->extract_info.height,
706 image->extract_info.x,image->extract_info.y);
707 (void) fprintf(file," Interlace: %s\n",MagickOptionToMnemonic(
708 MagickInterlaceOptions,(long) image->interlace));
709 (void) QueryColorname(image,&image->background_color,SVGCompliance,color,
710 &image->exception);
711 (void) fprintf(file," Background color: %s\n",color);
712 (void) QueryColorname(image,&image->border_color,SVGCompliance,color,
713 &image->exception);
714 (void) fprintf(file," Border color: %s\n",color);
715 (void) QueryColorname(image,&image->matte_color,SVGCompliance,color,
716 &image->exception);
717 (void) fprintf(file," Matte color: %s\n",color);
718 (void) QueryColorname(image,&image->transparent_color,SVGCompliance,color,
719 &image->exception);
720 (void) fprintf(file," Transparent color: %s\n",color);
cristy11a77682009-10-11 21:50:20 +0000721 (void) fprintf(file," Compose: %s\n",MagickOptionToMnemonic(
722 MagickComposeOptions,(long) image->compose));
cristy3ed852e2009-09-05 21:47:34 +0000723 if ((image->page.width != 0) || (image->page.height != 0) ||
724 (image->page.x != 0) || (image->page.y != 0))
725 (void) fprintf(file," Page geometry: %lux%lu%+ld%+ld\n",image->page.width,
726 image->page.height,image->page.x,image->page.y);
727 if ((image->page.x != 0) || (image->page.y != 0))
728 (void) fprintf(file," Origin geometry: %+ld%+ld\n",image->page.x,
729 image->page.y);
730 (void) fprintf(file," Dispose: %s\n",MagickOptionToMnemonic(
731 MagickDisposeOptions,(long) image->dispose));
732 if (image->delay != 0)
733 (void) fprintf(file," Delay: %lux%ld\n",image->delay,
734 image->ticks_per_second);
735 if (image->iterations != 1)
736 (void) fprintf(file," Iterations: %lu\n",image->iterations);
737 if ((image->next != (Image *) NULL) || (image->previous != (Image *) NULL))
738 (void) fprintf(file," Scene: %lu of %lu\n",image->scene,
739 GetImageListLength(image));
740 else
741 if (image->scene != 0)
742 (void) fprintf(file," Scene: %lu\n",image->scene);
743 (void) fprintf(file," Compression: %s\n",MagickOptionToMnemonic(
744 MagickCompressOptions,(long) image->compression));
745 if (image->quality != UndefinedCompressionQuality)
746 (void) fprintf(file," Quality: %lu\n",image->quality);
747 (void) fprintf(file," Orientation: %s\n",MagickOptionToMnemonic(
748 MagickOrientationOptions,(long) image->orientation));
749 if (image->montage != (char *) NULL)
750 (void) fprintf(file," Montage: %s\n",image->montage);
751 if (image->directory != (char *) NULL)
752 {
753 Image
754 *tile;
755
756 ImageInfo
757 *image_info;
758
759 register char
760 *p,
761 *q;
762
763 WarningHandler
764 handler;
765
766 /*
767 Display visual image directory.
768 */
769 image_info=AcquireImageInfo();
770 (void) CloneString(&image_info->size,"64x64");
771 (void) fprintf(file," Directory:\n");
772 for (p=image->directory; *p != '\0'; p++)
773 {
774 q=p;
775 while ((*q != '\n') && (*q != '\0'))
776 q++;
777 (void) CopyMagickString(image_info->filename,p,(size_t) (q-p+1));
778 p=q;
779 (void) fprintf(file," %s",image_info->filename);
780 handler=SetWarningHandler((WarningHandler) NULL);
781 tile=ReadImage(image_info,&image->exception);
782 (void) SetWarningHandler(handler);
783 if (tile == (Image *) NULL)
784 {
785 (void) fprintf(file,"\n");
786 continue;
787 }
788 (void) fprintf(file," %lux%lu %s\n",tile->magick_columns,
789 tile->magick_rows,tile->magick);
790 (void) SignatureImage(tile);
791 ResetImagePropertyIterator(tile);
792 property=GetNextImageProperty(tile);
793 while (property != (const char *) NULL)
794 {
795 (void) fprintf(file," %s:\n",property);
796 value=GetImageProperty(tile,property);
797 if (value != (const char *) NULL)
798 (void) fprintf(file,"%s\n",value);
799 property=GetNextImageProperty(tile);
800 }
801 tile=DestroyImage(tile);
802 }
803 image_info=DestroyImageInfo(image_info);
804 }
805 (void) GetImageProperty(image,"exif:*");
806 ResetImagePropertyIterator(image);
807 property=GetNextImageProperty(image);
808 if (property != (const char *) NULL)
809 {
810 /*
811 Display image properties.
812 */
813 (void) fprintf(file," Properties:\n");
814 while (property != (const char *) NULL)
815 {
816 (void) fprintf(file," %c",*property);
817 if (strlen(property) > 1)
818 (void) fprintf(file,"%s: ",property+1);
819 if (strlen(property) > 80)
820 (void) fputc('\n',file);
821 value=GetImageProperty(image,property);
822 if (value != (const char *) NULL)
823 (void) fprintf(file,"%s\n",value);
824 property=GetNextImageProperty(image);
825 }
826 }
827 (void) FormatMagickString(key,MaxTextExtent,"8BIM:1999,2998:#1");
828 value=GetImageProperty(image,key);
829 if (value != (const char *) NULL)
830 {
831 /*
832 Display clipping path.
833 */
834 (void) fprintf(file," Clipping path: ");
835 if (strlen(value) > 80)
836 (void) fputc('\n',file);
837 (void) fprintf(file,"%s\n",value);
838 }
839 ResetImageProfileIterator(image);
840 name=GetNextImageProfile(image);
841 if (name != (char *) NULL)
842 {
843 const StringInfo
844 *profile;
845
846 /*
847 Identify image profiles.
848 */
849 (void) fprintf(file," Profiles:\n");
850 while (name != (char *) NULL)
851 {
852 profile=GetImageProfile(image,name);
853 if (profile == (StringInfo *) NULL)
854 continue;
855 (void) fprintf(file," Profile-%s: %lu bytes\n",name,(unsigned long)
856 GetStringInfoLength(profile));
857#if defined(MAGICKCORE_LCMS_DELEGATE)
858 if ((LocaleCompare(name,"icc") == 0) ||
859 (LocaleCompare(name,"icm") == 0))
860 {
861 cmsHPROFILE
862 icc_profile;
863
864 icc_profile=cmsOpenProfileFromMem(GetStringInfoDatum(profile),
865 (DWORD) GetStringInfoLength(profile));
866 if (icc_profile != (cmsHPROFILE *) NULL)
867 {
868 const char
869 *name;
870
871 name=cmsTakeProductName(icc_profile);
872 if (name != (const char *) NULL)
873 (void) fprintf(file," %s\n",name);
874 (void) cmsCloseProfile(icc_profile);
875 }
876 }
877#endif
878 if (LocaleCompare(name,"iptc") == 0)
879 {
880 char
881 *attribute,
882 **attribute_list;
883
884 const char
885 *tag;
886
887 long
888 dataset,
889 record,
890 sentinel;
891
892 register long
893 j;
894
895 size_t
896 length,
897 profile_length;
898
899 profile_length=GetStringInfoLength(profile);
900 for (i=0; i < (long) profile_length; i+=(long) length)
901 {
902 length=1;
903 sentinel=GetStringInfoDatum(profile)[i++];
904 if (sentinel != 0x1c)
905 continue;
906 dataset=GetStringInfoDatum(profile)[i++];
907 record=GetStringInfoDatum(profile)[i++];
908 switch (record)
909 {
910 case 5: tag="Image Name"; break;
911 case 7: tag="Edit Status"; break;
912 case 10: tag="Priority"; break;
913 case 15: tag="Category"; break;
914 case 20: tag="Supplemental Category"; break;
915 case 22: tag="Fixture Identifier"; break;
916 case 25: tag="Keyword"; break;
917 case 30: tag="Release Date"; break;
918 case 35: tag="Release Time"; break;
919 case 40: tag="Special Instructions"; break;
920 case 45: tag="Reference Service"; break;
921 case 47: tag="Reference Date"; break;
922 case 50: tag="Reference Number"; break;
923 case 55: tag="Created Date"; break;
924 case 60: tag="Created Time"; break;
925 case 65: tag="Originating Program"; break;
926 case 70: tag="Program Version"; break;
927 case 75: tag="Object Cycle"; break;
928 case 80: tag="Byline"; break;
929 case 85: tag="Byline Title"; break;
930 case 90: tag="City"; break;
931 case 95: tag="Province State"; break;
932 case 100: tag="Country Code"; break;
933 case 101: tag="Country"; break;
934 case 103: tag="Original Transmission Reference"; break;
935 case 105: tag="Headline"; break;
936 case 110: tag="Credit"; break;
937 case 115: tag="Src"; break;
938 case 116: tag="Copyright String"; break;
939 case 120: tag="Caption"; break;
940 case 121: tag="Local Caption"; break;
941 case 122: tag="Caption Writer"; break;
942 case 200: tag="Custom Field 1"; break;
943 case 201: tag="Custom Field 2"; break;
944 case 202: tag="Custom Field 3"; break;
945 case 203: tag="Custom Field 4"; break;
946 case 204: tag="Custom Field 5"; break;
947 case 205: tag="Custom Field 6"; break;
948 case 206: tag="Custom Field 7"; break;
949 case 207: tag="Custom Field 8"; break;
950 case 208: tag="Custom Field 9"; break;
951 case 209: tag="Custom Field 10"; break;
952 case 210: tag="Custom Field 11"; break;
953 case 211: tag="Custom Field 12"; break;
954 case 212: tag="Custom Field 13"; break;
955 case 213: tag="Custom Field 14"; break;
956 case 214: tag="Custom Field 15"; break;
957 case 215: tag="Custom Field 16"; break;
958 case 216: tag="Custom Field 17"; break;
959 case 217: tag="Custom Field 18"; break;
960 case 218: tag="Custom Field 19"; break;
961 case 219: tag="Custom Field 20"; break;
962 default: tag="unknown"; break;
963 }
964 (void) fprintf(file," %s[%ld,%ld]: ",tag,dataset,record);
965 length=(size_t) (GetStringInfoDatum(profile)[i++] << 8);
966 length|=GetStringInfoDatum(profile)[i++];
967 attribute=(char *) NULL;
968 if (~length >= MaxTextExtent)
969 attribute=(char *) AcquireQuantumMemory(length+
970 MaxTextExtent,sizeof(*attribute));
971 if (attribute != (char *) NULL)
972 {
973 (void) CopyMagickString(attribute,(char *)
974 GetStringInfoDatum(profile)+i,length+1);
975 attribute_list=StringToList(attribute);
976 if (attribute_list != (char **) NULL)
977 {
978 for (j=0; attribute_list[j] != (char *) NULL; j++)
979 {
980 (void) fputs(attribute_list[j],file);
981 (void) fputs("\n",file);
982 attribute_list[j]=(char *) RelinquishMagickMemory(
983 attribute_list[j]);
984 }
985 attribute_list=(char **) RelinquishMagickMemory(
986 attribute_list);
987 }
988 attribute=DestroyString(attribute);
989 }
990 }
991 }
992 if (image->debug != MagickFalse)
993 PrintStringInfo(file,name,profile);
994 name=GetNextImageProfile(image);
995 }
996 }
997 ResetImageArtifactIterator(image);
998 artifact=GetNextImageArtifact(image);
999 if (artifact != (const char *) NULL)
1000 {
1001 /*
1002 Display image artifacts.
1003 */
1004 (void) fprintf(file," Artifacts:\n");
1005 while (artifact != (const char *) NULL)
1006 {
1007 (void) fprintf(file," %c",*artifact);
1008 if (strlen(artifact) > 1)
1009 (void) fprintf(file,"%s: ",artifact+1);
1010 if (strlen(artifact) > 80)
1011 (void) fputc('\n',file);
1012 value=GetImageArtifact(image,artifact);
1013 if (value != (const char *) NULL)
1014 (void) fprintf(file,"%s\n",value);
1015 artifact=GetNextImageArtifact(image);
1016 }
1017 }
1018 ResetImageRegistryIterator();
1019 registry=GetNextImageRegistry();
1020 if (registry != (const char *) NULL)
1021 {
1022 /*
1023 Display image registry.
1024 */
1025 (void) fprintf(file," Registry:\n");
1026 while (registry != (const char *) NULL)
1027 {
1028 (void) fprintf(file," %c",*registry);
1029 if (strlen(registry) > 1)
1030 (void) fprintf(file,"%s: ",registry+1);
1031 if (strlen(registry) > 80)
1032 (void) fputc('\n',file);
1033 value=(const char *) GetImageRegistry(StringRegistryType,registry,
1034 &image->exception);
1035 if (value != (const char *) NULL)
1036 (void) fprintf(file,"%s\n",value);
1037 registry=GetNextImageRegistry();
1038 }
1039 }
1040 (void) fprintf(file," Tainted: %s\n",MagickOptionToMnemonic(
1041 MagickBooleanOptions,(long) image->taint));
cristyb9080c92009-12-01 20:13:26 +00001042 (void) FormatMagickSize(GetBlobSize(image),MagickFalse,format);
cristy3ed852e2009-09-05 21:47:34 +00001043 (void) fprintf(file," Filesize: %s\n",format);
cristyb9080c92009-12-01 20:13:26 +00001044 (void) FormatMagickSize((MagickSizeType) image->columns*image->rows,
1045 MagickFalse,format);
cristy3ed852e2009-09-05 21:47:34 +00001046 (void) fprintf(file," Number pixels: %s\n",format);
cristy3d231692009-09-29 01:05:22 +00001047 (void) FormatMagickSize((MagickSizeType) ((double) image->columns*image->rows/
cristyb9080c92009-12-01 20:13:26 +00001048 elapsed_time+0.5),MagickFalse,format);
cristy3d231692009-09-29 01:05:22 +00001049 (void) fprintf(file," Pixels per second: %s\n",format);
1050 (void) fprintf(file," User time: %0.3fu\n",user_time);
1051 (void) fprintf(file," Elapsed time: %ld:%02ld.%03ld\n",(long)
1052 (elapsed_time/60.0),(long) ceil(fmod(elapsed_time,60.0)),(long)
1053 (1000.0*(elapsed_time-floor(elapsed_time))));
1054 (void) fprintf(file," Version: %s\n",GetMagickVersion((unsigned long *)
1055 NULL));
cristy3ed852e2009-09-05 21:47:34 +00001056 (void) fflush(file);
1057 return(ferror(file) != 0 ? MagickFalse : MagickTrue);
1058}