MagickWand  6.9.13-22
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/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 % 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  (void) ThrowMagickException(exception,GetMagickModule(),asperity,tag,"`%s'", \
164  option); \
165  DestroyStream(); \
166  return(MagickFalse); \
167 }
168 #define ThrowStreamInvalidArgumentException(option,argument) \
169 { \
170  (void) ThrowMagickException(exception,GetMagickModule(),OptionError, \
171  "InvalidArgument","`%s': %s",option,argument); \
172  DestroyStream(); \
173  return(MagickFalse); \
174 }
175 
176  char
177  *filename,
178  *option;
179 
180  const char
181  *format;
182 
183  Image
184  *image = (Image *) NULL;
185 
186  ImageStack
187  image_stack[MaxImageStackDepth+1];
188 
189  MagickBooleanType
190  fire,
191  pend,
192  respect_parenthesis;
193 
194  MagickStatusType
195  status;
196 
197  ssize_t
198  i;
199 
200  ssize_t
201  j,
202  k;
203 
204  StreamInfo
205  *stream_info;
206 
207  /*
208  Set defaults.
209  */
210  assert(image_info != (ImageInfo *) NULL);
211  assert(image_info->signature == MagickCoreSignature);
212  assert(exception != (ExceptionInfo *) NULL);
213  if (IsEventLogging() != MagickFalse)
214  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
215  (void) metadata;
216  if (argc == 2)
217  {
218  option=argv[1];
219  if ((LocaleCompare("version",option+1) == 0) ||
220  (LocaleCompare("-version",option+1) == 0))
221  {
222  ListMagickVersion(stdout);
223  return(MagickTrue);
224  }
225  }
226  if (argc < 3)
227  {
228  (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
229  "MissingArgument","%s","");
230  (void) StreamUsage();
231  return(MagickFalse);
232  }
233  format="%w,%h,%m";
234  (void) format;
235  j=1;
236  k=0;
237  NewImageStack();
238  option=(char *) NULL;
239  pend=MagickFalse;
240  respect_parenthesis=MagickFalse;
241  stream_info=AcquireStreamInfo(image_info);
242  status=MagickTrue;
243  /*
244  Stream an image.
245  */
246  ReadCommandlLine(argc,&argv);
247  status=ExpandFilenames(&argc,&argv);
248  if (status == MagickFalse)
249  ThrowStreamException(ResourceLimitError,"MemoryAllocationFailed",
250  GetExceptionMessage(errno));
251  status=OpenStream(image_info,stream_info,argv[argc-1],exception);
252  if (status == MagickFalse)
253  {
254  DestroyStream();
255  return(MagickFalse);
256  }
257  for (i=1; i < (ssize_t) (argc-1); i++)
258  {
259  option=argv[i];
260  if (LocaleCompare(option,"(") == 0)
261  {
262  FireImageStack(MagickFalse,MagickTrue,pend);
263  if (k == MaxImageStackDepth)
264  ThrowStreamException(OptionError,"ParenthesisNestedTooDeeply",option);
265  PushImageStack();
266  continue;
267  }
268  if (LocaleCompare(option,")") == 0)
269  {
270  FireImageStack(MagickFalse,MagickTrue,MagickTrue);
271  if (k == 0)
272  ThrowStreamException(OptionError,"UnableToParseExpression",option);
273  PopImageStack();
274  continue;
275  }
276  if (IsCommandOption(option) == MagickFalse)
277  {
278  Image
279  *images;
280 
281  /*
282  Stream input image.
283  */
284  FireImageStack(MagickFalse,MagickFalse,pend);
285  filename=argv[i];
286  if ((LocaleCompare(filename,"--") == 0) && (i < (ssize_t) (argc-1)))
287  filename=argv[++i];
288  (void) CopyMagickString(image_info->filename,filename,MaxTextExtent);
289  images=StreamImage(image_info,stream_info,exception);
290  status&=(images != (Image *) NULL) &&
291  (exception->severity < ErrorException);
292  if (images == (Image *) NULL)
293  continue;
294  AppendImageStack(images);
295  continue;
296  }
297  pend=image != (Image *) NULL ? MagickTrue : MagickFalse;
298  switch (*(option+1))
299  {
300  case 'a':
301  {
302  if (LocaleCompare("authenticate",option+1) == 0)
303  {
304  if (*option == '+')
305  break;
306  i++;
307  if (i == (ssize_t) argc)
308  ThrowStreamException(OptionError,"MissingArgument",option);
309  break;
310  }
311  ThrowStreamException(OptionError,"UnrecognizedOption",option)
312  }
313  case 'c':
314  {
315  if (LocaleCompare("cache",option+1) == 0)
316  {
317  if (*option == '+')
318  break;
319  i++;
320  if (i == (ssize_t) argc)
321  ThrowStreamException(OptionError,"MissingArgument",option);
322  if (IsGeometry(argv[i]) == MagickFalse)
323  ThrowStreamInvalidArgumentException(option,argv[i]);
324  break;
325  }
326  if (LocaleCompare("channel",option+1) == 0)
327  {
328  ssize_t
329  channel;
330 
331  if (*option == '+')
332  break;
333  i++;
334  if (i == (ssize_t) argc)
335  ThrowStreamException(OptionError,"MissingArgument",option);
336  channel=ParseChannelOption(argv[i]);
337  if (channel < 0)
338  ThrowStreamException(OptionError,"UnrecognizedChannelType",
339  argv[i]);
340  break;
341  }
342  if (LocaleCompare("colorspace",option+1) == 0)
343  {
344  ssize_t
345  colorspace;
346 
347  if (*option == '+')
348  break;
349  i++;
350  if (i == (ssize_t) argc)
351  ThrowStreamException(OptionError,"MissingArgument",option);
352  colorspace=ParseCommandOption(MagickColorspaceOptions,MagickFalse,
353  argv[i]);
354  if (colorspace < 0)
355  ThrowStreamException(OptionError,"UnrecognizedColorspace",
356  argv[i]);
357  break;
358  }
359  if (LocaleCompare("compress",option+1) == 0)
360  {
361  ssize_t
362  compress;
363 
364  if (*option == '+')
365  break;
366  i++;
367  if (i == (ssize_t) argc)
368  ThrowStreamException(OptionError,"MissingArgument",option);
369  compress=ParseCommandOption(MagickCompressOptions,MagickFalse,
370  argv[i]);
371  if (compress < 0)
372  ThrowStreamException(OptionError,"UnrecognizedImageCompression",
373  argv[i]);
374  break;
375  }
376  if (LocaleCompare("concurrent",option+1) == 0)
377  break;
378  ThrowStreamException(OptionError,"UnrecognizedOption",option)
379  }
380  case 'd':
381  {
382  if (LocaleCompare("debug",option+1) == 0)
383  {
384  ssize_t
385  event;
386 
387  if (*option == '+')
388  break;
389  i++;
390  if (i == (ssize_t) argc)
391  ThrowStreamException(OptionError,"MissingArgument",option);
392  event=ParseCommandOption(MagickLogEventOptions,MagickFalse,argv[i]);
393  if (event < 0)
394  ThrowStreamException(OptionError,"UnrecognizedEventType",argv[i]);
395  (void) SetLogEventMask(argv[i]);
396  break;
397  }
398  if (LocaleCompare("define",option+1) == 0)
399  {
400  i++;
401  if (i == (ssize_t) argc)
402  ThrowStreamException(OptionError,"MissingArgument",option);
403  if (*option == '+')
404  {
405  const char
406  *define;
407 
408  define=GetImageOption(image_info,argv[i]);
409  if (define == (const char *) NULL)
410  ThrowStreamException(OptionError,"NoSuchOption",argv[i]);
411  break;
412  }
413  break;
414  }
415  if (LocaleCompare("density",option+1) == 0)
416  {
417  if (*option == '+')
418  break;
419  i++;
420  if (i == (ssize_t) argc)
421  ThrowStreamException(OptionError,"MissingArgument",option);
422  if (IsGeometry(argv[i]) == MagickFalse)
423  ThrowStreamInvalidArgumentException(option,argv[i]);
424  break;
425  }
426  if (LocaleCompare("depth",option+1) == 0)
427  {
428  if (*option == '+')
429  break;
430  i++;
431  if (i == (ssize_t) argc)
432  ThrowStreamException(OptionError,"MissingArgument",option);
433  if (IsGeometry(argv[i]) == MagickFalse)
434  ThrowStreamInvalidArgumentException(option,argv[i]);
435  break;
436  }
437  if (LocaleCompare("duration",option+1) == 0)
438  {
439  if (*option == '+')
440  break;
441  i++;
442  if (i == (ssize_t) argc)
443  ThrowStreamException(OptionError,"MissingArgument",option);
444  if (IsGeometry(argv[i]) == MagickFalse)
445  ThrowStreamInvalidArgumentException(option,argv[i]);
446  break;
447  }
448  ThrowStreamException(OptionError,"UnrecognizedOption",option)
449  }
450  case 'e':
451  {
452  if (LocaleCompare("extract",option+1) == 0)
453  {
454  if (*option == '+')
455  break;
456  i++;
457  if (i == (ssize_t) argc)
458  ThrowStreamException(OptionError,"MissingArgument",option);
459  if (IsGeometry(argv[i]) == MagickFalse)
460  ThrowStreamInvalidArgumentException(option,argv[i]);
461  break;
462  }
463  ThrowStreamException(OptionError,"UnrecognizedOption",option)
464  }
465  case 'h':
466  {
467  if ((LocaleCompare("help",option+1) == 0) ||
468  (LocaleCompare("-help",option+1) == 0))
469  {
470  DestroyStream();
471  return(StreamUsage());
472  }
473  ThrowStreamException(OptionError,"UnrecognizedOption",option)
474  }
475  case 'i':
476  {
477  if (LocaleCompare("identify",option+1) == 0)
478  break;
479  if (LocaleCompare("interlace",option+1) == 0)
480  {
481  ssize_t
482  interlace;
483 
484  if (*option == '+')
485  break;
486  i++;
487  if (i == (ssize_t) argc)
488  ThrowStreamException(OptionError,"MissingArgument",option);
489  interlace=ParseCommandOption(MagickInterlaceOptions,MagickFalse,
490  argv[i]);
491  if (interlace < 0)
492  ThrowStreamException(OptionError,"UnrecognizedInterlaceType",
493  argv[i]);
494  break;
495  }
496  if (LocaleCompare("interpolate",option+1) == 0)
497  {
498  ssize_t
499  interpolate;
500 
501  if (*option == '+')
502  break;
503  i++;
504  if (i == (ssize_t) argc)
505  ThrowStreamException(OptionError,"MissingArgument",option);
506  interpolate=ParseCommandOption(MagickInterpolateOptions,MagickFalse,
507  argv[i]);
508  if (interpolate < 0)
509  ThrowStreamException(OptionError,"UnrecognizedInterpolateMethod",
510  argv[i]);
511  break;
512  }
513  ThrowStreamException(OptionError,"UnrecognizedOption",option)
514  }
515  case 'l':
516  {
517  if (LocaleCompare("limit",option+1) == 0)
518  {
519  char
520  *p;
521 
522  double
523  value;
524 
525  ssize_t
526  resource;
527 
528  if (*option == '+')
529  break;
530  i++;
531  if (i == (ssize_t) argc)
532  ThrowStreamException(OptionError,"MissingArgument",option);
533  resource=ParseCommandOption(MagickResourceOptions,MagickFalse,
534  argv[i]);
535  if (resource < 0)
536  ThrowStreamException(OptionError,"UnrecognizedResourceType",
537  argv[i]);
538  i++;
539  if (i == (ssize_t) argc)
540  ThrowStreamException(OptionError,"MissingArgument",option);
541  value=StringToDouble(argv[i],&p);
542  (void) value;
543  if ((p == argv[i]) && (LocaleCompare("unlimited",argv[i]) != 0))
544  ThrowStreamInvalidArgumentException(option,argv[i]);
545  break;
546  }
547  if (LocaleCompare("list",option+1) == 0)
548  {
549  ssize_t
550  list;
551 
552  if (*option == '+')
553  break;
554  i++;
555  if (i == (ssize_t) argc)
556  ThrowStreamException(OptionError,"MissingArgument",option);
557  list=ParseCommandOption(MagickListOptions,MagickFalse,argv[i]);
558  if (list < 0)
559  ThrowStreamException(OptionError,"UnrecognizedListType",argv[i]);
560  status=MogrifyImageInfo(image_info,(int) (i-j+1),(const char **)
561  argv+j,exception);
562  DestroyStream();
563  return(status == 0 ? MagickFalse : MagickTrue);
564  }
565  if (LocaleCompare("log",option+1) == 0)
566  {
567  if (*option == '+')
568  break;
569  i++;
570  if ((i == (ssize_t) argc) || (strchr(argv[i],'%') == (char *) NULL))
571  ThrowStreamException(OptionError,"MissingArgument",option);
572  break;
573  }
574  ThrowStreamException(OptionError,"UnrecognizedOption",option)
575  }
576  case 'm':
577  {
578  if (LocaleCompare("map",option+1) == 0)
579  {
580  (void) CopyMagickString(argv[i]+1,"san",MaxTextExtent);
581  if (*option == '+')
582  break;
583  i++;
584  SetStreamInfoMap(stream_info,argv[i]);
585  break;
586  }
587  if (LocaleCompare("monitor",option+1) == 0)
588  break;
589  ThrowStreamException(OptionError,"UnrecognizedOption",option)
590  }
591  case 'q':
592  {
593  if (LocaleCompare("quantize",option+1) == 0)
594  {
595  ssize_t
596  colorspace;
597 
598  if (*option == '+')
599  break;
600  i++;
601  if (i == (ssize_t) argc)
602  ThrowStreamException(OptionError,"MissingArgument",option);
603  colorspace=ParseCommandOption(MagickColorspaceOptions,
604  MagickFalse,argv[i]);
605  if (colorspace < 0)
606  ThrowStreamException(OptionError,"UnrecognizedColorspace",
607  argv[i]);
608  break;
609  }
610  if (LocaleCompare("quiet",option+1) == 0)
611  break;
612  ThrowStreamException(OptionError,"UnrecognizedOption",option)
613  }
614  case 'r':
615  {
616  if (LocaleCompare("regard-warnings",option+1) == 0)
617  break;
618  if (LocaleNCompare("respect-parentheses",option+1,17) == 0)
619  {
620  respect_parenthesis=(*option == '-') ? MagickTrue : MagickFalse;
621  break;
622  }
623  ThrowStreamException(OptionError,"UnrecognizedOption",option)
624  }
625  case 's':
626  {
627  if (LocaleCompare("sampling-factor",option+1) == 0)
628  {
629  if (*option == '+')
630  break;
631  i++;
632  if (i == (ssize_t) argc)
633  ThrowStreamException(OptionError,"MissingArgument",option);
634  if (IsGeometry(argv[i]) == MagickFalse)
635  ThrowStreamInvalidArgumentException(option,argv[i]);
636  break;
637  }
638  if (LocaleCompare("seed",option+1) == 0)
639  {
640  if (*option == '+')
641  break;
642  i++;
643  if (i == (ssize_t) argc)
644  ThrowStreamException(OptionError,"MissingArgument",option);
645  if (IsGeometry(argv[i]) == MagickFalse)
646  ThrowStreamInvalidArgumentException(option,argv[i]);
647  break;
648  }
649  if (LocaleCompare("set",option+1) == 0)
650  {
651  i++;
652  if (i == (ssize_t) argc)
653  ThrowStreamException(OptionError,"MissingArgument",option);
654  if (*option == '+')
655  break;
656  i++;
657  if (i == (ssize_t) argc)
658  ThrowStreamException(OptionError,"MissingArgument",option);
659  break;
660  }
661  if (LocaleCompare("size",option+1) == 0)
662  {
663  if (*option == '+')
664  break;
665  i++;
666  if (i == (ssize_t) argc)
667  ThrowStreamException(OptionError,"MissingArgument",option);
668  if (IsGeometry(argv[i]) == MagickFalse)
669  ThrowStreamInvalidArgumentException(option,argv[i]);
670  break;
671  }
672  if (LocaleCompare("storage-type",option+1) == 0)
673  {
674  ssize_t
675  type;
676 
677  if (*option == '+')
678  break;
679  i++;
680  if (i == (ssize_t) argc)
681  ThrowStreamException(OptionError,"MissingArgument",option);
682  type=ParseCommandOption(MagickStorageOptions,MagickFalse,argv[i]);
683  if (type < 0)
684  ThrowStreamException(OptionError,"UnrecognizedStorageType",
685  argv[i]);
686  SetStreamInfoStorageType(stream_info,(StorageType) type);
687  break;
688  }
689  if (LocaleCompare("synchronize",option+1) == 0)
690  break;
691  ThrowStreamException(OptionError,"UnrecognizedOption",option)
692  }
693  case 't':
694  {
695  if (LocaleCompare("taint",option+1) == 0)
696  break;
697  if (LocaleCompare("transparent-color",option+1) == 0)
698  {
699  if (*option == '+')
700  break;
701  i++;
702  if (i == (ssize_t) argc)
703  ThrowStreamException(OptionError,"MissingArgument",option);
704  break;
705  }
706  ThrowStreamException(OptionError,"UnrecognizedOption",option)
707  }
708  case 'v':
709  {
710  if (LocaleCompare("verbose",option+1) == 0)
711  break;
712  if ((LocaleCompare("version",option+1) == 0) ||
713  (LocaleCompare("-version",option+1) == 0))
714  {
715  ListMagickVersion(stdout);
716  break;
717  }
718  if (LocaleCompare("virtual-pixel",option+1) == 0)
719  {
720  ssize_t
721  method;
722 
723  if (*option == '+')
724  break;
725  i++;
726  if (i == (ssize_t) argc)
727  ThrowStreamException(OptionError,"MissingArgument",option);
728  method=ParseCommandOption(MagickVirtualPixelOptions,MagickFalse,
729  argv[i]);
730  if (method < 0)
731  ThrowStreamException(OptionError,"UnrecognizedVirtualPixelMethod",
732  argv[i]);
733  break;
734  }
735  ThrowStreamException(OptionError,"UnrecognizedOption",option)
736  }
737  case '?':
738  break;
739  default:
740  ThrowStreamException(OptionError,"UnrecognizedOption",option)
741  }
742  fire=(GetCommandOptionFlags(MagickCommandOptions,MagickFalse,option) &
743  FireOptionFlag) == 0 ? MagickFalse : MagickTrue;
744  if (fire != MagickFalse)
745  FireImageStack(MagickFalse,MagickTrue,MagickTrue);
746  }
747  if (k != 0)
748  ThrowStreamException(OptionError,"UnbalancedParenthesis",argv[i]);
749  if (i-- != (ssize_t) (argc-1))
750  ThrowStreamException(OptionError,"MissingAnImageFilename",argv[i]);
751  if (image == (Image *) NULL)
752  ThrowStreamException(OptionError,"MissingAnImageFilename",argv[i]);
753  FinalizeImageSettings(image_info,image,MagickTrue);
754  if (image == (Image *) NULL)
755  ThrowStreamException(OptionError,"MissingAnImageFilename",argv[i]);
756  DestroyStream();
757  return(status != 0 ? MagickTrue : MagickFalse);
758 }