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/attribute.h"
49 #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"
62 #include "magick/gem.h"
63 #include "magick/geometry.h"
64 #include "magick/histogram.h"
65 #include "magick/identify.h"
66 #include "magick/image.h"
67 #include "magick/image-private.h"
68 #include "magick/list.h"
69 #include "magick/locale_.h"
70 #include "magick/log.h"
71 #include "magick/magic.h"
72 #include "magick/magick.h"
73 #include "magick/memory_.h"
74 #include "magick/module.h"
75 #include "magick/monitor.h"
76 #include "magick/montage.h"
77 #include "magick/option.h"
78 #include "magick/pixel-private.h"
79 #include "magick/prepress.h"
80 #include "magick/profile.h"
81 #include "magick/property.h"
82 #include "magick/quantize.h"
83 #include "magick/quantum.h"
84 #include "magick/random_.h"
85 #include "magick/registry.h"
86 #include "magick/resize.h"
87 #include "magick/resource_.h"
88 #include "magick/signature.h"
89 #include "magick/statistic.h"
90 #include "magick/string_.h"
91 #include "magick/timer.h"
92 #include "magick/utility.h"
93 #include "magick/version.h"
94 #if defined(MAGICKCORE_LCMS_DELEGATE)
95 #if defined(MAGICKCORE_HAVE_LCMS_LCMS_H)
96 #include <lcms/lcms.h>
103 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
107 % I d e n t i f y I m a g e %
111 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
113 % IdentifyImage() identifies an image by printing its attributes to the file.
114 % Attributes include the image width, height, size, and others.
116 % The format of the IdentifyImage method is:
118 % MagickBooleanType IdentifyImage(Image *image,FILE *file,
119 % const MagickBooleanType verbose)
121 % A description of each parameter follows:
123 % o image: the image.
125 % o file: the file, typically stdout.
127 % o verbose: A value other than zero prints more detailed information
132 MagickExport MagickBooleanType IdentifyImage(Image *image,FILE *file,
133 const MagickBooleanType verbose)
135 #define IdentifyFormat " %s:\n min: " QuantumFormat \
136 " (%g)\n max: " QuantumFormat " (%g)\n" \
137 " mean: %g (%g)\n standard deviation: %g (%g)\n" \
138 " kurtosis: %g\n skewness: %g\n"
141 color[MaxTextExtent],
142 format[MaxTextExtent],
184 assert(image != (Image *) NULL);
185 assert(image->signature == MagickSignature);
186 if (image->debug != MagickFalse)
187 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
188 if (file == (FILE *) NULL)
191 elapsed_time=GetElapsedTime(&image->timer);
192 user_time=GetUserTime(&image->timer);
193 GetTimerInfo(&image->timer);
194 if (verbose == MagickFalse)
197 Display summary info about the image.
199 if (*image->magick_filename != '\0')
200 if (LocaleCompare(image->magick_filename,image->filename) != 0)
201 (void) fprintf(file,"%s=>",image->magick_filename);
202 if ((GetPreviousImageInList(image) == (Image *) NULL) &&
203 (GetNextImageInList(image) == (Image *) NULL) && (image->scene == 0))
204 (void) fprintf(file,"%s ",image->filename);
206 (void) fprintf(file,"%s[%lu] ",image->filename,image->scene);
207 (void) fprintf(file,"%s ",image->magick);
208 if ((image->magick_columns != 0) || (image->magick_rows != 0))
209 if ((image->magick_columns != image->columns) ||
210 (image->magick_rows != image->rows))
211 (void) fprintf(file,"%lux%lu=>",image->magick_columns,
213 (void) fprintf(file,"%lux%lu ",image->columns,image->rows);
214 if ((image->page.width != 0) || (image->page.height != 0) ||
215 (image->page.x != 0) || (image->page.y != 0))
216 (void) fprintf(file,"%lux%lu%+ld%+ld ",image->page.width,
217 image->page.height,image->page.x,image->page.y);
218 (void) fprintf(file,"%lu-bit ",image->depth);
219 if (image->type != UndefinedType)
220 (void) fprintf(file,"%s ",MagickOptionToMnemonic(MagickTypeOptions,
221 (long) image->type));
222 if (image->storage_class == DirectClass)
224 (void) fprintf(file,"DirectClass ");
225 if (image->total_colors != 0)
227 (void) FormatMagickSize(image->total_colors,format);
228 (void) fprintf(file,"%s ",format);
232 if (image->total_colors <= image->colors)
233 (void) fprintf(file,"PseudoClass %luc ",image->colors);
235 (void) fprintf(file,"PseudoClass %lu=>%luc ",image->total_colors,
237 if (image->error.mean_error_per_pixel != 0.0)
238 (void) fprintf(file,"%ld/%f/%fdb ",(long)
239 (image->error.mean_error_per_pixel+0.5),
240 image->error.normalized_mean_error,
241 image->error.normalized_maximum_error);
242 if (GetBlobSize(image) != 0)
244 (void) FormatMagickSize(GetBlobSize(image),format);
245 (void) fprintf(file,"%s ",format);
247 (void) fprintf(file,"%0.3fu %ld:%02ld.%03ld",user_time,(long)
248 (elapsed_time/60.0),(long) floor(fmod(elapsed_time,60.0)),
249 (long) (1000.0*(elapsed_time-floor(elapsed_time))));
250 (void) fprintf(file,"\n");
252 return(ferror(file) != 0 ? MagickFalse : MagickTrue);
255 Display verbose info about the image.
257 exception=AcquireExceptionInfo();
258 pixels=GetVirtualPixels(image,0,0,1,1,exception);
259 exception=DestroyExceptionInfo(exception);
260 ping=pixels == (const PixelPacket *) NULL ? MagickTrue : MagickFalse;
261 type=GetImageType(image,&image->exception);
262 (void) SignatureImage(image);
263 (void) fprintf(file,"Image: %s\n",image->filename);
264 if (*image->magick_filename != '\0')
265 if (LocaleCompare(image->magick_filename,image->filename) != 0)
268 filename[MaxTextExtent];
270 GetPathComponent(image->magick_filename,TailPath,filename);
271 (void) fprintf(file," Base filename: %s\n",filename);
273 magick_info=GetMagickInfo(image->magick,&image->exception);
274 if ((magick_info == (const MagickInfo *) NULL) ||
275 (*GetMagickDescription(magick_info) == '\0'))
276 (void) fprintf(file," Format: %s\n",image->magick);
278 (void) fprintf(file," Format: %s (%s)\n",image->magick,
279 GetMagickDescription(magick_info));
280 (void) fprintf(file," Class: %s\n",MagickOptionToMnemonic(MagickClassOptions,
281 (long) image->storage_class));
282 (void) fprintf(file," Geometry: %lux%lu%+ld%+ld\n",image->columns,
283 image->rows,image->tile_offset.x,image->tile_offset.y);
284 if ((image->magick_columns != 0) || (image->magick_rows != 0))
285 if ((image->magick_columns != image->columns) ||
286 (image->magick_rows != image->rows))
287 (void) fprintf(file," Base geometry: %lux%lu\n",image->magick_columns,
289 if ((image->x_resolution != 0.0) && (image->y_resolution != 0.0))
291 (void) fprintf(file," Resolution: %gx%g\n",image->x_resolution,
292 image->y_resolution);
293 (void) fprintf(file," Print size: %gx%g\n",(double) image->columns/
294 image->x_resolution,(double) image->rows/image->y_resolution);
296 (void) fprintf(file," Units: %s\n",MagickOptionToMnemonic(
297 MagickResolutionOptions,(long) image->units));
298 (void) fprintf(file," Type: %s\n",MagickOptionToMnemonic(MagickTypeOptions,
300 if (image->type != UndefinedType)
301 (void) fprintf(file," Base type: %s\n",MagickOptionToMnemonic(
302 MagickTypeOptions,(long) image->type));
303 (void) fprintf(file," Endianess: %s\n",MagickOptionToMnemonic(
304 MagickEndianOptions,(long) image->endian));
306 Detail channel depth and extrema.
308 (void) fprintf(file," Colorspace: %s\n",MagickOptionToMnemonic(
309 MagickColorspaceOptions,(long) image->colorspace));
310 if (ping == MagickFalse)
318 depth=GetImageDepth(image,&image->exception);
319 if (image->depth == depth)
320 (void) fprintf(file," Depth: %lu-bit\n",image->depth);
322 (void) fprintf(file," Depth: %lu/%lu-bit\n",image->depth,depth);
323 channel_statistics=GetImageChannelStatistics(image,&image->exception);
324 (void) fprintf(file," Channel depth:\n");
325 colorspace=image->colorspace;
326 if (IsGrayImage(image,&image->exception) != MagickFalse)
327 colorspace=GRAYColorspace;
333 (void) fprintf(file," red: %lu-bit\n",
334 channel_statistics[RedChannel].depth);
335 (void) fprintf(file," green: %lu-bit\n",
336 channel_statistics[GreenChannel].depth);
337 (void) fprintf(file," blue: %lu-bit\n",
338 channel_statistics[BlueChannel].depth);
339 if (image->matte != MagickFalse)
340 (void) fprintf(file," alpha: %lu-bit\n",
341 channel_statistics[OpacityChannel].depth);
346 (void) fprintf(file," cyan: %lu-bit\n",
347 channel_statistics[CyanChannel].depth);
348 (void) fprintf(file," magenta: %lu-bit\n",
349 channel_statistics[MagentaChannel].depth);
350 (void) fprintf(file," yellow: %lu-bit\n",
351 channel_statistics[YellowChannel].depth);
352 (void) fprintf(file," black: %lu-bit\n",
353 channel_statistics[BlackChannel].depth);
354 if (image->matte != MagickFalse)
355 (void) fprintf(file," alpha: %lu-bit\n",
356 channel_statistics[OpacityChannel].depth);
361 (void) fprintf(file," gray: %lu-bit\n",
362 channel_statistics[GrayChannel].depth);
363 if (image->matte != MagickFalse)
364 (void) fprintf(file," alpha: %lu-bit\n",
365 channel_statistics[OpacityChannel].depth);
370 if (image->depth <= MAGICKCORE_QUANTUM_DEPTH)
371 scale=QuantumRange/((unsigned long) QuantumRange >> ((unsigned long)
372 MAGICKCORE_QUANTUM_DEPTH-image->depth));
373 (void) fprintf(file," Channel statistics:\n");
379 (void) fprintf(file,IdentifyFormat,"red",(Quantum)
380 (channel_statistics[RedChannel].minima/scale),(double)
381 channel_statistics[RedChannel].minima/(double) QuantumRange,
382 (Quantum) (channel_statistics[RedChannel].maxima/scale),(double)
383 channel_statistics[RedChannel].maxima/(double) QuantumRange,
384 channel_statistics[RedChannel].mean/(double) scale,
385 channel_statistics[RedChannel].mean/(double) QuantumRange,
386 channel_statistics[RedChannel].standard_deviation/(double) scale,
387 channel_statistics[RedChannel].standard_deviation/(double)
388 QuantumRange,channel_statistics[RedChannel].kurtosis,
389 channel_statistics[RedChannel].skewness);
390 (void) fprintf(file,IdentifyFormat,"green",(Quantum)
391 (channel_statistics[GreenChannel].minima/scale),(double)
392 channel_statistics[GreenChannel].minima/(double) QuantumRange,
393 (Quantum) (channel_statistics[GreenChannel].maxima/scale),(double)
394 channel_statistics[GreenChannel].maxima/(double) QuantumRange,
395 channel_statistics[GreenChannel].mean/(double) scale,
396 channel_statistics[GreenChannel].mean/(double) QuantumRange,
397 channel_statistics[GreenChannel].standard_deviation/(double) scale,
398 channel_statistics[GreenChannel].standard_deviation/(double)
400 channel_statistics[GreenChannel].kurtosis,
401 channel_statistics[GreenChannel].skewness);
402 (void) fprintf(file,IdentifyFormat,"blue",(Quantum)
403 (channel_statistics[BlueChannel].minima/scale),(double)
404 channel_statistics[BlueChannel].minima/(double) QuantumRange,
405 (Quantum) (channel_statistics[BlueChannel].maxima/scale),(double)
406 channel_statistics[BlueChannel].maxima/(double) QuantumRange,
407 channel_statistics[BlueChannel].mean/(double) scale,
408 channel_statistics[BlueChannel].mean/(double) QuantumRange,
409 channel_statistics[BlueChannel].standard_deviation/(double) scale,
410 channel_statistics[BlueChannel].standard_deviation/(double)
411 QuantumRange,channel_statistics[BlueChannel].kurtosis,
412 channel_statistics[BlueChannel].skewness);
417 (void) fprintf(file,IdentifyFormat,"cyan",(Quantum)
418 (channel_statistics[CyanChannel].minima/scale),(double)
419 channel_statistics[CyanChannel].minima/(double) QuantumRange,
420 (Quantum) (channel_statistics[CyanChannel].maxima/scale),(double)
421 channel_statistics[CyanChannel].maxima/(double) QuantumRange,
422 channel_statistics[CyanChannel].mean/(double) scale,
423 channel_statistics[CyanChannel].mean/(double) QuantumRange,
424 channel_statistics[CyanChannel].standard_deviation/(double) scale,
425 channel_statistics[CyanChannel].standard_deviation/(double)
426 QuantumRange,channel_statistics[CyanChannel].kurtosis,
427 channel_statistics[CyanChannel].skewness);
428 (void) fprintf(file,IdentifyFormat,"magenta",(Quantum)
429 (channel_statistics[MagentaChannel].minima/scale),(double)
430 channel_statistics[MagentaChannel].minima/(double) QuantumRange,
431 (Quantum) (channel_statistics[MagentaChannel].maxima/scale),(double)
432 channel_statistics[MagentaChannel].maxima/(double) QuantumRange,
433 channel_statistics[MagentaChannel].mean/(double) scale,
434 channel_statistics[MagentaChannel].mean/(double) QuantumRange,
435 channel_statistics[MagentaChannel].standard_deviation/(double)
436 scale,channel_statistics[MagentaChannel].standard_deviation/(double)
437 QuantumRange,channel_statistics[MagentaChannel].kurtosis,
438 channel_statistics[MagentaChannel].skewness);
439 (void) fprintf(file,IdentifyFormat,"yellow",(Quantum)
440 (channel_statistics[YellowChannel].minima/scale),(double)
441 channel_statistics[YellowChannel].minima/(double) QuantumRange,
442 (Quantum) (channel_statistics[YellowChannel].maxima/scale),(double)
443 channel_statistics[YellowChannel].maxima/(double) QuantumRange,
444 channel_statistics[YellowChannel].mean/(double) scale,
445 channel_statistics[YellowChannel].mean/(double) QuantumRange,
446 channel_statistics[YellowChannel].standard_deviation/(double) scale,
447 channel_statistics[YellowChannel].standard_deviation/(double)
448 QuantumRange,channel_statistics[YellowChannel].kurtosis,
449 channel_statistics[YellowChannel].skewness);
450 (void) fprintf(file,IdentifyFormat,"black",(Quantum)
451 (channel_statistics[BlackChannel].minima/scale),(double)
452 channel_statistics[BlackChannel].minima/(double) QuantumRange,
453 (Quantum) (channel_statistics[BlackChannel].maxima/scale),(double)
454 channel_statistics[BlackChannel].maxima/(double) QuantumRange,
455 channel_statistics[BlackChannel].mean/(double) scale,
456 channel_statistics[BlackChannel].mean/(double) QuantumRange,
457 channel_statistics[BlackChannel].standard_deviation/(double) scale,
458 channel_statistics[BlackChannel].standard_deviation/(double)
459 QuantumRange,channel_statistics[BlackChannel].kurtosis,
460 channel_statistics[BlackChannel].skewness);
465 (void) fprintf(file,IdentifyFormat,"gray",(Quantum)
466 (channel_statistics[GrayChannel].minima/scale),(double)
467 channel_statistics[GrayChannel].minima/(double) QuantumRange,
468 (Quantum) (channel_statistics[GrayChannel].maxima/scale),(double)
469 channel_statistics[GrayChannel].maxima/(double) QuantumRange,
470 channel_statistics[GrayChannel].mean/(double) scale,
471 channel_statistics[GrayChannel].mean/(double) QuantumRange,
472 channel_statistics[GrayChannel].standard_deviation/(double) scale,
473 channel_statistics[GrayChannel].standard_deviation/(double)
474 QuantumRange,channel_statistics[GrayChannel].kurtosis,
475 channel_statistics[GrayChannel].skewness);
479 if (image->matte != MagickFalse)
480 (void) fprintf(file,IdentifyFormat,"alpha",(Quantum)
481 ((QuantumRange-channel_statistics[AlphaChannel].maxima)/scale),
482 (double) (QuantumRange-channel_statistics[AlphaChannel].maxima)/
483 (double) QuantumRange, (Quantum) ((QuantumRange-
484 channel_statistics[AlphaChannel].minima)/scale),(double)
485 (QuantumRange-channel_statistics[AlphaChannel].minima)/(double)
486 QuantumRange,(QuantumRange-channel_statistics[AlphaChannel].mean)/
487 (double) scale,(QuantumRange-channel_statistics[AlphaChannel].mean)/
488 (double) QuantumRange,
489 channel_statistics[AlphaChannel].standard_deviation/(double) scale,
490 channel_statistics[AlphaChannel].standard_deviation/(double)
491 QuantumRange,channel_statistics[AlphaChannel].kurtosis,
492 channel_statistics[AlphaChannel].skewness);
493 if (colorspace != GRAYColorspace)
495 (void) fprintf(file," Image statistics:\n");
496 (void) fprintf(file,IdentifyFormat,"Overall",(Quantum)
497 (channel_statistics[AllChannels].minima/scale),(double)
498 channel_statistics[AllChannels].minima/(double) QuantumRange,
499 (Quantum) (channel_statistics[AllChannels].maxima/scale),(double)
500 channel_statistics[AllChannels].maxima/(double) QuantumRange,
501 channel_statistics[AllChannels].mean/(double) scale,
502 channel_statistics[AllChannels].mean/(double) QuantumRange,
503 channel_statistics[AllChannels].standard_deviation/(double) scale,
504 channel_statistics[AllChannels].standard_deviation/(double)
505 QuantumRange,channel_statistics[AllChannels].kurtosis,
506 channel_statistics[AllChannels].skewness);
508 channel_statistics=(ChannelStatistics *) RelinquishMagickMemory(
510 if (image->colorspace == CMYKColorspace)
511 (void) fprintf(file," Total ink density: %.0f%%\n",100.0*
512 GetImageTotalInkDensity(image)/(double) QuantumRange);
514 if (image->matte != MagickFalse)
516 register const IndexPacket
519 register const PixelPacket
522 p=(PixelPacket *) NULL;
523 indexes=(IndexPacket *) NULL;
524 for (y=0; y < (long) image->rows; y++)
526 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
527 if (p == (const PixelPacket *) NULL)
529 indexes=GetVirtualIndexQueue(image);
530 for (x=0; x < (long) image->columns; x++)
532 if (p->opacity == (Quantum) TransparentOpacity)
536 if (x < (long) image->columns)
539 if ((x < (long) image->columns) || (y < (long) image->rows))
542 tuple[MaxTextExtent];
547 GetMagickPixelPacket(image,&pixel);
548 SetMagickPixelPacket(image,p,indexes+x,&pixel);
549 (void) QueryMagickColorname(image,&pixel,SVGCompliance,tuple,
551 (void) fprintf(file," Alpha: %s ",tuple);
552 GetColorTuple(&pixel,MagickTrue,tuple);
553 (void) fprintf(file," %s\n",tuple);
556 if (ping == MagickFalse)
558 artifact=GetImageArtifact(image,"identify:unique");
559 if ((artifact != (const char *) NULL) &&
560 (IsMagickTrue(artifact) != MagickFalse))
561 (void) fprintf(file," Colors: %lu\n",GetNumberColors(image,
562 (FILE *) NULL,&image->exception));
563 if (IsHistogramImage(image,&image->exception) != MagickFalse)
565 (void) fprintf(file," Histogram:\n");
566 (void) GetNumberColors(image,file,&image->exception);
570 if (image->storage_class == PseudoClass)
572 (void) fprintf(file," Colormap: %lu\n",image->colors);
573 if (image->colors <= 1024)
576 color[MaxTextExtent],
578 tuple[MaxTextExtent];
586 GetMagickPixelPacket(image,&pixel);
588 for (i=0; i < (long) image->colors; i++)
590 SetMagickPixelPacket(image,p,(IndexPacket *) NULL,&pixel);
591 (void) CopyMagickString(tuple,"(",MaxTextExtent);
592 ConcatenateColorComponent(&pixel,RedChannel,X11Compliance,tuple);
593 (void) ConcatenateMagickString(tuple,",",MaxTextExtent);
594 ConcatenateColorComponent(&pixel,GreenChannel,X11Compliance,tuple);
595 (void) ConcatenateMagickString(tuple,",",MaxTextExtent);
596 ConcatenateColorComponent(&pixel,BlueChannel,X11Compliance,tuple);
597 if (pixel.colorspace == CMYKColorspace)
599 (void) ConcatenateMagickString(tuple,",",MaxTextExtent);
600 ConcatenateColorComponent(&pixel,IndexChannel,X11Compliance,
603 if (pixel.matte != MagickFalse)
605 (void) ConcatenateMagickString(tuple,",",MaxTextExtent);
606 ConcatenateColorComponent(&pixel,OpacityChannel,X11Compliance,
609 (void) ConcatenateMagickString(tuple,")",MaxTextExtent);
610 (void) QueryMagickColorname(image,&pixel,SVGCompliance,color,
612 GetColorTuple(&pixel,MagickTrue,hex);
613 (void) fprintf(file," %8ld: %s %s %s\n",i,tuple,hex,color);
618 if (image->error.mean_error_per_pixel != 0.0)
619 (void) fprintf(file," Mean error per pixel: %g\n",
620 image->error.mean_error_per_pixel);
621 if (image->error.normalized_mean_error != 0.0)
622 (void) fprintf(file," Normalized mean error: %g\n",
623 image->error.normalized_mean_error);
624 if (image->error.normalized_maximum_error != 0.0)
625 (void) fprintf(file," Normalized maximum error: %g\n",
626 image->error.normalized_maximum_error);
627 (void) fprintf(file," Rendering intent: %s\n",MagickOptionToMnemonic(
628 MagickIntentOptions,(long) image->rendering_intent));
629 if (image->gamma != 0.0)
630 (void) fprintf(file," Gamma: %g\n",image->gamma);
631 if ((image->chromaticity.red_primary.x != 0.0) ||
632 (image->chromaticity.green_primary.x != 0.0) ||
633 (image->chromaticity.blue_primary.x != 0.0) ||
634 (image->chromaticity.white_point.x != 0.0))
637 Display image chromaticity.
639 (void) fprintf(file," Chromaticity:\n");
640 (void) fprintf(file," red primary: (%g,%g)\n",
641 image->chromaticity.red_primary.x,image->chromaticity.red_primary.y);
642 (void) fprintf(file," green primary: (%g,%g)\n",
643 image->chromaticity.green_primary.x,
644 image->chromaticity.green_primary.y);
645 (void) fprintf(file," blue primary: (%g,%g)\n",
646 image->chromaticity.blue_primary.x,image->chromaticity.blue_primary.y);
647 (void) fprintf(file," white point: (%g,%g)\n",
648 image->chromaticity.white_point.x,image->chromaticity.white_point.y);
650 if ((image->extract_info.width*image->extract_info.height) != 0)
651 (void) fprintf(file," Tile geometry: %lux%lu%+ld%+ld\n",
652 image->extract_info.width,image->extract_info.height,
653 image->extract_info.x,image->extract_info.y);
654 (void) fprintf(file," Interlace: %s\n",MagickOptionToMnemonic(
655 MagickInterlaceOptions,(long) image->interlace));
656 (void) QueryColorname(image,&image->background_color,SVGCompliance,color,
658 (void) fprintf(file," Background color: %s\n",color);
659 (void) QueryColorname(image,&image->border_color,SVGCompliance,color,
661 (void) fprintf(file," Border color: %s\n",color);
662 (void) QueryColorname(image,&image->matte_color,SVGCompliance,color,
664 (void) fprintf(file," Matte color: %s\n",color);
665 (void) QueryColorname(image,&image->transparent_color,SVGCompliance,color,
667 (void) fprintf(file," Transparent color: %s\n",color);
668 (void) fprintf(file," Compose: %s\n",MagickOptionToMnemonic(
669 MagickComposeOptions,(long) image->compose));
670 if ((image->page.width != 0) || (image->page.height != 0) ||
671 (image->page.x != 0) || (image->page.y != 0))
672 (void) fprintf(file," Page geometry: %lux%lu%+ld%+ld\n",image->page.width,
673 image->page.height,image->page.x,image->page.y);
674 if ((image->page.x != 0) || (image->page.y != 0))
675 (void) fprintf(file," Origin geometry: %+ld%+ld\n",image->page.x,
677 (void) fprintf(file," Dispose: %s\n",MagickOptionToMnemonic(
678 MagickDisposeOptions,(long) image->dispose));
679 if (image->delay != 0)
680 (void) fprintf(file," Delay: %lux%ld\n",image->delay,
681 image->ticks_per_second);
682 if (image->iterations != 1)
683 (void) fprintf(file," Iterations: %lu\n",image->iterations);
684 if ((image->next != (Image *) NULL) || (image->previous != (Image *) NULL))
685 (void) fprintf(file," Scene: %lu of %lu\n",image->scene,
686 GetImageListLength(image));
688 if (image->scene != 0)
689 (void) fprintf(file," Scene: %lu\n",image->scene);
690 (void) fprintf(file," Compression: %s\n",MagickOptionToMnemonic(
691 MagickCompressOptions,(long) image->compression));
692 if (image->quality != UndefinedCompressionQuality)
693 (void) fprintf(file," Quality: %lu\n",image->quality);
694 (void) fprintf(file," Orientation: %s\n",MagickOptionToMnemonic(
695 MagickOrientationOptions,(long) image->orientation));
696 if (image->montage != (char *) NULL)
697 (void) fprintf(file," Montage: %s\n",image->montage);
698 if (image->directory != (char *) NULL)
714 Display visual image directory.
716 image_info=AcquireImageInfo();
717 (void) CloneString(&image_info->size,"64x64");
718 (void) fprintf(file," Directory:\n");
719 for (p=image->directory; *p != '\0'; p++)
722 while ((*q != '\n') && (*q != '\0'))
724 (void) CopyMagickString(image_info->filename,p,(size_t) (q-p+1));
726 (void) fprintf(file," %s",image_info->filename);
727 handler=SetWarningHandler((WarningHandler) NULL);
728 tile=ReadImage(image_info,&image->exception);
729 (void) SetWarningHandler(handler);
730 if (tile == (Image *) NULL)
732 (void) fprintf(file,"\n");
735 (void) fprintf(file," %lux%lu %s\n",tile->magick_columns,
736 tile->magick_rows,tile->magick);
737 (void) SignatureImage(tile);
738 ResetImagePropertyIterator(tile);
739 property=GetNextImageProperty(tile);
740 while (property != (const char *) NULL)
742 (void) fprintf(file," %s:\n",property);
743 value=GetImageProperty(tile,property);
744 if (value != (const char *) NULL)
745 (void) fprintf(file,"%s\n",value);
746 property=GetNextImageProperty(tile);
748 tile=DestroyImage(tile);
750 image_info=DestroyImageInfo(image_info);
752 (void) GetImageProperty(image,"exif:*");
753 ResetImagePropertyIterator(image);
754 property=GetNextImageProperty(image);
755 if (property != (const char *) NULL)
758 Display image properties.
760 (void) fprintf(file," Properties:\n");
761 while (property != (const char *) NULL)
763 (void) fprintf(file," %c",*property);
764 if (strlen(property) > 1)
765 (void) fprintf(file,"%s: ",property+1);
766 if (strlen(property) > 80)
767 (void) fputc('\n',file);
768 value=GetImageProperty(image,property);
769 if (value != (const char *) NULL)
770 (void) fprintf(file,"%s\n",value);
771 property=GetNextImageProperty(image);
774 (void) FormatMagickString(key,MaxTextExtent,"8BIM:1999,2998:#1");
775 value=GetImageProperty(image,key);
776 if (value != (const char *) NULL)
779 Display clipping path.
781 (void) fprintf(file," Clipping path: ");
782 if (strlen(value) > 80)
783 (void) fputc('\n',file);
784 (void) fprintf(file,"%s\n",value);
786 ResetImageProfileIterator(image);
787 name=GetNextImageProfile(image);
788 if (name != (char *) NULL)
794 Identify image profiles.
796 (void) fprintf(file," Profiles:\n");
797 while (name != (char *) NULL)
799 profile=GetImageProfile(image,name);
800 if (profile == (StringInfo *) NULL)
802 (void) fprintf(file," Profile-%s: %lu bytes\n",name,(unsigned long)
803 GetStringInfoLength(profile));
804 #if defined(MAGICKCORE_LCMS_DELEGATE)
805 if ((LocaleCompare(name,"icc") == 0) ||
806 (LocaleCompare(name,"icm") == 0))
811 icc_profile=cmsOpenProfileFromMem(GetStringInfoDatum(profile),
812 (DWORD) GetStringInfoLength(profile));
813 if (icc_profile != (cmsHPROFILE *) NULL)
818 name=cmsTakeProductName(icc_profile);
819 if (name != (const char *) NULL)
820 (void) fprintf(file," %s\n",name);
821 (void) cmsCloseProfile(icc_profile);
825 if (LocaleCompare(name,"iptc") == 0)
846 profile_length=GetStringInfoLength(profile);
847 for (i=0; i < (long) profile_length; i+=(long) length)
850 sentinel=GetStringInfoDatum(profile)[i++];
851 if (sentinel != 0x1c)
853 dataset=GetStringInfoDatum(profile)[i++];
854 record=GetStringInfoDatum(profile)[i++];
857 case 5: tag="Image Name"; break;
858 case 7: tag="Edit Status"; break;
859 case 10: tag="Priority"; break;
860 case 15: tag="Category"; break;
861 case 20: tag="Supplemental Category"; break;
862 case 22: tag="Fixture Identifier"; break;
863 case 25: tag="Keyword"; break;
864 case 30: tag="Release Date"; break;
865 case 35: tag="Release Time"; break;
866 case 40: tag="Special Instructions"; break;
867 case 45: tag="Reference Service"; break;
868 case 47: tag="Reference Date"; break;
869 case 50: tag="Reference Number"; break;
870 case 55: tag="Created Date"; break;
871 case 60: tag="Created Time"; break;
872 case 65: tag="Originating Program"; break;
873 case 70: tag="Program Version"; break;
874 case 75: tag="Object Cycle"; break;
875 case 80: tag="Byline"; break;
876 case 85: tag="Byline Title"; break;
877 case 90: tag="City"; break;
878 case 95: tag="Province State"; break;
879 case 100: tag="Country Code"; break;
880 case 101: tag="Country"; break;
881 case 103: tag="Original Transmission Reference"; break;
882 case 105: tag="Headline"; break;
883 case 110: tag="Credit"; break;
884 case 115: tag="Src"; break;
885 case 116: tag="Copyright String"; break;
886 case 120: tag="Caption"; break;
887 case 121: tag="Local Caption"; break;
888 case 122: tag="Caption Writer"; break;
889 case 200: tag="Custom Field 1"; break;
890 case 201: tag="Custom Field 2"; break;
891 case 202: tag="Custom Field 3"; break;
892 case 203: tag="Custom Field 4"; break;
893 case 204: tag="Custom Field 5"; break;
894 case 205: tag="Custom Field 6"; break;
895 case 206: tag="Custom Field 7"; break;
896 case 207: tag="Custom Field 8"; break;
897 case 208: tag="Custom Field 9"; break;
898 case 209: tag="Custom Field 10"; break;
899 case 210: tag="Custom Field 11"; break;
900 case 211: tag="Custom Field 12"; break;
901 case 212: tag="Custom Field 13"; break;
902 case 213: tag="Custom Field 14"; break;
903 case 214: tag="Custom Field 15"; break;
904 case 215: tag="Custom Field 16"; break;
905 case 216: tag="Custom Field 17"; break;
906 case 217: tag="Custom Field 18"; break;
907 case 218: tag="Custom Field 19"; break;
908 case 219: tag="Custom Field 20"; break;
909 default: tag="unknown"; break;
911 (void) fprintf(file," %s[%ld,%ld]: ",tag,dataset,record);
912 length=(size_t) (GetStringInfoDatum(profile)[i++] << 8);
913 length|=GetStringInfoDatum(profile)[i++];
914 attribute=(char *) NULL;
915 if (~length >= MaxTextExtent)
916 attribute=(char *) AcquireQuantumMemory(length+
917 MaxTextExtent,sizeof(*attribute));
918 if (attribute != (char *) NULL)
920 (void) CopyMagickString(attribute,(char *)
921 GetStringInfoDatum(profile)+i,length+1);
922 attribute_list=StringToList(attribute);
923 if (attribute_list != (char **) NULL)
925 for (j=0; attribute_list[j] != (char *) NULL; j++)
927 (void) fputs(attribute_list[j],file);
928 (void) fputs("\n",file);
929 attribute_list[j]=(char *) RelinquishMagickMemory(
932 attribute_list=(char **) RelinquishMagickMemory(
935 attribute=DestroyString(attribute);
939 if (image->debug != MagickFalse)
940 PrintStringInfo(file,name,profile);
941 name=GetNextImageProfile(image);
944 ResetImageArtifactIterator(image);
945 artifact=GetNextImageArtifact(image);
946 if (artifact != (const char *) NULL)
949 Display image artifacts.
951 (void) fprintf(file," Artifacts:\n");
952 while (artifact != (const char *) NULL)
954 (void) fprintf(file," %c",*artifact);
955 if (strlen(artifact) > 1)
956 (void) fprintf(file,"%s: ",artifact+1);
957 if (strlen(artifact) > 80)
958 (void) fputc('\n',file);
959 value=GetImageArtifact(image,artifact);
960 if (value != (const char *) NULL)
961 (void) fprintf(file,"%s\n",value);
962 artifact=GetNextImageArtifact(image);
965 ResetImageRegistryIterator();
966 registry=GetNextImageRegistry();
967 if (registry != (const char *) NULL)
970 Display image registry.
972 (void) fprintf(file," Registry:\n");
973 while (registry != (const char *) NULL)
975 (void) fprintf(file," %c",*registry);
976 if (strlen(registry) > 1)
977 (void) fprintf(file,"%s: ",registry+1);
978 if (strlen(registry) > 80)
979 (void) fputc('\n',file);
980 value=(const char *) GetImageRegistry(StringRegistryType,registry,
982 if (value != (const char *) NULL)
983 (void) fprintf(file,"%s\n",value);
984 registry=GetNextImageRegistry();
987 (void) fprintf(file," Tainted: %s\n",MagickOptionToMnemonic(
988 MagickBooleanOptions,(long) image->taint));
989 (void) FormatMagickSize(GetBlobSize(image),format);
990 (void) fprintf(file," Filesize: %s\n",format);
991 (void) FormatMagickSize((MagickSizeType) image->columns*image->rows,format);
992 (void) fprintf(file," Number pixels: %s\n",format);
993 (void) FormatMagickSize((MagickSizeType) ((double) image->columns*image->rows/
994 elapsed_time+0.5),format);
995 (void) fprintf(file," Pixels per second: %s\n",format);
996 (void) fprintf(file," User time: %0.3fu\n",user_time);
997 (void) fprintf(file," Elapsed time: %ld:%02ld.%03ld\n",(long)
998 (elapsed_time/60.0),(long) ceil(fmod(elapsed_time,60.0)),(long)
999 (1000.0*(elapsed_time-floor(elapsed_time))));
1000 (void) fprintf(file," Version: %s\n",GetMagickVersion((unsigned long *)
1002 (void) fflush(file);
1003 return(ferror(file) != 0 ? MagickFalse : MagickTrue);