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