blob: 915dc26acabeff9af84832999b6f2e7e1ae92a40 [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());
cristy104cea82009-10-25 02:26:51 +0000238 (void) fprintf(stdout,"Features: %s\n\n",GetMagickFeatures());
cristy3ed852e2009-09-05 21:47:34 +0000239 return(MagickFalse);
240 }
241 }
242 if (argc < 2)
243 {
244 (void) IdentifyUsage();
245 return(MagickTrue);
246 }
247 count=0;
248 format=NULL;
249 j=1;
250 k=0;
251 NewImageStack();
252 option=(char *) NULL;
253 pend=MagickFalse;
254 status=MagickTrue;
255 /*
256 Identify an image.
257 */
258 ReadCommandlLine(argc,&argv);
259 status=ExpandFilenames(&argc,&argv);
260 if (status == MagickFalse)
261 ThrowIdentifyException(ResourceLimitError,"MemoryAllocationFailed",
262 GetExceptionMessage(errno));
263 image_info->ping=MagickTrue;
264 for (i=1; i < (long) argc; i++)
265 {
266 option=argv[i];
267 if (LocaleCompare(option,"(") == 0)
268 {
269 FireImageStack(MagickFalse,MagickTrue,pend);
270 if (k == MaxImageStackDepth)
271 ThrowIdentifyException(OptionError,"ParenthesisNestedTooDeeply",
272 option);
273 PushImageStack();
274 continue;
275 }
276 if (LocaleCompare(option,")") == 0)
277 {
278 FireImageStack(MagickFalse,MagickTrue,MagickTrue);
279 if (k == 0)
280 ThrowIdentifyException(OptionError,"UnableToParseExpression",option);
281 PopImageStack();
282 continue;
283 }
284 if (IsMagickOption(option) == MagickFalse)
285 {
286 char
287 *filename;
288
289 Image
290 *images;
291
292 ImageInfo
293 *identify_info;
294
295 /*
296 Read input image.
297 */
298 FireImageStack(MagickFalse,MagickFalse,pend);
299 identify_info=CloneImageInfo(image_info);
300 identify_info->verbose=MagickFalse;
301 filename=argv[i];
302 if ((LocaleCompare(filename,"--") == 0) && (i < (argc-1)))
303 filename=argv[++i];
304 (void) CopyMagickString(identify_info->filename,filename,MaxTextExtent);
305 if (identify_info->ping != MagickFalse)
306 images=PingImages(identify_info,exception);
307 else
308 images=ReadImages(identify_info,exception);
309 identify_info=DestroyImageInfo(identify_info);
310 status&=(images != (Image *) NULL) &&
311 (exception->severity < ErrorException);
312 if (images == (Image *) NULL)
313 continue;
314 AppendImageStack(images);
315 FinalizeImageSettings(image_info,image,MagickFalse);
316 for ( ; image != (Image *) NULL; image=GetNextImageInList(image))
317 {
318 if (image->scene == 0)
319 image->scene=count++;
320 if (format == (char *) NULL)
321 {
322 (void) IdentifyImage(image,stdout,image_info->verbose);
323 continue;
324 }
325 if (metadata != (char **) NULL)
326 {
327 char
328 *text;
329
330 text=InterpretImageProperties(image_info,image,format);
331 if (text == (char *) NULL)
332 ThrowIdentifyException(ResourceLimitError,
333 "MemoryAllocationFailed",GetExceptionMessage(errno));
334 (void) ConcatenateString(&(*metadata),text);
335 text=DestroyString(text);
336 if (LocaleCompare(format,"%n") == 0)
337 break;
338 }
339 }
340 RemoveAllImageStack();
341 continue;
342 }
343 pend=image != (Image *) NULL ? MagickTrue : MagickFalse;
344 switch (*(option+1))
345 {
346 case 'a':
347 {
348 if (LocaleCompare("alpha",option+1) == 0)
349 {
350 long
351 type;
352
353 if (*option == '+')
354 break;
355 i++;
356 if (i == (long) argc)
357 ThrowIdentifyException(OptionError,"MissingArgument",option);
358 type=ParseMagickOption(MagickAlphaOptions,MagickFalse,argv[i]);
359 if (type < 0)
360 ThrowIdentifyException(OptionError,"UnrecognizedAlphaChannelType",
361 argv[i]);
362 break;
363 }
364 if (LocaleCompare("antialias",option+1) == 0)
365 break;
366 if (LocaleCompare("authenticate",option+1) == 0)
367 {
368 if (*option == '+')
369 break;
370 i++;
371 if (i == (long) (argc-1))
372 ThrowIdentifyException(OptionError,"MissingArgument",option);
373 break;
374 }
375 ThrowIdentifyException(OptionError,"UnrecognizedOption",option)
376 }
377 case 'c':
378 {
379 if (LocaleCompare("cache",option+1) == 0)
380 {
381 if (*option == '+')
382 break;
383 i++;
384 if (i == (long) argc)
385 ThrowIdentifyException(OptionError,"MissingArgument",option);
386 if (IsGeometry(argv[i]) == MagickFalse)
387 ThrowIdentifyInvalidArgumentException(option,argv[i]);
388 break;
389 }
390 if (LocaleCompare("channel",option+1) == 0)
391 {
392 long
393 channel;
394
395 if (*option == '+')
396 break;
397 i++;
398 if (i == (long) (argc-1))
399 ThrowIdentifyException(OptionError,"MissingArgument",option);
400 channel=ParseChannelOption(argv[i]);
401 if (channel < 0)
402 ThrowIdentifyException(OptionError,"UnrecognizedChannelType",
403 argv[i]);
404 break;
405 }
406 if (LocaleCompare("colorspace",option+1) == 0)
407 {
408 long
409 colorspace;
410
411 if (*option == '+')
412 break;
413 i++;
414 if (i == (long) (argc-1))
415 ThrowIdentifyException(OptionError,"MissingArgument",option);
416 colorspace=ParseMagickOption(MagickColorspaceOptions,
417 MagickFalse,argv[i]);
418 if (colorspace < 0)
419 ThrowIdentifyException(OptionError,"UnrecognizedColorspace",
420 argv[i]);
421 break;
422 }
423 if (LocaleCompare("crop",option+1) == 0)
424 {
425 if (*option == '+')
426 break;
427 i++;
428 if (i == (long) (argc-1))
429 ThrowIdentifyException(OptionError,"MissingArgument",option);
430 if (IsGeometry(argv[i]) == MagickFalse)
431 ThrowIdentifyInvalidArgumentException(option,argv[i]);
432 image_info->ping=MagickFalse;
433 break;
434 }
435 ThrowIdentifyException(OptionError,"UnrecognizedOption",option)
436 }
437 case 'd':
438 {
439 if (LocaleCompare("debug",option+1) == 0)
440 {
441 long
442 event;
443
444 if (*option == '+')
445 break;
446 i++;
447 if (i == (long) argc)
448 ThrowIdentifyException(OptionError,"MissingArgument",option);
449 event=ParseMagickOption(MagickLogEventOptions,MagickFalse,argv[i]);
450 if (event < 0)
451 ThrowIdentifyException(OptionError,"UnrecognizedEventType",
452 argv[i]);
453 (void) SetLogEventMask(argv[i]);
454 break;
455 }
456 if (LocaleCompare("define",option+1) == 0)
457 {
458 i++;
459 if (i == (long) argc)
460 ThrowIdentifyException(OptionError,"MissingArgument",option);
461 if (*option == '+')
462 {
463 const char
464 *define;
465
466 define=GetImageOption(image_info,argv[i]);
467 if (define == (const char *) NULL)
468 ThrowIdentifyException(OptionError,"NoSuchOption",argv[i]);
469 break;
470 }
471 break;
472 }
473 if (LocaleCompare("density",option+1) == 0)
474 {
475 if (*option == '+')
476 break;
477 i++;
478 if (i == (long) argc)
479 ThrowIdentifyException(OptionError,"MissingArgument",option);
480 if (IsGeometry(argv[i]) == MagickFalse)
481 ThrowIdentifyInvalidArgumentException(option,argv[i]);
482 break;
483 }
484 if (LocaleCompare("depth",option+1) == 0)
485 {
486 if (*option == '+')
487 break;
488 i++;
489 if (i == (long) argc)
490 ThrowIdentifyException(OptionError,"MissingArgument",option);
491 if (IsGeometry(argv[i]) == MagickFalse)
492 ThrowIdentifyInvalidArgumentException(option,argv[i]);
493 break;
494 }
495 ThrowIdentifyException(OptionError,"UnrecognizedOption",option)
496 }
497 case 'f':
498 {
499 if (LocaleCompare("format",option+1) == 0)
500 {
501 format=(char *) NULL;
502 if (*option == '+')
503 break;
504 i++;
505 if (i == (long) argc)
506 ThrowIdentifyException(OptionError,"MissingArgument",option);
507 format=argv[i];
508 break;
509 }
510 if (LocaleCompare("fuzz",option+1) == 0)
511 {
512 if (*option == '+')
513 break;
514 i++;
515 if (i == (long) (argc-1))
516 ThrowIdentifyException(OptionError,"MissingArgument",option);
517 if (IsGeometry(argv[i]) == MagickFalse)
518 ThrowIdentifyInvalidArgumentException(option,argv[i]);
519 break;
520 }
521 ThrowIdentifyException(OptionError,"UnrecognizedOption",option)
522 }
523 case 'g':
524 {
525 if (LocaleCompare("gamma",option+1) == 0)
526 {
527 i++;
528 if (i == (long) (argc-1))
529 ThrowIdentifyException(OptionError,"MissingArgument",option);
530 if (IsGeometry(argv[i]) == MagickFalse)
531 ThrowIdentifyInvalidArgumentException(option,argv[i]);
532 break;
533 }
534 ThrowIdentifyException(OptionError,"UnrecognizedOption",option)
535 }
536 case 'h':
537 {
538 if ((LocaleCompare("help",option+1) == 0) ||
539 (LocaleCompare("-help",option+1) == 0))
540 return(IdentifyUsage());
541 ThrowIdentifyException(OptionError,"UnrecognizedOption",option)
542 }
543 case 'i':
544 {
545 if (LocaleCompare("interlace",option+1) == 0)
546 {
547 long
548 interlace;
549
550 if (*option == '+')
551 break;
552 i++;
553 if (i == (long) argc)
554 ThrowIdentifyException(OptionError,"MissingArgument",option);
555 interlace=ParseMagickOption(MagickInterlaceOptions,MagickFalse,
556 argv[i]);
557 if (interlace < 0)
558 ThrowIdentifyException(OptionError,
559 "UnrecognizedInterlaceType",argv[i]);
560 break;
561 }
562 if (LocaleCompare("interpolate",option+1) == 0)
563 {
564 long
565 interpolate;
566
567 if (*option == '+')
568 break;
569 i++;
570 if (i == (long) argc)
571 ThrowIdentifyException(OptionError,"MissingArgument",option);
572 interpolate=ParseMagickOption(MagickInterpolateOptions,MagickFalse,
573 argv[i]);
574 if (interpolate < 0)
575 ThrowIdentifyException(OptionError,
576 "UnrecognizedInterpolateMethod",argv[i]);
577 break;
578 }
579 ThrowIdentifyException(OptionError,"UnrecognizedOption",option)
580 }
581 case 'l':
582 {
583 if (LocaleCompare("limit",option+1) == 0)
584 {
585 char
586 *p;
587
588 double
589 value;
590
591 long
592 resource;
593
594 if (*option == '+')
595 break;
596 i++;
597 if (i == (long) argc)
598 ThrowIdentifyException(OptionError,"MissingArgument",option);
599 resource=ParseMagickOption(MagickResourceOptions,MagickFalse,
600 argv[i]);
601 if (resource < 0)
602 ThrowIdentifyException(OptionError,"UnrecognizedResourceType",
603 argv[i]);
604 i++;
605 if (i == (long) argc)
606 ThrowIdentifyException(OptionError,"MissingArgument",option);
607 value=strtod(argv[i],&p);
608 if ((p == argv[i]) && (LocaleCompare("unlimited",argv[i]) != 0))
609 ThrowIdentifyInvalidArgumentException(option,argv[i]);
610 break;
611 }
612 if (LocaleCompare("list",option+1) == 0)
613 {
614 long
615 list;
616
617 if (*option == '+')
618 break;
619 i++;
620 if (i == (long) argc)
621 ThrowIdentifyException(OptionError,"MissingArgument",option);
622 list=ParseMagickOption(MagickListOptions,MagickFalse,argv[i]);
623 if (list < 0)
624 ThrowIdentifyException(OptionError,"UnrecognizedListType",
625 argv[i]);
626 (void) MogrifyImageInfo(image_info,(int) (i-j+1),(const char **)
627 argv+j,exception);
628 DestroyIdentify();
629 return(MagickTrue);
630 }
631 if (LocaleCompare("log",option+1) == 0)
632 {
633 if (*option == '+')
634 break;
635 i++;
636 if ((i == (long) argc) ||
637 (strchr(argv[i],'%') == (char *) NULL))
638 ThrowIdentifyException(OptionError,"MissingArgument",option);
639 break;
640 }
641 ThrowIdentifyException(OptionError,"UnrecognizedOption",option)
642 }
643 case 'm':
644 {
645 if (LocaleCompare("matte",option+1) == 0)
646 break;
647 if (LocaleCompare("monitor",option+1) == 0)
648 break;
649 ThrowIdentifyException(OptionError,"UnrecognizedOption",option)
650 }
651 case 'p':
652 {
653 if (LocaleCompare("ping",option+1) == 0)
654 break;
655 ThrowIdentifyException(OptionError,"UnrecognizedOption",option)
656 }
657 case 'q':
658 {
659 if (LocaleCompare("quiet",option+1) == 0)
660 break;
661 ThrowIdentifyException(OptionError,"UnrecognizedOption",option)
662 }
663 case 'r':
664 {
665 if (LocaleCompare("regard-warnings",option+1) == 0)
666 break;
667 if (LocaleNCompare("respect-parentheses",option+1,17) == 0)
668 {
669 respect_parenthesis=(*option == '-') ? MagickTrue : MagickFalse;
670 break;
671 }
672 ThrowIdentifyException(OptionError,"UnrecognizedOption",option)
673 }
674 case 's':
675 {
676 if (LocaleCompare("sampling-factor",option+1) == 0)
677 {
678 if (*option == '+')
679 break;
680 i++;
681 if (i == (long) argc)
682 ThrowIdentifyException(OptionError,"MissingArgument",option);
683 if (IsGeometry(argv[i]) == MagickFalse)
684 ThrowIdentifyInvalidArgumentException(option,argv[i]);
685 break;
686 }
687 if (LocaleCompare("seed",option+1) == 0)
688 {
689 if (*option == '+')
690 break;
691 i++;
692 if (i == (long) (argc-1))
693 ThrowIdentifyException(OptionError,"MissingArgument",option);
694 if (IsGeometry(argv[i]) == MagickFalse)
695 ThrowIdentifyInvalidArgumentException(option,argv[i]);
696 break;
697 }
698 if (LocaleCompare("set",option+1) == 0)
699 {
700 i++;
701 if (i == (long) argc)
702 ThrowIdentifyException(OptionError,"MissingArgument",option);
703 if (*option == '+')
704 break;
705 i++;
706 if (i == (long) argc)
707 ThrowIdentifyException(OptionError,"MissingArgument",option);
708 break;
709 }
710 if (LocaleCompare("size",option+1) == 0)
711 {
712 if (*option == '+')
713 break;
714 i++;
715 if (i == (long) argc)
716 ThrowIdentifyException(OptionError,"MissingArgument",option);
717 if (IsGeometry(argv[i]) == MagickFalse)
718 ThrowIdentifyInvalidArgumentException(option,argv[i]);
719 break;
720 }
721 if (LocaleCompare("strip",option+1) == 0)
722 break;
723 if (LocaleCompare("support",option+1) == 0)
724 {
725 if (*option == '+')
726 break;
727 i++;
728 if (i == (long) argc)
729 ThrowIdentifyException(OptionError,"MissingArgument",option);
730 if (IsGeometry(argv[i]) == MagickFalse)
731 ThrowIdentifyInvalidArgumentException(option,argv[i]);
732 break;
733 }
734 ThrowIdentifyException(OptionError,"UnrecognizedOption",option)
735 }
736 case 'u':
737 {
738 if (LocaleCompare("units",option+1) == 0)
739 {
740 long
741 units;
742
743 if (*option == '+')
744 break;
745 i++;
746 if (i == (long) (argc-1))
747 ThrowIdentifyException(OptionError,"MissingArgument",option);
748 units=ParseMagickOption(MagickResolutionOptions,MagickFalse,
749 argv[i]);
750 if (units < 0)
751 ThrowIdentifyException(OptionError,"UnrecognizedUnitsType",
752 argv[i]);
753 break;
754 }
755 ThrowIdentifyException(OptionError,"UnrecognizedOption",option)
756 }
757 case 'v':
758 {
759 if (LocaleCompare("verbose",option+1) == 0)
760 break;
761 if (LocaleCompare("virtual-pixel",option+1) == 0)
762 {
763 long
764 method;
765
766 if (*option == '+')
767 break;
768 i++;
769 if (i == (long) (argc-1))
770 ThrowIdentifyException(OptionError,"MissingArgument",option);
771 method=ParseMagickOption(MagickVirtualPixelOptions,MagickFalse,
772 argv[i]);
773 if (method < 0)
774 ThrowIdentifyException(OptionError,
775 "UnrecognizedVirtualPixelMethod",argv[i]);
776 break;
777 }
778 ThrowIdentifyException(OptionError,"UnrecognizedOption",option)
779 }
780 case '?':
781 break;
782 default:
783 ThrowIdentifyException(OptionError,"UnrecognizedOption",option)
784 }
cristy6a917d92009-10-06 19:23:54 +0000785 fire=ParseMagickOption(MagickImageListOptions,MagickFalse,option+1) < 0 ?
cristy3ed852e2009-09-05 21:47:34 +0000786 MagickFalse : MagickTrue;
787 if (fire != MagickFalse)
788 FireImageStack(MagickFalse,MagickTrue,MagickTrue);
789 }
790 if (k != 0)
791 ThrowIdentifyException(OptionError,"UnbalancedParenthesis",argv[i]);
792 if (i != argc)
793 ThrowIdentifyException(OptionError,"MissingAnImageFilename",argv[i]);
794 DestroyIdentify();
795 return(status != 0 ? MagickTrue : MagickFalse);
796}