2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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 %
13 % Identify an Image Format and Characteristics. %
20 % Copyright 1999-2008 ImageMagick Studio LLC, a non-profit organization %
21 % dedicated to making software imaging solutions freely available. %
23 % You may not use this file except in compliance with the License. You may %
24 % obtain a copy of the License at %
26 % http://www.imagemagick.org/script/license.php %
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. %
34 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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.
45 #include "magick/studio.h"
46 #include "magick/annotate.h"
47 #include "magick/artifact.h"
48 #include "magick/blob.h"
49 #include "magick/cache.h"
50 #include "magick/client.h"
51 #include "magick/coder.h"
52 #include "magick/color.h"
53 #include "magick/configure.h"
54 #include "magick/constitute.h"
55 #include "magick/decorate.h"
56 #include "magick/delegate.h"
57 #include "magick/draw.h"
58 #include "magick/effect.h"
59 #include "magick/exception.h"
60 #include "magick/exception-private.h"
61 #include "magick/gem.h"
62 #include "magick/geometry.h"
63 #include "magick/identify.h"
64 #include "magick/image.h"
65 #include "magick/image-private.h"
66 #include "magick/list.h"
67 #include "magick/locale_.h"
68 #include "magick/log.h"
69 #include "magick/magic.h"
70 #include "magick/magick.h"
71 #include "magick/memory_.h"
72 #include "magick/module.h"
73 #include "magick/monitor.h"
74 #include "magick/montage.h"
75 #include "magick/option.h"
76 #include "magick/pixel-private.h"
77 #include "magick/prepress.h"
78 #include "magick/profile.h"
79 #include "magick/property.h"
80 #include "magick/quantize.h"
81 #include "magick/quantum.h"
82 #include "magick/random_.h"
83 #include "magick/registry.h"
84 #include "magick/resize.h"
85 #include "magick/resource_.h"
86 #include "magick/signature.h"
87 #include "magick/statistic.h"
88 #include "magick/string_.h"
89 #include "magick/timer.h"
90 #include "magick/utility.h"
91 #include "magick/version.h"
92 #if defined(MAGICKCORE_LCMS_DELEGATE)
93 #if defined(MAGICKCORE_HAVE_LCMS_LCMS_H)
94 #include <lcms/lcms.h>
101 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
105 % I d e n t i f y I m a g e %
109 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
111 % IdentifyImage() identifies an image by printing its attributes to the file.
112 % Attributes include the image width, height, size, and others.
114 % The format of the IdentifyImage method is:
116 % MagickBooleanType IdentifyImage(Image *image,FILE *file,
117 % const MagickBooleanType verbose)
119 % A description of each parameter follows:
121 % o image: the image.
123 % o file: the file, typically stdout.
125 % o verbose: A value other than zero prints more detailed information
130 MagickExport MagickBooleanType IdentifyImage(Image *image,FILE *file,
131 const MagickBooleanType verbose)
133 #define IdentifyFormat " %s:\n min: " QuantumFormat \
134 " (%g)\n max: " QuantumFormat " (%g)\n" \
135 " mean: %g (%g)\n standard deviation: %g (%g)\n" \
136 " kurtosis: %g\n skewness: %g\n"
139 color[MaxTextExtent],
140 format[MaxTextExtent],
182 assert(image != (Image *) NULL);
183 assert(image->signature == MagickSignature);
184 if (image->debug != MagickFalse)
185 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
186 if (file == (FILE *) NULL)
189 elapsed_time=GetElapsedTime(&image->timer);
190 user_time=GetUserTime(&image->timer);
191 GetTimerInfo(&image->timer);
192 if (verbose == MagickFalse)
195 Display summary info about the image.
197 if (*image->magick_filename != '\0')
198 if (LocaleCompare(image->magick_filename,image->filename) != 0)
199 (void) fprintf(file,"%s=>",image->magick_filename);
200 if ((GetPreviousImageInList(image) == (Image *) NULL) &&
201 (GetNextImageInList(image) == (Image *) NULL) && (image->scene == 0))
202 (void) fprintf(file,"%s ",image->filename);
204 (void) fprintf(file,"%s[%lu] ",image->filename,image->scene);
205 (void) fprintf(file,"%s ",image->magick);
206 if ((image->magick_columns != 0) || (image->magick_rows != 0))
207 if ((image->magick_columns != image->columns) ||
208 (image->magick_rows != image->rows))
209 (void) fprintf(file,"%lux%lu=>",image->magick_columns,
211 (void) fprintf(file,"%lux%lu ",image->columns,image->rows);
212 if ((image->page.width != 0) || (image->page.height != 0) ||
213 (image->page.x != 0) || (image->page.y != 0))
214 (void) fprintf(file,"%lux%lu%+ld%+ld ",image->page.width,
215 image->page.height,image->page.x,image->page.y);
216 (void) fprintf(file,"%lu-bit ",image->depth);
217 if (image->type != UndefinedType)
218 (void) fprintf(file,"%s ",MagickOptionToMnemonic(MagickTypeOptions,
219 (long) image->type));
220 if (image->storage_class == DirectClass)
222 (void) fprintf(file,"DirectClass ");
223 if (image->total_colors != 0)
225 (void) FormatMagickSize(image->total_colors,format);
226 (void) fprintf(file,"%s ",format);
230 if (image->total_colors <= image->colors)
231 (void) fprintf(file,"PseudoClass %luc ",image->colors);
233 (void) fprintf(file,"PseudoClass %lu=>%luc ",image->total_colors,
235 if (image->error.mean_error_per_pixel != 0.0)
236 (void) fprintf(file,"%ld/%f/%fdb ",(long)
237 (image->error.mean_error_per_pixel+0.5),
238 image->error.normalized_mean_error,
239 image->error.normalized_maximum_error);
240 if (GetBlobSize(image) != 0)
242 (void) FormatMagickSize(GetBlobSize(image),format);
243 (void) fprintf(file,"%s ",format);
245 (void) fprintf(file,"%0.3fu %ld:%02ld.%03ld",user_time,(long)
246 (elapsed_time/60.0),(long) floor(fmod(elapsed_time,60.0)),
247 (long) (1000.0*(elapsed_time-floor(elapsed_time))));
248 (void) fprintf(file,"\n");
250 return(ferror(file) != 0 ? MagickFalse : MagickTrue);
253 Display verbose info about the image.
255 exception=AcquireExceptionInfo();
256 pixels=GetVirtualPixels(image,0,0,1,1,exception);
257 exception=DestroyExceptionInfo(exception);
258 ping=pixels == (const PixelPacket *) NULL ? MagickTrue : MagickFalse;
259 type=GetImageType(image,&image->exception);
260 (void) SignatureImage(image);
261 (void) fprintf(file,"Image: %s\n",image->filename);
262 if (*image->magick_filename != '\0')
263 if (LocaleCompare(image->magick_filename,image->filename) != 0)
266 filename[MaxTextExtent];
268 GetPathComponent(image->magick_filename,TailPath,filename);
269 (void) fprintf(file," Base filename: %s\n",filename);
271 magick_info=GetMagickInfo(image->magick,&image->exception);
272 if ((magick_info == (const MagickInfo *) NULL) ||
273 (*GetMagickDescription(magick_info) == '\0'))
274 (void) fprintf(file," Format: %s\n",image->magick);
276 (void) fprintf(file," Format: %s (%s)\n",image->magick,
277 GetMagickDescription(magick_info));
278 (void) fprintf(file," Class: %s\n",MagickOptionToMnemonic(MagickClassOptions,
279 (long) image->storage_class));
280 (void) fprintf(file," Geometry: %lux%lu%+ld%+ld\n",image->columns,
281 image->rows,image->tile_offset.x,image->tile_offset.y);
282 if ((image->magick_columns != 0) || (image->magick_rows != 0))
283 if ((image->magick_columns != image->columns) ||
284 (image->magick_rows != image->rows))
285 (void) fprintf(file," Base geometry: %lux%lu\n",image->magick_columns,
287 if ((image->x_resolution != 0.0) && (image->y_resolution != 0.0))
289 (void) fprintf(file," Resolution: %gx%g\n",image->x_resolution,
290 image->y_resolution);
291 (void) fprintf(file," Print size: %gx%g\n",(double) image->columns/
292 image->x_resolution,(double) image->rows/image->y_resolution);
294 (void) fprintf(file," Units: %s\n",MagickOptionToMnemonic(
295 MagickResolutionOptions,(long) image->units));
296 (void) fprintf(file," Type: %s\n",MagickOptionToMnemonic(MagickTypeOptions,
298 if (image->type != UndefinedType)
299 (void) fprintf(file," Base type: %s\n",MagickOptionToMnemonic(
300 MagickTypeOptions,(long) image->type));
301 (void) fprintf(file," Endianess: %s\n",MagickOptionToMnemonic(
302 MagickEndianOptions,(long) image->endian));
304 Detail channel depth and extrema.
306 (void) fprintf(file," Colorspace: %s\n",MagickOptionToMnemonic(
307 MagickColorspaceOptions,(long) image->colorspace));
308 if (ping == MagickFalse)
316 depth=GetImageDepth(image,&image->exception);
317 if (image->depth == depth)
318 (void) fprintf(file," Depth: %lu-bit\n",image->depth);
320 (void) fprintf(file," Depth: %lu/%lu-bit\n",image->depth,depth);
321 channel_statistics=GetImageChannelStatistics(image,&image->exception);
322 (void) fprintf(file," Channel depth:\n");
323 colorspace=image->colorspace;
324 if (IsGrayImage(image,&image->exception) != MagickFalse)
325 colorspace=GRAYColorspace;
331 (void) fprintf(file," red: %lu-bit\n",
332 channel_statistics[RedChannel].depth);
333 (void) fprintf(file," green: %lu-bit\n",
334 channel_statistics[GreenChannel].depth);
335 (void) fprintf(file," blue: %lu-bit\n",
336 channel_statistics[BlueChannel].depth);
337 if (image->matte != MagickFalse)
338 (void) fprintf(file," alpha: %lu-bit\n",
339 channel_statistics[OpacityChannel].depth);
344 (void) fprintf(file," cyan: %lu-bit\n",
345 channel_statistics[CyanChannel].depth);
346 (void) fprintf(file," magenta: %lu-bit\n",
347 channel_statistics[MagentaChannel].depth);
348 (void) fprintf(file," yellow: %lu-bit\n",
349 channel_statistics[YellowChannel].depth);
350 (void) fprintf(file," black: %lu-bit\n",
351 channel_statistics[BlackChannel].depth);
352 if (image->matte != MagickFalse)
353 (void) fprintf(file," alpha: %lu-bit\n",
354 channel_statistics[OpacityChannel].depth);
359 (void) fprintf(file," gray: %lu-bit\n",
360 channel_statistics[GrayChannel].depth);
361 if (image->matte != MagickFalse)
362 (void) fprintf(file," alpha: %lu-bit\n",
363 channel_statistics[OpacityChannel].depth);
368 if (image->depth <= MAGICKCORE_QUANTUM_DEPTH)
369 scale=QuantumRange/((unsigned long) QuantumRange >> ((unsigned long)
370 MAGICKCORE_QUANTUM_DEPTH-image->depth));
371 (void) fprintf(file," Channel statistics:\n");
377 (void) fprintf(file,IdentifyFormat,"red",(Quantum)
378 (channel_statistics[RedChannel].minima/scale),(double)
379 channel_statistics[RedChannel].minima/(double) QuantumRange,
380 (Quantum) (channel_statistics[RedChannel].maxima/scale),(double)
381 channel_statistics[RedChannel].maxima/(double) QuantumRange,
382 channel_statistics[RedChannel].mean/(double) scale,
383 channel_statistics[RedChannel].mean/(double) QuantumRange,
384 channel_statistics[RedChannel].standard_deviation/(double) scale,
385 channel_statistics[RedChannel].standard_deviation/(double)
386 QuantumRange,channel_statistics[RedChannel].kurtosis,
387 channel_statistics[RedChannel].skewness);
388 (void) fprintf(file,IdentifyFormat,"green",(Quantum)
389 (channel_statistics[GreenChannel].minima/scale),(double)
390 channel_statistics[GreenChannel].minima/(double) QuantumRange,
391 (Quantum) (channel_statistics[GreenChannel].maxima/scale),(double)
392 channel_statistics[GreenChannel].maxima/(double) QuantumRange,
393 channel_statistics[GreenChannel].mean/(double) scale,
394 channel_statistics[GreenChannel].mean/(double) QuantumRange,
395 channel_statistics[GreenChannel].standard_deviation/(double) scale,
396 channel_statistics[GreenChannel].standard_deviation/(double)
398 channel_statistics[GreenChannel].kurtosis,
399 channel_statistics[GreenChannel].skewness);
400 (void) fprintf(file,IdentifyFormat,"blue",(Quantum)
401 (channel_statistics[BlueChannel].minima/scale),(double)
402 channel_statistics[BlueChannel].minima/(double) QuantumRange,
403 (Quantum) (channel_statistics[BlueChannel].maxima/scale),(double)
404 channel_statistics[BlueChannel].maxima/(double) QuantumRange,
405 channel_statistics[BlueChannel].mean/(double) scale,
406 channel_statistics[BlueChannel].mean/(double) QuantumRange,
407 channel_statistics[BlueChannel].standard_deviation/(double) scale,
408 channel_statistics[BlueChannel].standard_deviation/(double)
409 QuantumRange,channel_statistics[BlueChannel].kurtosis,
410 channel_statistics[BlueChannel].skewness);
415 (void) fprintf(file,IdentifyFormat,"cyan",(Quantum)
416 (channel_statistics[CyanChannel].minima/scale),(double)
417 channel_statistics[CyanChannel].minima/(double) QuantumRange,
418 (Quantum) (channel_statistics[CyanChannel].maxima/scale),(double)
419 channel_statistics[CyanChannel].maxima/(double) QuantumRange,
420 channel_statistics[CyanChannel].mean/(double) scale,
421 channel_statistics[CyanChannel].mean/(double) QuantumRange,
422 channel_statistics[CyanChannel].standard_deviation/(double) scale,
423 channel_statistics[CyanChannel].standard_deviation/(double)
424 QuantumRange,channel_statistics[CyanChannel].kurtosis,
425 channel_statistics[CyanChannel].skewness);
426 (void) fprintf(file,IdentifyFormat,"magenta",(Quantum)
427 (channel_statistics[MagentaChannel].minima/scale),(double)
428 channel_statistics[MagentaChannel].minima/(double) QuantumRange,
429 (Quantum) (channel_statistics[MagentaChannel].maxima/scale),(double)
430 channel_statistics[MagentaChannel].maxima/(double) QuantumRange,
431 channel_statistics[MagentaChannel].mean/(double) scale,
432 channel_statistics[MagentaChannel].mean/(double) QuantumRange,
433 channel_statistics[MagentaChannel].standard_deviation/(double)
434 scale,channel_statistics[MagentaChannel].standard_deviation/(double)
435 QuantumRange,channel_statistics[MagentaChannel].kurtosis,
436 channel_statistics[MagentaChannel].skewness);
437 (void) fprintf(file,IdentifyFormat,"yellow",(Quantum)
438 (channel_statistics[YellowChannel].minima/scale),(double)
439 channel_statistics[YellowChannel].minima/(double) QuantumRange,
440 (Quantum) (channel_statistics[YellowChannel].maxima/scale),(double)
441 channel_statistics[YellowChannel].maxima/(double) QuantumRange,
442 channel_statistics[YellowChannel].mean/(double) scale,
443 channel_statistics[YellowChannel].mean/(double) QuantumRange,
444 channel_statistics[YellowChannel].standard_deviation/(double) scale,
445 channel_statistics[YellowChannel].standard_deviation/(double)
446 QuantumRange,channel_statistics[YellowChannel].kurtosis,
447 channel_statistics[YellowChannel].skewness);
448 (void) fprintf(file,IdentifyFormat,"black",(Quantum)
449 (channel_statistics[BlackChannel].minima/scale),(double)
450 channel_statistics[BlackChannel].minima/(double) QuantumRange,
451 (Quantum) (channel_statistics[BlackChannel].maxima/scale),(double)
452 channel_statistics[BlackChannel].maxima/(double) QuantumRange,
453 channel_statistics[BlackChannel].mean/(double) scale,
454 channel_statistics[BlackChannel].mean/(double) QuantumRange,
455 channel_statistics[BlackChannel].standard_deviation/(double) scale,
456 channel_statistics[BlackChannel].standard_deviation/(double)
457 QuantumRange,channel_statistics[BlackChannel].kurtosis,
458 channel_statistics[BlackChannel].skewness);
463 (void) fprintf(file,IdentifyFormat,"gray",(Quantum)
464 (channel_statistics[GrayChannel].minima/scale),(double)
465 channel_statistics[GrayChannel].minima/(double) QuantumRange,
466 (Quantum) (channel_statistics[GrayChannel].maxima/scale),(double)
467 channel_statistics[GrayChannel].maxima/(double) QuantumRange,
468 channel_statistics[GrayChannel].mean/(double) scale,
469 channel_statistics[GrayChannel].mean/(double) QuantumRange,
470 channel_statistics[GrayChannel].standard_deviation/(double) scale,
471 channel_statistics[GrayChannel].standard_deviation/(double)
472 QuantumRange,channel_statistics[GrayChannel].kurtosis,
473 channel_statistics[GrayChannel].skewness);
477 if (image->matte != MagickFalse)
478 (void) fprintf(file,IdentifyFormat,"alpha",(Quantum)
479 ((QuantumRange-channel_statistics[AlphaChannel].maxima)/scale),
480 (double) (QuantumRange-channel_statistics[AlphaChannel].maxima)/
481 (double) QuantumRange, (Quantum) ((QuantumRange-
482 channel_statistics[AlphaChannel].minima)/scale),(double)
483 (QuantumRange-channel_statistics[AlphaChannel].minima)/(double)
484 QuantumRange,(QuantumRange-channel_statistics[AlphaChannel].mean)/
485 (double) scale,(QuantumRange-channel_statistics[AlphaChannel].mean)/
486 (double) QuantumRange,
487 channel_statistics[AlphaChannel].standard_deviation/(double) scale,
488 channel_statistics[AlphaChannel].standard_deviation/(double)
489 QuantumRange,channel_statistics[AlphaChannel].kurtosis,
490 channel_statistics[AlphaChannel].skewness);
491 if (colorspace != GRAYColorspace)
493 (void) fprintf(file," Image statistics:\n");
494 (void) fprintf(file,IdentifyFormat,"Overall",(Quantum)
495 (channel_statistics[AllChannels].minima/scale),(double)
496 channel_statistics[AllChannels].minima/(double) QuantumRange,
497 (Quantum) (channel_statistics[AllChannels].maxima/scale),(double)
498 channel_statistics[AllChannels].maxima/(double) QuantumRange,
499 channel_statistics[AllChannels].mean/(double) scale,
500 channel_statistics[AllChannels].mean/(double) QuantumRange,
501 channel_statistics[AllChannels].standard_deviation/(double) scale,
502 channel_statistics[AllChannels].standard_deviation/(double)
503 QuantumRange,channel_statistics[AllChannels].kurtosis,
504 channel_statistics[AllChannels].skewness);
506 channel_statistics=(ChannelStatistics *) RelinquishMagickMemory(
508 if (image->colorspace == CMYKColorspace)
509 (void) fprintf(file," Total ink density: %.0f%%\n",100.0*
510 GetImageTotalInkDensity(image)/(double) QuantumRange);
512 if (image->matte != MagickFalse)
514 register const IndexPacket
517 register const PixelPacket
520 p=(PixelPacket *) NULL;
521 indexes=(IndexPacket *) NULL;
522 for (y=0; y < (long) image->rows; y++)
524 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
525 if (p == (const PixelPacket *) NULL)
527 indexes=GetVirtualIndexQueue(image);
528 for (x=0; x < (long) image->columns; x++)
530 if (p->opacity == (Quantum) TransparentOpacity)
534 if (x < (long) image->columns)
537 if ((x < (long) image->columns) || (y < (long) image->rows))
540 tuple[MaxTextExtent];
545 GetMagickPixelPacket(image,&pixel);
546 SetMagickPixelPacket(image,p,indexes+x,&pixel);
547 (void) QueryMagickColorname(image,&pixel,SVGCompliance,tuple,
549 (void) fprintf(file," Alpha: %s ",tuple);
550 GetColorTuple(&pixel,MagickTrue,tuple);
551 (void) fprintf(file," %s\n",tuple);
554 if (ping == MagickFalse)
556 artifact=GetImageArtifact(image,"identify:unique");
557 if ((artifact != (const char *) NULL) &&
558 (IsMagickTrue(artifact) != MagickFalse))
559 (void) fprintf(file," Colors: %lu\n",GetNumberColors(image,
560 (FILE *) NULL,&image->exception));
561 if (IsHistogramImage(image,&image->exception) != MagickFalse)
563 (void) fprintf(file," Histogram:\n");
564 (void) GetNumberColors(image,file,&image->exception);
568 if (image->storage_class == PseudoClass)
570 (void) fprintf(file," Colormap: %lu\n",image->colors);
571 if (image->colors <= 1024)
574 color[MaxTextExtent],
576 tuple[MaxTextExtent];
584 GetMagickPixelPacket(image,&pixel);
586 for (i=0; i < (long) image->colors; i++)
588 SetMagickPixelPacket(image,p,(IndexPacket *) NULL,&pixel);
589 (void) CopyMagickString(tuple,"(",MaxTextExtent);
590 ConcatenateColorComponent(&pixel,RedChannel,X11Compliance,tuple);
591 (void) ConcatenateMagickString(tuple,",",MaxTextExtent);
592 ConcatenateColorComponent(&pixel,GreenChannel,X11Compliance,tuple);
593 (void) ConcatenateMagickString(tuple,",",MaxTextExtent);
594 ConcatenateColorComponent(&pixel,BlueChannel,X11Compliance,tuple);
595 if (pixel.colorspace == CMYKColorspace)
597 (void) ConcatenateMagickString(tuple,",",MaxTextExtent);
598 ConcatenateColorComponent(&pixel,IndexChannel,X11Compliance,
601 if (pixel.matte != MagickFalse)
603 (void) ConcatenateMagickString(tuple,",",MaxTextExtent);
604 ConcatenateColorComponent(&pixel,OpacityChannel,X11Compliance,
607 (void) ConcatenateMagickString(tuple,")",MaxTextExtent);
608 (void) QueryMagickColorname(image,&pixel,SVGCompliance,color,
610 GetColorTuple(&pixel,MagickTrue,hex);
611 (void) fprintf(file," %8ld: %s %s %s\n",i,tuple,hex,color);
616 if (image->error.mean_error_per_pixel != 0.0)
617 (void) fprintf(file," Mean error per pixel: %g\n",
618 image->error.mean_error_per_pixel);
619 if (image->error.normalized_mean_error != 0.0)
620 (void) fprintf(file," Normalized mean error: %g\n",
621 image->error.normalized_mean_error);
622 if (image->error.normalized_maximum_error != 0.0)
623 (void) fprintf(file," Normalized maximum error: %g\n",
624 image->error.normalized_maximum_error);
625 (void) fprintf(file," Rendering intent: %s\n",MagickOptionToMnemonic(
626 MagickIntentOptions,(long) image->rendering_intent));
627 if (image->gamma != 0.0)
628 (void) fprintf(file," Gamma: %g\n",image->gamma);
629 if ((image->chromaticity.red_primary.x != 0.0) ||
630 (image->chromaticity.green_primary.x != 0.0) ||
631 (image->chromaticity.blue_primary.x != 0.0) ||
632 (image->chromaticity.white_point.x != 0.0))
635 Display image chromaticity.
637 (void) fprintf(file," Chromaticity:\n");
638 (void) fprintf(file," red primary: (%g,%g)\n",
639 image->chromaticity.red_primary.x,image->chromaticity.red_primary.y);
640 (void) fprintf(file," green primary: (%g,%g)\n",
641 image->chromaticity.green_primary.x,
642 image->chromaticity.green_primary.y);
643 (void) fprintf(file," blue primary: (%g,%g)\n",
644 image->chromaticity.blue_primary.x,image->chromaticity.blue_primary.y);
645 (void) fprintf(file," white point: (%g,%g)\n",
646 image->chromaticity.white_point.x,image->chromaticity.white_point.y);
648 if ((image->extract_info.width*image->extract_info.height) != 0)
649 (void) fprintf(file," Tile geometry: %lux%lu%+ld%+ld\n",
650 image->extract_info.width,image->extract_info.height,
651 image->extract_info.x,image->extract_info.y);
652 (void) fprintf(file," Interlace: %s\n",MagickOptionToMnemonic(
653 MagickInterlaceOptions,(long) image->interlace));
654 (void) QueryColorname(image,&image->background_color,SVGCompliance,color,
656 (void) fprintf(file," Background color: %s\n",color);
657 (void) QueryColorname(image,&image->border_color,SVGCompliance,color,
659 (void) fprintf(file," Border color: %s\n",color);
660 (void) QueryColorname(image,&image->matte_color,SVGCompliance,color,
662 (void) fprintf(file," Matte color: %s\n",color);
663 (void) QueryColorname(image,&image->transparent_color,SVGCompliance,color,
665 (void) fprintf(file," Transparent color: %s\n",color);
666 (void) fprintf(file," Compose: %s\n",MagickOptionToMnemonic(
667 MagickComposeOptions,(long) image->compose));
668 if ((image->page.width != 0) || (image->page.height != 0) ||
669 (image->page.x != 0) || (image->page.y != 0))
670 (void) fprintf(file," Page geometry: %lux%lu%+ld%+ld\n",image->page.width,
671 image->page.height,image->page.x,image->page.y);
672 if ((image->page.x != 0) || (image->page.y != 0))
673 (void) fprintf(file," Origin geometry: %+ld%+ld\n",image->page.x,
675 (void) fprintf(file," Dispose: %s\n",MagickOptionToMnemonic(
676 MagickDisposeOptions,(long) image->dispose));
677 if (image->delay != 0)
678 (void) fprintf(file," Delay: %lux%ld\n",image->delay,
679 image->ticks_per_second);
680 if (image->iterations != 1)
681 (void) fprintf(file," Iterations: %lu\n",image->iterations);
682 if ((image->next != (Image *) NULL) || (image->previous != (Image *) NULL))
683 (void) fprintf(file," Scene: %lu of %lu\n",image->scene,
684 GetImageListLength(image));
686 if (image->scene != 0)
687 (void) fprintf(file," Scene: %lu\n",image->scene);
688 (void) fprintf(file," Compression: %s\n",MagickOptionToMnemonic(
689 MagickCompressOptions,(long) image->compression));
690 if (image->quality != UndefinedCompressionQuality)
691 (void) fprintf(file," Quality: %lu\n",image->quality);
692 (void) fprintf(file," Orientation: %s\n",MagickOptionToMnemonic(
693 MagickOrientationOptions,(long) image->orientation));
694 if (image->montage != (char *) NULL)
695 (void) fprintf(file," Montage: %s\n",image->montage);
696 if (image->directory != (char *) NULL)
712 Display visual image directory.
714 image_info=AcquireImageInfo();
715 (void) CloneString(&image_info->size,"64x64");
716 (void) fprintf(file," Directory:\n");
717 for (p=image->directory; *p != '\0'; p++)
720 while ((*q != '\n') && (*q != '\0'))
722 (void) CopyMagickString(image_info->filename,p,(size_t) (q-p+1));
724 (void) fprintf(file," %s",image_info->filename);
725 handler=SetWarningHandler((WarningHandler) NULL);
726 tile=ReadImage(image_info,&image->exception);
727 (void) SetWarningHandler(handler);
728 if (tile == (Image *) NULL)
730 (void) fprintf(file,"\n");
733 (void) fprintf(file," %lux%lu %s\n",tile->magick_columns,
734 tile->magick_rows,tile->magick);
735 (void) SignatureImage(tile);
736 ResetImagePropertyIterator(tile);
737 property=GetNextImageProperty(tile);
738 while (property != (const char *) NULL)
740 (void) fprintf(file," %s:\n",property);
741 value=GetImageProperty(tile,property);
742 if (value != (const char *) NULL)
743 (void) fprintf(file,"%s\n",value);
744 property=GetNextImageProperty(tile);
746 tile=DestroyImage(tile);
748 image_info=DestroyImageInfo(image_info);
750 (void) GetImageProperty(image,"exif:*");
751 ResetImagePropertyIterator(image);
752 property=GetNextImageProperty(image);
753 if (property != (const char *) NULL)
756 Display image properties.
758 (void) fprintf(file," Properties:\n");
759 while (property != (const char *) NULL)
761 (void) fprintf(file," %c",*property);
762 if (strlen(property) > 1)
763 (void) fprintf(file,"%s: ",property+1);
764 if (strlen(property) > 80)
765 (void) fputc('\n',file);
766 value=GetImageProperty(image,property);
767 if (value != (const char *) NULL)
768 (void) fprintf(file,"%s\n",value);
769 property=GetNextImageProperty(image);
772 (void) FormatMagickString(key,MaxTextExtent,"8BIM:1999,2998:#1");
773 value=GetImageProperty(image,key);
774 if (value != (const char *) NULL)
777 Display clipping path.
779 (void) fprintf(file," Clipping path: ");
780 if (strlen(value) > 80)
781 (void) fputc('\n',file);
782 (void) fprintf(file,"%s\n",value);
784 ResetImageProfileIterator(image);
785 name=GetNextImageProfile(image);
786 if (name != (char *) NULL)
792 Identify image profiles.
794 (void) fprintf(file," Profiles:\n");
795 while (name != (char *) NULL)
797 profile=GetImageProfile(image,name);
798 if (profile == (StringInfo *) NULL)
800 (void) fprintf(file," Profile-%s: %lu bytes\n",name,(unsigned long)
801 GetStringInfoLength(profile));
802 #if defined(MAGICKCORE_LCMS_DELEGATE)
803 if ((LocaleCompare(name,"icc") == 0) ||
804 (LocaleCompare(name,"icm") == 0))
809 icc_profile=cmsOpenProfileFromMem(GetStringInfoDatum(profile),
810 (DWORD) GetStringInfoLength(profile));
811 if (icc_profile != (cmsHPROFILE *) NULL)
816 name=cmsTakeProductName(icc_profile);
817 if (name != (const char *) NULL)
818 (void) fprintf(file," %s\n",name);
819 (void) cmsCloseProfile(icc_profile);
823 if (LocaleCompare(name,"iptc") == 0)
844 profile_length=GetStringInfoLength(profile);
845 for (i=0; i < (long) profile_length; i+=(long) length)
848 sentinel=GetStringInfoDatum(profile)[i++];
849 if (sentinel != 0x1c)
851 dataset=GetStringInfoDatum(profile)[i++];
852 record=GetStringInfoDatum(profile)[i++];
855 case 5: tag="Image Name"; break;
856 case 7: tag="Edit Status"; break;
857 case 10: tag="Priority"; break;
858 case 15: tag="Category"; break;
859 case 20: tag="Supplemental Category"; break;
860 case 22: tag="Fixture Identifier"; break;
861 case 25: tag="Keyword"; break;
862 case 30: tag="Release Date"; break;
863 case 35: tag="Release Time"; break;
864 case 40: tag="Special Instructions"; break;
865 case 45: tag="Reference Service"; break;
866 case 47: tag="Reference Date"; break;
867 case 50: tag="Reference Number"; break;
868 case 55: tag="Created Date"; break;
869 case 60: tag="Created Time"; break;
870 case 65: tag="Originating Program"; break;
871 case 70: tag="Program Version"; break;
872 case 75: tag="Object Cycle"; break;
873 case 80: tag="Byline"; break;
874 case 85: tag="Byline Title"; break;
875 case 90: tag="City"; break;
876 case 95: tag="Province State"; break;
877 case 100: tag="Country Code"; break;
878 case 101: tag="Country"; break;
879 case 103: tag="Original Transmission Reference"; break;
880 case 105: tag="Headline"; break;
881 case 110: tag="Credit"; break;
882 case 115: tag="Src"; break;
883 case 116: tag="Copyright String"; break;
884 case 120: tag="Caption"; break;
885 case 121: tag="Local Caption"; break;
886 case 122: tag="Caption Writer"; break;
887 case 200: tag="Custom Field 1"; break;
888 case 201: tag="Custom Field 2"; break;
889 case 202: tag="Custom Field 3"; break;
890 case 203: tag="Custom Field 4"; break;
891 case 204: tag="Custom Field 5"; break;
892 case 205: tag="Custom Field 6"; break;
893 case 206: tag="Custom Field 7"; break;
894 case 207: tag="Custom Field 8"; break;
895 case 208: tag="Custom Field 9"; break;
896 case 209: tag="Custom Field 10"; break;
897 case 210: tag="Custom Field 11"; break;
898 case 211: tag="Custom Field 12"; break;
899 case 212: tag="Custom Field 13"; break;
900 case 213: tag="Custom Field 14"; break;
901 case 214: tag="Custom Field 15"; break;
902 case 215: tag="Custom Field 16"; break;
903 case 216: tag="Custom Field 17"; break;
904 case 217: tag="Custom Field 18"; break;
905 case 218: tag="Custom Field 19"; break;
906 case 219: tag="Custom Field 20"; break;
907 default: tag="unknown"; break;
909 (void) fprintf(file," %s[%ld,%ld]: ",tag,dataset,record);
910 length=(size_t) (GetStringInfoDatum(profile)[i++] << 8);
911 length|=GetStringInfoDatum(profile)[i++];
912 attribute=(char *) NULL;
913 if (~length >= MaxTextExtent)
914 attribute=(char *) AcquireQuantumMemory(length+
915 MaxTextExtent,sizeof(*attribute));
916 if (attribute != (char *) NULL)
918 (void) CopyMagickString(attribute,(char *)
919 GetStringInfoDatum(profile)+i,length+1);
920 attribute_list=StringToList(attribute);
921 if (attribute_list != (char **) NULL)
923 for (j=0; attribute_list[j] != (char *) NULL; j++)
925 (void) fputs(attribute_list[j],file);
926 (void) fputs("\n",file);
927 attribute_list[j]=(char *) RelinquishMagickMemory(
930 attribute_list=(char **) RelinquishMagickMemory(
933 attribute=DestroyString(attribute);
937 if (image->debug != MagickFalse)
938 PrintStringInfo(file,name,profile);
939 name=GetNextImageProfile(image);
942 ResetImageArtifactIterator(image);
943 artifact=GetNextImageArtifact(image);
944 if (artifact != (const char *) NULL)
947 Display image artifacts.
949 (void) fprintf(file," Artifacts:\n");
950 while (artifact != (const char *) NULL)
952 (void) fprintf(file," %c",*artifact);
953 if (strlen(artifact) > 1)
954 (void) fprintf(file,"%s: ",artifact+1);
955 if (strlen(artifact) > 80)
956 (void) fputc('\n',file);
957 value=GetImageArtifact(image,artifact);
958 if (value != (const char *) NULL)
959 (void) fprintf(file,"%s\n",value);
960 artifact=GetNextImageArtifact(image);
963 ResetImageRegistryIterator();
964 registry=GetNextImageRegistry();
965 if (registry != (const char *) NULL)
968 Display image registry.
970 (void) fprintf(file," Registry:\n");
971 while (registry != (const char *) NULL)
973 (void) fprintf(file," %c",*registry);
974 if (strlen(registry) > 1)
975 (void) fprintf(file,"%s: ",registry+1);
976 if (strlen(registry) > 80)
977 (void) fputc('\n',file);
978 value=(const char *) GetImageRegistry(StringRegistryType,registry,
980 if (value != (const char *) NULL)
981 (void) fprintf(file,"%s\n",value);
982 registry=GetNextImageRegistry();
985 (void) fprintf(file," Tainted: %s\n",MagickOptionToMnemonic(
986 MagickBooleanOptions,(long) image->taint));
987 (void) FormatMagickSize(GetBlobSize(image),format);
988 (void) fprintf(file," Filesize: %s\n",format);
989 (void) FormatMagickSize((MagickSizeType) image->columns*image->rows,format);
990 (void) fprintf(file," Number pixels: %s\n",format);
991 (void) FormatMagickSize((MagickSizeType) ((double) image->columns*image->rows/
992 elapsed_time+0.5),format);
993 (void) fprintf(file," Pixels per second: %s\n",format);
994 (void) fprintf(file," User time: %0.3fu\n",user_time);
995 (void) fprintf(file," Elapsed time: %ld:%02ld.%03ld\n",(long)
996 (elapsed_time/60.0),(long) ceil(fmod(elapsed_time,60.0)),(long)
997 (1000.0*(elapsed_time-floor(elapsed_time))));
998 (void) fprintf(file," Version: %s\n",GetMagickVersion((unsigned long *)
1000 (void) fflush(file);
1001 return(ferror(file) != 0 ? MagickFalse : MagickTrue);