blob: 7740722a9f83404acdd5e206ff28855374951a5f [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% %
cristy7e41fe82010-12-04 23:12:08 +000020% Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization %
cristy3ed852e2009-09-05 21:47:34 +000021% 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*/
cristyee678102011-07-01 23:32:11 +000045#include "MagickWand/studio.h"
46#include "MagickWand/MagickWand.h"
cristy3ed852e2009-09-05 21:47:34 +000047
48/*
49%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
50% %
51% %
52% %
53% M a i n %
54% %
55% %
56% %
57%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
58%
59%
60*/
cristy66f9c3c2011-08-13 17:12:28 +000061
cristy9c88feb2011-09-21 13:06:09 +000062static int IdentifyMain(int argc,char **argv)
cristy3ed852e2009-09-05 21:47:34 +000063{
64 char
cristy3980b0d2009-10-25 14:37:13 +000065 *metadata;
cristy3ed852e2009-09-05 21:47:34 +000066
67 ExceptionInfo
68 *exception;
69
70 ImageInfo
71 *image_info;
72
73 MagickBooleanType
cristy3ed852e2009-09-05 21:47:34 +000074 status;
75
cristy3ed852e2009-09-05 21:47:34 +000076 MagickCoreGenesis(*argv,MagickTrue);
77 exception=AcquireExceptionInfo();
cristy3980b0d2009-10-25 14:37:13 +000078 image_info=AcquireImageInfo();
79 metadata=(char *) NULL;
80 status=MagickCommandGenesis(image_info,IdentifyImageCommand,argc,argv,
81 &metadata,exception);
82 if (metadata != (char *) NULL)
83 metadata=DestroyString(metadata);
84 image_info=DestroyImageInfo(image_info);
cristy3ed852e2009-09-05 21:47:34 +000085 exception=DestroyExceptionInfo(exception);
86 MagickCoreTerminus();
cristy3980b0d2009-10-25 14:37:13 +000087 return(status);
cristy3ed852e2009-09-05 21:47:34 +000088}
cristy66f9c3c2011-08-13 17:12:28 +000089
90#if !defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__CYGWIN__) || defined(__MINGW32__)
91int main(int argc,char **argv)
92{
93 return(IdentifyMain(argc,argv));
94}
95#else
96int wmain(int argc,wchar_t *argv[])
97{
98 char
99 **utf8;
100
101 int
102 status;
103
104 register int
105 i;
106
107 utf8=NTArgvToUTF8(argc,argv);
108 status=IdentifyMain(argc,utf8);
109 for (i=0; i < argc; i++)
110 utf8[i]=DestroyString(utf8[i]);
111 utf8=(char **) RelinquishMagickMemory(utf8);
112 return(status);
113}
114#endif