MagickWand  6.9.13-50
Convert, Edit, Or Compose Bitmap Images
stream.c
1 /*
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 % %
4 % %
5 % %
6 % SSSSS TTTTT RRRR EEEEE AAA M M %
7 % SS T R R E A A MM MM %
8 % SSS T RRRR EEE AAAAA M M M %
9 % SS T R R E A A M M %
10 % SSSSS T R R EEEEE A A M M %
11 % %
12 % %
13 % Stream Image to a Raw Image Format %
14 % %
15 % Software Design %
16 % Cristy %
17 % July 1992 %
18 % %
19 % %
20 % Copyright 1999 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 % https://imagemagick.org/license/ %
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 % Stream is a lightweight tool to stream one or more pixel components of the
37 % image or portion of the image to your choice of storage formats. It writes
38 % the pixel components as they are read from the input image a row at a time
39 % making stream desirable when working with large images or when you require
40 % raw pixel components.
41 %
42 */
43 
44 /*
45  Include declarations.
46 */
47 #include "wand/studio.h"
48 #include "wand/MagickWand.h"
49 #include "wand/mogrify-private.h"
50 #include "magick/stream-private.h"
51 #include "magick/string-private.h"
52 
53 /*
54 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
55 % %
56 % %
57 % %
58 % S t r e a m I m a g e C o m m a n d %
59 % %
60 % %
61 % %
62 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
63 %
64 % StreamImageCommand() is a lightweight method designed to extract pixels
65 % from large image files to a raw format using a minimum of system resources.
66 % The entire image or any regular portion of the image can be extracted.
67 %
68 % The format of the StreamImageCommand method is:
69 %
70 % MagickBooleanType StreamImageCommand(ImageInfo *image_info,int argc,
71 % char **argv,char **metadata,ExceptionInfo *exception)
72 %
73 % A description of each parameter follows:
74 %
75 % o image_info: the image info.
76 %
77 % o argc: the number of elements in the argument vector.
78 %
79 % o argv: A text array containing the command line arguments.
80 %
81 % o metadata: any metadata is returned here.
82 %
83 % o exception: return any errors or warnings in this structure.
84 %
85 */
86 
87 static MagickBooleanType StreamUsage(void)
88 {
89  static const char
90  miscellaneous[] =
91  " -debug events display copious debugging information\n"
92  " -help print program options\n"
93  " -list type print a list of supported option arguments\n"
94  " -log format format of debugging information\n"
95  " -version print version information",
96  settings[] =
97  " -authenticate password\n"
98  " decipher image with this password\n"
99  " -channel type apply option to select image channels\n"
100  " -colorspace type alternate image colorspace\n"
101  " -compress type type of pixel compression when writing the image\n"
102  " -define format:option\n"
103  " define one or more image format options\n"
104  " -density geometry horizontal and vertical density of the image\n"
105  " -depth value image depth\n"
106  " -extract geometry extract area from image\n"
107  " -identify identify the format and characteristics of the image\n"
108  " -interlace type type of image interlacing scheme\n"
109  " -interpolate method pixel color interpolation method\n"
110  " -limit type value pixel cache resource limit\n"
111  " -map components one or more pixel components\n"
112  " -monitor monitor progress\n"
113  " -quantize colorspace reduce colors in this colorspace\n"
114  " -quiet suppress all warning messages\n"
115  " -regard-warnings pay attention to warning messages\n"
116  " -respect-parentheses settings remain in effect until parenthesis boundary\n"
117  " -sampling-factor geometry\n"
118  " horizontal and vertical sampling factor\n"
119  " -seed value seed a new sequence of pseudo-random numbers\n"
120  " -set attribute value set an image attribute\n"
121  " -size geometry width and height of image\n"
122  " -storage-type type pixel storage type\n"
123  " -synchronize synchronize image to storage device\n"
124  " -taint declare the image as modified\n"
125  " -transparent-color color\n"
126  " transparent color\n"
127  " -verbose print detailed information about the image\n"
128  " -virtual-pixel method\n"
129  " virtual pixel access method";
130 
131  ListMagickVersion(stdout);
132  (void) printf("Usage: %s [options ...] input-image raw-image\n",
133  GetClientName());
134  (void) printf("\nImage Settings:\n");
135  (void) puts(settings);
136  (void) printf("\nMiscellaneous Options:\n");
137  (void) puts(miscellaneous);
138  (void) printf(
139  "\nBy default, the image format of `file' is determined by its magic\n");
140  (void) printf(
141  "number. To specify a particular image format, precede the filename\n");
142  (void) printf(
143  "with an image format name and a colon (i.e. ps:image) or specify the\n");
144  (void) printf(
145  "image type as the filename suffix (i.e. image.ps). Specify 'file' as\n");
146  (void) printf("'-' for standard input or output.\n");
147  return(MagickTrue);
148 }
149 
150 WandExport MagickBooleanType StreamImageCommand(ImageInfo *image_info,
151  int argc,char **argv,char **metadata,ExceptionInfo *exception)
152 {
153 #define DestroyStream() \
154 { \
155  DestroyImageStack(); \
156  stream_info=DestroyStreamInfo(stream_info); \
157  for (i=0; i < (ssize_t) argc; i++) \
158  argv[i]=DestroyString(argv[i]); \
159  argv=(char **) RelinquishMagickMemory(argv); \
160 }
161 #define ThrowStreamException(asperity,tag,option) \
162 { \
163  char *message = GetExceptionMessage(errno); \
164  (void) ThrowMagickException(exception,GetMagickModule(),asperity,tag, \
165  "`%s'",option == (char *) NULL ? message : option); \
166  message=DestroyString(message); \
167  DestroyStream(); \
168  return(MagickFalse); \
169 }
170 #define ThrowStreamInvalidArgumentException(option,argument) \
171 { \
172  (void) ThrowMagickException(exception,GetMagickModule(),OptionError, \
173  "InvalidArgument","`%s': %s",option,argument); \
174  DestroyStream(); \
175  return(MagickFalse); \
176 }
177 
178  char
179  *filename,
180  *option;
181 
182  const char
183  *format;
184 
185  Image
186  *image = (Image *) NULL;
187 
188  ImageStack
189  image_stack[MaxImageStackDepth+1];
190 
191  MagickBooleanType
192  fire,
193  pend,
194  respect_parenthesis;
195 
196  MagickStatusType
197  status;
198 
199  ssize_t
200  i;
201 
202  ssize_t
203  j,
204  k;
205 
206  StreamInfo
207  *stream_info;
208 
209  /*
210  Set defaults.
211  */
212  assert(image_info != (ImageInfo *) NULL);
213  assert(image_info->signature == MagickCoreSignature);
214  assert(exception != (ExceptionInfo *) NULL);
215  if (IsEventLogging() != MagickFalse)
216  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
217  (void) metadata;
218  if (argc == 2)
219  {
220  option=argv[1];
221  if ((LocaleCompare("version",option+1) == 0) ||
222  (LocaleCompare("-version",option+1) == 0))
223  {
224  ListMagickVersion(stdout);
225  return(MagickTrue);
226  }
227  }
228  if (argc < 3)
229  {
230  (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
231  "MissingArgument","%s","");
232  (void) StreamUsage();
233  return(MagickFalse);
234  }
235  format="%w,%h,%m";
236  (void) format;
237  j=1;
238  k=0;
239  NewImageStack();
240  option=(char *) NULL;
241  pend=MagickFalse;
242  respect_parenthesis=MagickFalse;
243  stream_info=AcquireStreamInfo(image_info);
244  status=MagickTrue;
245  /*
246  Stream an image.
247  */
248  ReadCommandlLine(argc,&argv);
249  status=ExpandFilenames(&argc,&argv);
250  if (status == MagickFalse)
251  ThrowStreamException(ResourceLimitError,"MemoryAllocationFailed",
252  (char *) NULL);
253  status=OpenStream(image_info,stream_info,argv[argc-1],exception);
254  if (status == MagickFalse)
255  {
256  DestroyStream();
257  return(MagickFalse);
258  }
259  for (i=1; i < ((ssize_t) argc-1); i++)
260  {
261  option=argv[i];
262  if (LocaleCompare(option,"(") == 0)
263  {
264  FireImageStack(MagickFalse,MagickTrue,pend);
265  if (k == MaxImageStackDepth)
266  ThrowStreamException(OptionError,"ParenthesisNestedTooDeeply",option);
267  PushImageStack();
268  continue;
269  }
270  if (LocaleCompare(option,")") == 0)
271  {
272  FireImageStack(MagickFalse,MagickTrue,MagickTrue);
273  if (k == 0)
274  ThrowStreamException(OptionError,"UnableToParseExpression",option);
275  PopImageStack();
276  continue;
277  }
278  if (IsCommandOption(option) == MagickFalse)
279  {
280  Image
281  *images;
282 
283  /*
284  Stream input image.
285  */
286  FireImageStack(MagickFalse,MagickFalse,pend);
287  filename=argv[i];
288  if ((LocaleCompare(filename,"--") == 0) && (i < ((ssize_t) argc-1)))
289  filename=argv[++i];
290  (void) CopyMagickString(image_info->filename,filename,MaxTextExtent);
291  images=StreamImage(image_info,stream_info,exception);
292  status&=(images != (Image *) NULL) &&
293  (exception->severity < ErrorException);
294  if (images == (Image *) NULL)
295  continue;
296  AppendImageStack(images);
297  continue;
298  }
299  pend=image != (Image *) NULL ? MagickTrue : MagickFalse;
300  switch (*(option+1))
301  {
302  case 'a':
303  {
304  if (LocaleCompare("authenticate",option+1) == 0)
305  {
306  if (*option == '+')
307  break;
308  i++;
309  if (i == (ssize_t) argc)
310  ThrowStreamException(OptionError,"MissingArgument",option);
311  break;
312  }
313  ThrowStreamException(OptionError,"UnrecognizedOption",option)
314  }
315  case 'c':
316  {
317  if (LocaleCompare("cache",option+1) == 0)
318  {
319  if (*option == '+')
320  break;
321  i++;
322  if (i == (ssize_t) argc)
323  ThrowStreamException(OptionError,"MissingArgument",option);
324  if (IsGeometry(argv[i]) == MagickFalse)
325  ThrowStreamInvalidArgumentException(option,argv[i]);
326  break;
327  }
328  if (LocaleCompare("channel",option+1) == 0)
329  {
330  ssize_t
331  channel;
332 
333  if (*option == '+')
334  break;
335  i++;
336  if (i == (ssize_t) argc)
337  ThrowStreamException(OptionError,"MissingArgument",option);
338  channel=ParseChannelOption(argv[i]);
339  if (channel < 0)
340  ThrowStreamException(OptionError,"UnrecognizedChannelType",
341  argv[i]);
342  break;
343  }
344  if (LocaleCompare("colorspace",option+1) == 0)
345  {
346  ssize_t
347  colorspace;
348 
349  if (*option == '+')
350  break;
351  i++;
352  if (i == (ssize_t) argc)
353  ThrowStreamException(OptionError,"MissingArgument",option);
354  colorspace=ParseCommandOption(MagickColorspaceOptions,MagickFalse,
355  argv[i]);
356  if (colorspace < 0)
357  ThrowStreamException(OptionError,"UnrecognizedColorspace",
358  argv[i]);
359  break;
360  }
361  if (LocaleCompare("compress",option+1) == 0)
362  {
363  ssize_t
364  compress;
365 
366  if (*option == '+')
367  break;
368  i++;
369  if (i == (ssize_t) argc)
370  ThrowStreamException(OptionError,"MissingArgument",option);
371  compress=ParseCommandOption(MagickCompressOptions,MagickFalse,
372  argv[i]);
373  if (compress < 0)
374  ThrowStreamException(OptionError,"UnrecognizedImageCompression",
375  argv[i]);
376  break;
377  }
378  if (LocaleCompare("concurrent",option+1) == 0)
379  break;
380  ThrowStreamException(OptionError,"UnrecognizedOption",option)
381  }
382  case 'd':
383  {
384  if (LocaleCompare("debug",option+1) == 0)
385  {
386  ssize_t
387  event;
388 
389  if (*option == '+')
390  break;
391  i++;
392  if (i == (ssize_t) argc)
393  ThrowStreamException(OptionError,"MissingArgument",option);
394  event=ParseCommandOption(MagickLogEventOptions,MagickFalse,argv[i]);
395  if (event < 0)
396  ThrowStreamException(OptionError,"UnrecognizedEventType",argv[i]);
397  (void) SetLogEventMask(argv[i]);
398  break;
399  }
400  if (LocaleCompare("define",option+1) == 0)
401  {
402  i++;
403  if (i == (ssize_t) argc)
404  ThrowStreamException(OptionError,"MissingArgument",option);
405  if (*option == '+')
406  {
407  const char
408  *define;
409 
410  define=GetImageOption(image_info,argv[i]);
411  if (define == (const char *) NULL)
412  ThrowStreamException(OptionError,"NoSuchOption",argv[i]);
413  break;
414  }
415  break;
416  }
417  if (LocaleCompare("density",option+1) == 0)
418  {
419  if (*option == '+')
420  break;
421  i++;
422  if (i == (ssize_t) argc)
423  ThrowStreamException(OptionError,"MissingArgument",option);
424  if (IsGeometry(argv[i]) == MagickFalse)
425  ThrowStreamInvalidArgumentException(option,argv[i]);
426  break;
427  }
428  if (LocaleCompare("depth",option+1) == 0)
429  {
430  if (*option == '+')
431  break;
432  i++;
433  if (i == (ssize_t) argc)
434  ThrowStreamException(OptionError,"MissingArgument",option);
435  if (IsGeometry(argv[i]) == MagickFalse)
436  ThrowStreamInvalidArgumentException(option,argv[i]);
437  break;
438  }
439  if (LocaleCompare("duration",option+1) == 0)
440  {
441  if (*option == '+')
442  break;
443  i++;
444  if (i == (ssize_t) argc)
445  ThrowStreamException(OptionError,"MissingArgument",option);
446  if (IsGeometry(argv[i]) == MagickFalse)
447  ThrowStreamInvalidArgumentException(option,argv[i]);
448  break;
449  }
450  ThrowStreamException(OptionError,"UnrecognizedOption",option)
451  }
452  case 'e':
453  {
454  if (LocaleCompare("extract",option+1) == 0)
455  {
456  if (*option == '+')
457  break;
458  i++;
459  if (i == (ssize_t) argc)
460  ThrowStreamException(OptionError,"MissingArgument",option);
461  if (IsGeometry(argv[i]) == MagickFalse)
462  ThrowStreamInvalidArgumentException(option,argv[i]);
463  break;
464  }
465  ThrowStreamException(OptionError,"UnrecognizedOption",option)
466  }
467  case 'h':
468  {
469  if ((LocaleCompare("help",option+1) == 0) ||
470  (LocaleCompare("-help",option+1) == 0))
471  {
472  DestroyStream();
473  return(StreamUsage());
474  }
475  ThrowStreamException(OptionError,"UnrecognizedOption",option)
476  }
477  case 'i':
478  {
479  if (LocaleCompare("identify",option+1) == 0)
480  break;
481  if (LocaleCompare("interlace",option+1) == 0)
482  {
483  ssize_t
484  interlace;
485 
486  if (*option == '+')
487  break;
488  i++;
489  if (i == (ssize_t) argc)
490  ThrowStreamException(OptionError,"MissingArgument",option);
491  interlace=ParseCommandOption(MagickInterlaceOptions,MagickFalse,
492  argv[i]);
493  if (interlace < 0)
494  ThrowStreamException(OptionError,"UnrecognizedInterlaceType",
495  argv[i]);
496  break;
497  }
498  if (LocaleCompare("interpolate",option+1) == 0)
499  {
500  ssize_t
501  interpolate;
502 
503  if (*option == '+')
504  break;
505  i++;
506  if (i == (ssize_t) argc)
507  ThrowStreamException(OptionError,"MissingArgument",option);
508  interpolate=ParseCommandOption(MagickInterpolateOptions,MagickFalse,
509  argv[i]);
510  if (interpolate < 0)
511  ThrowStreamException(OptionError,"UnrecognizedInterpolateMethod",
512  argv[i]);
513  break;
514  }
515  ThrowStreamException(OptionError,"UnrecognizedOption",option)
516  }
517  case 'l':
518  {
519  if (LocaleCompare("limit",option+1) == 0)
520  {
521  char
522  *p;
523 
524  double
525  value;
526 
527  ssize_t
528  resource;
529 
530  if (*option == '+')
531  break;
532  i++;
533  if (i == (ssize_t) argc)
534  ThrowStreamException(OptionError,"MissingArgument",option);
535  resource=ParseCommandOption(MagickResourceOptions,MagickFalse,
536  argv[i]);
537  if (resource < 0)
538  ThrowStreamException(OptionError,"UnrecognizedResourceType",
539  argv[i]);
540  i++;
541  if (i == (ssize_t) argc)
542  ThrowStreamException(OptionError,"MissingArgument",option);
543  value=StringToDouble(argv[i],&p);
544  (void) value;
545  if ((p == argv[i]) && (LocaleCompare("unlimited",argv[i]) != 0))
546  ThrowStreamInvalidArgumentException(option,argv[i]);
547  break;
548  }
549  if (LocaleCompare("list",option+1) == 0)
550  {
551  ssize_t
552  list;
553 
554  if (*option == '+')
555  break;
556  i++;
557  if (i == (ssize_t) argc)
558  ThrowStreamException(OptionError,"MissingArgument",option);
559  list=ParseCommandOption(MagickListOptions,MagickFalse,argv[i]);
560  if (list < 0)
561  ThrowStreamException(OptionError,"UnrecognizedListType",argv[i]);
562  status=MogrifyImageInfo(image_info,(int) (i-j+1),(const char **)
563  argv+j,exception);
564  DestroyStream();
565  return(status == 0 ? MagickFalse : MagickTrue);
566  }
567  if (LocaleCompare("log",option+1) == 0)
568  {
569  if (*option == '+')
570  break;
571  i++;
572  if ((i == (ssize_t) argc) || (strchr(argv[i],'%') == (char *) NULL))
573  ThrowStreamException(OptionError,"MissingArgument",option);
574  break;
575  }
576  ThrowStreamException(OptionError,"UnrecognizedOption",option)
577  }
578  case 'm':
579  {
580  if (LocaleCompare("map",option+1) == 0)
581  {
582  (void) CopyMagickString(argv[i]+1,"san",MaxTextExtent);
583  if (*option == '+')
584  break;
585  i++;
586  SetStreamInfoMap(stream_info,argv[i]);
587  break;
588  }
589  if (LocaleCompare("monitor",option+1) == 0)
590  break;
591  ThrowStreamException(OptionError,"UnrecognizedOption",option)
592  }
593  case 'q':
594  {
595  if (LocaleCompare("quantize",option+1) == 0)
596  {
597  ssize_t
598  colorspace;
599 
600  if (*option == '+')
601  break;
602  i++;
603  if (i == (ssize_t) argc)
604  ThrowStreamException(OptionError,"MissingArgument",option);
605  colorspace=ParseCommandOption(MagickColorspaceOptions,
606  MagickFalse,argv[i]);
607  if (colorspace < 0)
608  ThrowStreamException(OptionError,"UnrecognizedColorspace",
609  argv[i]);
610  break;
611  }
612  if (LocaleCompare("quiet",option+1) == 0)
613  break;
614  ThrowStreamException(OptionError,"UnrecognizedOption",option)
615  }
616  case 'r':
617  {
618  if (LocaleCompare("regard-warnings",option+1) == 0)
619  break;
620  if (LocaleNCompare("respect-parentheses",option+1,17) == 0)
621  {
622  respect_parenthesis=(*option == '-') ? MagickTrue : MagickFalse;
623  break;
624  }
625  ThrowStreamException(OptionError,"UnrecognizedOption",option)
626  }
627  case 's':
628  {
629  if (LocaleCompare("sampling-factor",option+1) == 0)
630  {
631  if (*option == '+')
632  break;
633  i++;
634  if (i == (ssize_t) argc)
635  ThrowStreamException(OptionError,"MissingArgument",option);
636  if (IsGeometry(argv[i]) == MagickFalse)
637  ThrowStreamInvalidArgumentException(option,argv[i]);
638  break;
639  }
640  if (LocaleCompare("seed",option+1) == 0)
641  {
642  if (*option == '+')
643  break;
644  i++;
645  if (i == (ssize_t) argc)
646  ThrowStreamException(OptionError,"MissingArgument",option);
647  if (IsGeometry(argv[i]) == MagickFalse)
648  ThrowStreamInvalidArgumentException(option,argv[i]);
649  break;
650  }
651  if (LocaleCompare("set",option+1) == 0)
652  {
653  i++;
654  if (i == (ssize_t) argc)
655  ThrowStreamException(OptionError,"MissingArgument",option);
656  if (*option == '+')
657  break;
658  i++;
659  if (i == (ssize_t) argc)
660  ThrowStreamException(OptionError,"MissingArgument",option);
661  break;
662  }
663  if (LocaleCompare("size",option+1) == 0)
664  {
665  if (*option == '+')
666  break;
667  i++;
668  if (i == (ssize_t) argc)
669  ThrowStreamException(OptionError,"MissingArgument",option);
670  if (IsGeometry(argv[i]) == MagickFalse)
671  ThrowStreamInvalidArgumentException(option,argv[i]);
672  break;
673  }
674  if (LocaleCompare("storage-type",option+1) == 0)
675  {
676  ssize_t
677  type;
678 
679  if (*option == '+')
680  break;
681  i++;
682  if (i == (ssize_t) argc)
683  ThrowStreamException(OptionError,"MissingArgument",option);
684  type=ParseCommandOption(MagickStorageOptions,MagickFalse,argv[i]);
685  if (type < 0)
686  ThrowStreamException(OptionError,"UnrecognizedStorageType",
687  argv[i]);
688  SetStreamInfoStorageType(stream_info,(StorageType) type);
689  break;
690  }
691  if (LocaleCompare("synchronize",option+1) == 0)
692  break;
693  ThrowStreamException(OptionError,"UnrecognizedOption",option)
694  }
695  case 't':
696  {
697  if (LocaleCompare("taint",option+1) == 0)
698  break;
699  if (LocaleCompare("transparent-color",option+1) == 0)
700  {
701  if (*option == '+')
702  break;
703  i++;
704  if (i == (ssize_t) argc)
705  ThrowStreamException(OptionError,"MissingArgument",option);
706  break;
707  }
708  ThrowStreamException(OptionError,"UnrecognizedOption",option)
709  }
710  case 'v':
711  {
712  if (LocaleCompare("verbose",option+1) == 0)
713  break;
714  if ((LocaleCompare("version",option+1) == 0) ||
715  (LocaleCompare("-version",option+1) == 0))
716  {
717  ListMagickVersion(stdout);
718  break;
719  }
720  if (LocaleCompare("virtual-pixel",option+1) == 0)
721  {
722  ssize_t
723  method;
724 
725  if (*option == '+')
726  break;
727  i++;
728  if (i == (ssize_t) argc)
729  ThrowStreamException(OptionError,"MissingArgument",option);
730  method=ParseCommandOption(MagickVirtualPixelOptions,MagickFalse,
731  argv[i]);
732  if (method < 0)
733  ThrowStreamException(OptionError,"UnrecognizedVirtualPixelMethod",
734  argv[i]);
735  break;
736  }
737  ThrowStreamException(OptionError,"UnrecognizedOption",option)
738  }
739  case '?':
740  break;
741  default:
742  ThrowStreamException(OptionError,"UnrecognizedOption",option)
743  }
744  fire=(GetCommandOptionFlags(MagickCommandOptions,MagickFalse,option) &
745  FireOptionFlag) == 0 ? MagickFalse : MagickTrue;
746  if (fire != MagickFalse)
747  FireImageStack(MagickFalse,MagickTrue,MagickTrue);
748  }
749  if (k != 0)
750  ThrowStreamException(OptionError,"UnbalancedParenthesis",argv[i]);
751  if (i-- != ((ssize_t) argc-1))
752  ThrowStreamException(OptionError,"MissingAnImageFilename",argv[i]);
753  if (image == (Image *) NULL)
754  ThrowStreamException(OptionError,"MissingAnImageFilename",argv[i]);
755  FinalizeImageSettings(image_info,image,MagickTrue);
756  if (image == (Image *) NULL)
757  ThrowStreamException(OptionError,"MissingAnImageFilename",argv[i]);
758  DestroyStream();
759  return(status != 0 ? MagickTrue : MagickFalse);
760 }