blob: 52f4724834de84b56f11a72bff8f7f1ce8f299d1 [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-2009 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% The identify program describes the format and characteristics of one or more
37% image files. It also reports if an image is incomplete or corrupt. The
38% information returned includes the image number, the file name, the width and
39% height of the image, whether the image is colormapped or not, the number of
40% colors in the image, the number of bytes in the image, the format of the
41% image (JPEG, PNM, etc.), and finally the number of seconds it took to read
42% and process the image. Many more attributes are available with the verbose
43% option.
44%
45*/
46
47/*
48 Include declarations.
49*/
50#include "wand/studio.h"
51#include "wand/MagickWand.h"
52#include "wand/mogrify-private.h"
53
54/*
55%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
56% %
57% %
58% %
59+ I d e n t i f y I m a g e C o m m a n d %
60% %
61% %
62% %
63%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
64%
65% IdentifyImageCommand() describes the format and characteristics of one or
66% more image files. It will also report if an image is incomplete or corrupt.
67% The information displayed includes the scene number, the file name, the
68% width and height of the image, whether the image is colormapped or not,
69% the number of colors in the image, the number of bytes in the image, the
70% format of the image (JPEG, PNM, etc.), and finally the number of seconds
71% it took to read and process the image.
72%
73% The format of the IdentifyImageCommand method is:
74%
75% MagickBooleanType IdentifyImageCommand(ImageInfo *image_info,int argc,
76% char **argv,char **metadata,ExceptionInfo *exception)
77%
78% A description of each parameter follows:
79%
80% o image_info: the image info.
81%
82% o argc: the number of elements in the argument vector.
83%
84% o argv: A text array containing the command line arguments.
85%
86% o metadata: any metadata is returned here.
87%
88% o exception: return any errors or warnings in this structure.
89%
90*/
91
92static MagickBooleanType IdentifyUsage(void)
93{
94 const char
95 **p;
96
97 static const char
98 *miscellaneous[]=
99 {
100 "-debug events display copious debugging information",
101 "-help print program options",
102 "-list type print a list of supported option arguments",
103 "-log format format of debugging information",
104 "-version print version information",
105 (char *) NULL
106 },
107 *settings[]=
108 {
109 "-alpha option on, activate, off, deactivate, set, opaque, copy",
110 " transparent, extract, background, or shape",
111 "-antialias remove pixel-aliasing",
112 "-authenticate password",
113 " decipher image with this password",
114 "-channel type apply option to select image channels",
115 "-colorspace type alternate image colorspace",
116 "-crop geometry cut out a rectangular region of the image",
117 "-define format:option",
118 " define one or more image format options",
119 "-density geometry horizontal and vertical density of the image",
120 "-depth value image depth",
121 "-extract geometry extract area from image",
122 "-format \"string\" output formatted image characteristics",
123 "-fuzz distance colors within this distance are considered equal",
124 "-gamma value level of gamma correction",
125 "-interlace type type of image interlacing scheme",
126 "-interpolate method pixel color interpolation method",
127 "-limit type value pixel cache resource limit",
128 "-monitor monitor progress",
129 "-ping efficiently determine image attributes",
130 "-quiet suppress all warning messages",
131 "-regard-warnings pay attention to warning messages",
132 "-respect-parentheses settings remain in effect until parenthesis boundary",
133 "-sampling-factor geometry",
134 " horizontal and vertical sampling factor",
135 "-seed value seed a new sequence of pseudo-random numbers",
136 "-set attribute value set an image attribute",
137 "-size geometry width and height of image",
138 "-strip strip image of all profiles and comments",
139 "-units type the units of image resolution",
140 "-verbose print detailed information about the image",
141 "-virtual-pixel method",
142 " virtual pixel access method",
143 (char *) NULL
144 };
145
146 (void) printf("Version: %s\n",GetMagickVersion((unsigned long *) NULL));
cristy610b2e22009-10-22 14:59:43 +0000147 (void) printf("Copyright: %s\n",GetMagickCopyright());
148 (void) printf("Features: %s\n\n",GetMagickFeatures());
cristy3ed852e2009-09-05 21:47:34 +0000149 (void) printf("Usage: %s [options ...] file [ [options ...] "
150 "file ... ]\n",GetClientName());
151 (void) printf("\nImage Settings:\n");
152 for (p=settings; *p != (char *) NULL; p++)
153 (void) printf(" %s\n",*p);
154 (void) printf("\nMiscellaneous Options:\n");
155 for (p=miscellaneous; *p != (char *) NULL; p++)
156 (void) printf(" %s\n",*p);
157 (void) printf(
158 "\nBy default, the image format of `file' is determined by its magic\n");
159 (void) printf(
160 "number. To specify a particular image format, precede the filename\n");
161 (void) printf(
162 "with an image format name and a colon (i.e. ps:image) or specify the\n");
163 (void) printf(
164 "image type as the filename suffix (i.e. image.ps). Specify 'file' as\n");
165 (void) printf("'-' for standard input or output.\n");
166 return(MagickFalse);
167}
168
169WandExport MagickBooleanType IdentifyImageCommand(ImageInfo *image_info,
170 int argc,char **argv,char **metadata,ExceptionInfo *exception)
171{
172#define DestroyIdentify() \
173{ \
174 DestroyImageStack(); \
175 for (i=0; i < (long) argc; i++) \
176 argv[i]=DestroyString(argv[i]); \
177 argv=(char **) RelinquishMagickMemory(argv); \
178}
179#define ThrowIdentifyException(asperity,tag,option) \
180{ \
181 (void) ThrowMagickException(exception,GetMagickModule(),asperity,tag,"`%s'", \
182 option); \
183 DestroyIdentify(); \
184 return(MagickFalse); \
185}
186#define ThrowIdentifyInvalidArgumentException(option,argument) \
187{ \
188 (void) ThrowMagickException(exception,GetMagickModule(),OptionError, \
189 "InvalidArgument","`%s': %s",option,argument); \
190 DestroyIdentify(); \
191 return(MagickFalse); \
192}
193
194 const char
195 *format,
196 *option;
197
198 Image
199 *image;
200
201 ImageStack
202 image_stack[MaxImageStackDepth+1];
203
204 long
205 j,
206 k;
207
208 MagickBooleanType
209 fire,
210 pend;
211
212 MagickStatusType
213 status;
214
215 register long
216 i;
217
218 unsigned long
219 count;
220
221 /*
222 Set defaults.
223 */
224 assert(image_info != (ImageInfo *) NULL);
225 assert(image_info->signature == MagickSignature);
226 if (image_info->debug != MagickFalse)
227 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
228 assert(exception != (ExceptionInfo *) NULL);
229 if (argc == 2)
230 {
231 option=argv[1];
232 if ((LocaleCompare("version",option+1) == 0) ||
233 (LocaleCompare("-version",option+1) == 0))
234 {
235 (void) fprintf(stdout,"Version: %s\n",
236 GetMagickVersion((unsigned long *) NULL));
237 (void) fprintf(stdout,"Copyright: %s\n\n",GetMagickCopyright());
238 return(MagickFalse);
239 }
240 }
241 if (argc < 2)
242 {
243 (void) IdentifyUsage();
244 return(MagickTrue);
245 }
246 count=0;
247 format=NULL;
248 j=1;
249 k=0;
250 NewImageStack();
251 option=(char *) NULL;
252 pend=MagickFalse;
253 status=MagickTrue;
254 /*
255 Identify an image.
256 */
257 ReadCommandlLine(argc,&argv);
258 status=ExpandFilenames(&argc,&argv);
259 if (status == MagickFalse)
260 ThrowIdentifyException(ResourceLimitError,"MemoryAllocationFailed",
261 GetExceptionMessage(errno));
262 image_info->ping=MagickTrue;
263 for (i=1; i < (long) argc; i++)
264 {
265 option=argv[i];
266 if (LocaleCompare(option,"(") == 0)
267 {
268 FireImageStack(MagickFalse,MagickTrue,pend);
269 if (k == MaxImageStackDepth)
270 ThrowIdentifyException(OptionError,"ParenthesisNestedTooDeeply",
271 option);
272 PushImageStack();
273 continue;
274 }
275 if (LocaleCompare(option,")") == 0)
276 {
277 FireImageStack(MagickFalse,MagickTrue,MagickTrue);
278 if (k == 0)
279 ThrowIdentifyException(OptionError,"UnableToParseExpression",option);
280 PopImageStack();
281 continue;
282 }
283 if (IsMagickOption(option) == MagickFalse)
284 {
285 char
286 *filename;
287
288 Image
289 *images;
290
291 ImageInfo
292 *identify_info;
293
294 /*
295 Read input image.
296 */
297 FireImageStack(MagickFalse,MagickFalse,pend);
298 identify_info=CloneImageInfo(image_info);
299 identify_info->verbose=MagickFalse;
300 filename=argv[i];
301 if ((LocaleCompare(filename,"--") == 0) && (i < (argc-1)))
302 filename=argv[++i];
303 (void) CopyMagickString(identify_info->filename,filename,MaxTextExtent);
304 if (identify_info->ping != MagickFalse)
305 images=PingImages(identify_info,exception);
306 else
307 images=ReadImages(identify_info,exception);
308 identify_info=DestroyImageInfo(identify_info);
309 status&=(images != (Image *) NULL) &&
310 (exception->severity < ErrorException);
311 if (images == (Image *) NULL)
312 continue;
313 AppendImageStack(images);
314 FinalizeImageSettings(image_info,image,MagickFalse);
315 for ( ; image != (Image *) NULL; image=GetNextImageInList(image))
316 {
317 if (image->scene == 0)
318 image->scene=count++;
319 if (format == (char *) NULL)
320 {
321 (void) IdentifyImage(image,stdout,image_info->verbose);
322 continue;
323 }
324 if (metadata != (char **) NULL)
325 {
326 char
327 *text;
328
329 text=InterpretImageProperties(image_info,image,format);
330 if (text == (char *) NULL)
331 ThrowIdentifyException(ResourceLimitError,
332 "MemoryAllocationFailed",GetExceptionMessage(errno));
333 (void) ConcatenateString(&(*metadata),text);
334 text=DestroyString(text);
335 if (LocaleCompare(format,"%n") == 0)
336 break;
337 }
338 }
339 RemoveAllImageStack();
340 continue;
341 }
342 pend=image != (Image *) NULL ? MagickTrue : MagickFalse;
343 switch (*(option+1))
344 {
345 case 'a':
346 {
347 if (LocaleCompare("alpha",option+1) == 0)
348 {
349 long
350 type;
351
352 if (*option == '+')
353 break;
354 i++;
355 if (i == (long) argc)
356 ThrowIdentifyException(OptionError,"MissingArgument",option);
357 type=ParseMagickOption(MagickAlphaOptions,MagickFalse,argv[i]);
358 if (type < 0)
359 ThrowIdentifyException(OptionError,"UnrecognizedAlphaChannelType",
360 argv[i]);
361 break;
362 }
363 if (LocaleCompare("antialias",option+1) == 0)
364 break;
365 if (LocaleCompare("authenticate",option+1) == 0)
366 {
367 if (*option == '+')
368 break;
369 i++;
370 if (i == (long) (argc-1))
371 ThrowIdentifyException(OptionError,"MissingArgument",option);
372 break;
373 }
374 ThrowIdentifyException(OptionError,"UnrecognizedOption",option)
375 }
376 case 'c':
377 {
378 if (LocaleCompare("cache",option+1) == 0)
379 {
380 if (*option == '+')
381 break;
382 i++;
383 if (i == (long) argc)
384 ThrowIdentifyException(OptionError,"MissingArgument",option);
385 if (IsGeometry(argv[i]) == MagickFalse)
386 ThrowIdentifyInvalidArgumentException(option,argv[i]);
387 break;
388 }
389 if (LocaleCompare("channel",option+1) == 0)
390 {
391 long
392 channel;
393
394 if (*option == '+')
395 break;
396 i++;
397 if (i == (long) (argc-1))
398 ThrowIdentifyException(OptionError,"MissingArgument",option);
399 channel=ParseChannelOption(argv[i]);
400 if (channel < 0)
401 ThrowIdentifyException(OptionError,"UnrecognizedChannelType",
402 argv[i]);
403 break;
404 }
405 if (LocaleCompare("colorspace",option+1) == 0)
406 {
407 long
408 colorspace;
409
410 if (*option == '+')
411 break;
412 i++;
413 if (i == (long) (argc-1))
414 ThrowIdentifyException(OptionError,"MissingArgument",option);
415 colorspace=ParseMagickOption(MagickColorspaceOptions,
416 MagickFalse,argv[i]);
417 if (colorspace < 0)
418 ThrowIdentifyException(OptionError,"UnrecognizedColorspace",
419 argv[i]);
420 break;
421 }
422 if (LocaleCompare("crop",option+1) == 0)
423 {
424 if (*option == '+')
425 break;
426 i++;
427 if (i == (long) (argc-1))
428 ThrowIdentifyException(OptionError,"MissingArgument",option);
429 if (IsGeometry(argv[i]) == MagickFalse)
430 ThrowIdentifyInvalidArgumentException(option,argv[i]);
431 image_info->ping=MagickFalse;
432 break;
433 }
434 ThrowIdentifyException(OptionError,"UnrecognizedOption",option)
435 }
436 case 'd':
437 {
438 if (LocaleCompare("debug",option+1) == 0)
439 {
440 long
441 event;
442
443 if (*option == '+')
444 break;
445 i++;
446 if (i == (long) argc)
447 ThrowIdentifyException(OptionError,"MissingArgument",option);
448 event=ParseMagickOption(MagickLogEventOptions,MagickFalse,argv[i]);
449 if (event < 0)
450 ThrowIdentifyException(OptionError,"UnrecognizedEventType",
451 argv[i]);
452 (void) SetLogEventMask(argv[i]);
453 break;
454 }
455 if (LocaleCompare("define",option+1) == 0)
456 {
457 i++;
458 if (i == (long) argc)
459 ThrowIdentifyException(OptionError,"MissingArgument",option);
460 if (*option == '+')
461 {
462 const char
463 *define;
464
465 define=GetImageOption(image_info,argv[i]);
466 if (define == (const char *) NULL)
467 ThrowIdentifyException(OptionError,"NoSuchOption",argv[i]);
468 break;
469 }
470 break;
471 }
472 if (LocaleCompare("density",option+1) == 0)
473 {
474 if (*option == '+')
475 break;
476 i++;
477 if (i == (long) argc)
478 ThrowIdentifyException(OptionError,"MissingArgument",option);
479 if (IsGeometry(argv[i]) == MagickFalse)
480 ThrowIdentifyInvalidArgumentException(option,argv[i]);
481 break;
482 }
483 if (LocaleCompare("depth",option+1) == 0)
484 {
485 if (*option == '+')
486 break;
487 i++;
488 if (i == (long) argc)
489 ThrowIdentifyException(OptionError,"MissingArgument",option);
490 if (IsGeometry(argv[i]) == MagickFalse)
491 ThrowIdentifyInvalidArgumentException(option,argv[i]);
492 break;
493 }
494 ThrowIdentifyException(OptionError,"UnrecognizedOption",option)
495 }
496 case 'f':
497 {
498 if (LocaleCompare("format",option+1) == 0)
499 {
500 format=(char *) NULL;
501 if (*option == '+')
502 break;
503 i++;
504 if (i == (long) argc)
505 ThrowIdentifyException(OptionError,"MissingArgument",option);
506 format=argv[i];
507 break;
508 }
509 if (LocaleCompare("fuzz",option+1) == 0)
510 {
511 if (*option == '+')
512 break;
513 i++;
514 if (i == (long) (argc-1))
515 ThrowIdentifyException(OptionError,"MissingArgument",option);
516 if (IsGeometry(argv[i]) == MagickFalse)
517 ThrowIdentifyInvalidArgumentException(option,argv[i]);
518 break;
519 }
520 ThrowIdentifyException(OptionError,"UnrecognizedOption",option)
521 }
522 case 'g':
523 {
524 if (LocaleCompare("gamma",option+1) == 0)
525 {
526 i++;
527 if (i == (long) (argc-1))
528 ThrowIdentifyException(OptionError,"MissingArgument",option);
529 if (IsGeometry(argv[i]) == MagickFalse)
530 ThrowIdentifyInvalidArgumentException(option,argv[i]);
531 break;
532 }
533 ThrowIdentifyException(OptionError,"UnrecognizedOption",option)
534 }
535 case 'h':
536 {
537 if ((LocaleCompare("help",option+1) == 0) ||
538 (LocaleCompare("-help",option+1) == 0))
539 return(IdentifyUsage());
540 ThrowIdentifyException(OptionError,"UnrecognizedOption",option)
541 }
542 case 'i':
543 {
544 if (LocaleCompare("interlace",option+1) == 0)
545 {
546 long
547 interlace;
548
549 if (*option == '+')
550 break;
551 i++;
552 if (i == (long) argc)
553 ThrowIdentifyException(OptionError,"MissingArgument",option);
554 interlace=ParseMagickOption(MagickInterlaceOptions,MagickFalse,
555 argv[i]);
556 if (interlace < 0)
557 ThrowIdentifyException(OptionError,
558 "UnrecognizedInterlaceType",argv[i]);
559 break;
560 }
561 if (LocaleCompare("interpolate",option+1) == 0)
562 {
563 long
564 interpolate;
565
566 if (*option == '+')
567 break;
568 i++;
569 if (i == (long) argc)
570 ThrowIdentifyException(OptionError,"MissingArgument",option);
571 interpolate=ParseMagickOption(MagickInterpolateOptions,MagickFalse,
572 argv[i]);
573 if (interpolate < 0)
574 ThrowIdentifyException(OptionError,
575 "UnrecognizedInterpolateMethod",argv[i]);
576 break;
577 }
578 ThrowIdentifyException(OptionError,"UnrecognizedOption",option)
579 }
580 case 'l':
581 {
582 if (LocaleCompare("limit",option+1) == 0)
583 {
584 char
585 *p;
586
587 double
588 value;
589
590 long
591 resource;
592
593 if (*option == '+')
594 break;
595 i++;
596 if (i == (long) argc)
597 ThrowIdentifyException(OptionError,"MissingArgument",option);
598 resource=ParseMagickOption(MagickResourceOptions,MagickFalse,
599 argv[i]);
600 if (resource < 0)
601 ThrowIdentifyException(OptionError,"UnrecognizedResourceType",
602 argv[i]);
603 i++;
604 if (i == (long) argc)
605 ThrowIdentifyException(OptionError,"MissingArgument",option);
606 value=strtod(argv[i],&p);
607 if ((p == argv[i]) && (LocaleCompare("unlimited",argv[i]) != 0))
608 ThrowIdentifyInvalidArgumentException(option,argv[i]);
609 break;
610 }
611 if (LocaleCompare("list",option+1) == 0)
612 {
613 long
614 list;
615
616 if (*option == '+')
617 break;
618 i++;
619 if (i == (long) argc)
620 ThrowIdentifyException(OptionError,"MissingArgument",option);
621 list=ParseMagickOption(MagickListOptions,MagickFalse,argv[i]);
622 if (list < 0)
623 ThrowIdentifyException(OptionError,"UnrecognizedListType",
624 argv[i]);
625 (void) MogrifyImageInfo(image_info,(int) (i-j+1),(const char **)
626 argv+j,exception);
627 DestroyIdentify();
628 return(MagickTrue);
629 }
630 if (LocaleCompare("log",option+1) == 0)
631 {
632 if (*option == '+')
633 break;
634 i++;
635 if ((i == (long) argc) ||
636 (strchr(argv[i],'%') == (char *) NULL))
637 ThrowIdentifyException(OptionError,"MissingArgument",option);
638 break;
639 }
640 ThrowIdentifyException(OptionError,"UnrecognizedOption",option)
641 }
642 case 'm':
643 {
644 if (LocaleCompare("matte",option+1) == 0)
645 break;
646 if (LocaleCompare("monitor",option+1) == 0)
647 break;
648 ThrowIdentifyException(OptionError,"UnrecognizedOption",option)
649 }
650 case 'p':
651 {
652 if (LocaleCompare("ping",option+1) == 0)
653 break;
654 ThrowIdentifyException(OptionError,"UnrecognizedOption",option)
655 }
656 case 'q':
657 {
658 if (LocaleCompare("quiet",option+1) == 0)
659 break;
660 ThrowIdentifyException(OptionError,"UnrecognizedOption",option)
661 }
662 case 'r':
663 {
664 if (LocaleCompare("regard-warnings",option+1) == 0)
665 break;
666 if (LocaleNCompare("respect-parentheses",option+1,17) == 0)
667 {
668 respect_parenthesis=(*option == '-') ? MagickTrue : MagickFalse;
669 break;
670 }
671 ThrowIdentifyException(OptionError,"UnrecognizedOption",option)
672 }
673 case 's':
674 {
675 if (LocaleCompare("sampling-factor",option+1) == 0)
676 {
677 if (*option == '+')
678 break;
679 i++;
680 if (i == (long) argc)
681 ThrowIdentifyException(OptionError,"MissingArgument",option);
682 if (IsGeometry(argv[i]) == MagickFalse)
683 ThrowIdentifyInvalidArgumentException(option,argv[i]);
684 break;
685 }
686 if (LocaleCompare("seed",option+1) == 0)
687 {
688 if (*option == '+')
689 break;
690 i++;
691 if (i == (long) (argc-1))
692 ThrowIdentifyException(OptionError,"MissingArgument",option);
693 if (IsGeometry(argv[i]) == MagickFalse)
694 ThrowIdentifyInvalidArgumentException(option,argv[i]);
695 break;
696 }
697 if (LocaleCompare("set",option+1) == 0)
698 {
699 i++;
700 if (i == (long) argc)
701 ThrowIdentifyException(OptionError,"MissingArgument",option);
702 if (*option == '+')
703 break;
704 i++;
705 if (i == (long) argc)
706 ThrowIdentifyException(OptionError,"MissingArgument",option);
707 break;
708 }
709 if (LocaleCompare("size",option+1) == 0)
710 {
711 if (*option == '+')
712 break;
713 i++;
714 if (i == (long) argc)
715 ThrowIdentifyException(OptionError,"MissingArgument",option);
716 if (IsGeometry(argv[i]) == MagickFalse)
717 ThrowIdentifyInvalidArgumentException(option,argv[i]);
718 break;
719 }
720 if (LocaleCompare("strip",option+1) == 0)
721 break;
722 if (LocaleCompare("support",option+1) == 0)
723 {
724 if (*option == '+')
725 break;
726 i++;
727 if (i == (long) argc)
728 ThrowIdentifyException(OptionError,"MissingArgument",option);
729 if (IsGeometry(argv[i]) == MagickFalse)
730 ThrowIdentifyInvalidArgumentException(option,argv[i]);
731 break;
732 }
733 ThrowIdentifyException(OptionError,"UnrecognizedOption",option)
734 }
735 case 'u':
736 {
737 if (LocaleCompare("units",option+1) == 0)
738 {
739 long
740 units;
741
742 if (*option == '+')
743 break;
744 i++;
745 if (i == (long) (argc-1))
746 ThrowIdentifyException(OptionError,"MissingArgument",option);
747 units=ParseMagickOption(MagickResolutionOptions,MagickFalse,
748 argv[i]);
749 if (units < 0)
750 ThrowIdentifyException(OptionError,"UnrecognizedUnitsType",
751 argv[i]);
752 break;
753 }
754 ThrowIdentifyException(OptionError,"UnrecognizedOption",option)
755 }
756 case 'v':
757 {
758 if (LocaleCompare("verbose",option+1) == 0)
759 break;
760 if (LocaleCompare("virtual-pixel",option+1) == 0)
761 {
762 long
763 method;
764
765 if (*option == '+')
766 break;
767 i++;
768 if (i == (long) (argc-1))
769 ThrowIdentifyException(OptionError,"MissingArgument",option);
770 method=ParseMagickOption(MagickVirtualPixelOptions,MagickFalse,
771 argv[i]);
772 if (method < 0)
773 ThrowIdentifyException(OptionError,
774 "UnrecognizedVirtualPixelMethod",argv[i]);
775 break;
776 }
777 ThrowIdentifyException(OptionError,"UnrecognizedOption",option)
778 }
779 case '?':
780 break;
781 default:
782 ThrowIdentifyException(OptionError,"UnrecognizedOption",option)
783 }
cristy6a917d92009-10-06 19:23:54 +0000784 fire=ParseMagickOption(MagickImageListOptions,MagickFalse,option+1) < 0 ?
cristy3ed852e2009-09-05 21:47:34 +0000785 MagickFalse : MagickTrue;
786 if (fire != MagickFalse)
787 FireImageStack(MagickFalse,MagickTrue,MagickTrue);
788 }
789 if (k != 0)
790 ThrowIdentifyException(OptionError,"UnbalancedParenthesis",argv[i]);
791 if (i != argc)
792 ThrowIdentifyException(OptionError,"MissingAnImageFilename",argv[i]);
793 DestroyIdentify();
794 return(status != 0 ? MagickTrue : MagickFalse);
795}