1 /*
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 % %
4 % %
5 % %
6 % AAA N N IIIII M M AAA TTTTT EEEEE %
7 % A A NN N I MM MM A A T E %
8 % AAAAA N N N I M M M AAAAA T EEE %
9 % A A N NN I M M A A T E %
10 % A A N N IIIII M M A A T EEEEE %
11 % %
12 % %
13 % Methods to Interactively Animate an Image Sequence %
14 % %
15 % Software Design %
16 % Cristy %
17 % July 1992 %
18 % %
19 % %
20 % Copyright 1999-2021 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 % Use the animate program to animate an image sequence on any X server.
37 %
38 */
39
40 /*
41 Include declarations.
42 */
43 #include "MagickWand/studio.h"
44 #include "MagickWand/MagickWand.h"
45 #include "MagickWand/mogrify-private.h"
46 #include "MagickCore/animate-private.h"
47 #include "MagickCore/string-private.h"
48
49 /*
50 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
51 % %
52 % %
53 % %
54 + A n i m a t e I m a g e C o m m a n d %
55 % %
56 % %
57 % %
58 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
59 %
60 % AnimateImageCommand() displays a sequence of images on any workstation
61 % display running an X server. Animate first determines the hardware
62 % capabilities of the workstation. If the number of unique colors in an image
63 % is less than or equal to the number the workstation can support, the image
64 % is displayed in an X window. Otherwise the number of colors in the image is
65 % first reduced to match the color resolution of the workstation before it is
66 % displayed.
67 %
68 % This means that a continuous-tone 24 bits/pixel image can display on a 8
69 % bit pseudo-color device or monochrome device. In most instances the reduced
70 % color image closely resembles the original. Alternatively, a monochrome or
71 % pseudo-color image sequence can display on a continuous-tone 24 bits/pixels
72 % device.
73 %
74 % The format of the AnimateImageCommand method is:
75 %
76 % MagickBooleanType AnimateImageCommand(ImageInfo *image_info,int argc,
77 % char **argv,char **metadata,ExceptionInfo *exception)
78 %
79 % A description of each parameter follows:
80 %
81 % o image_info: the image info.
82 %
83 % o argc: the number of elements in the argument vector.
84 %
85 % o argv: A text array containing the command line arguments.
86 %
87 % o metadata: any metadata is returned here.
88 %
89 % o exception: return any errors or warnings in this structure.
90 %
91 */
92
AnimateUsage(void)93 static MagickBooleanType AnimateUsage(void)
94 {
95 static const char
96 buttons[] =
97 " Press any button to map or unmap the Command widget",
98 miscellaneous[] =
99 " -debug events display copious debugging information\n"
100 " -help print program options\n"
101 " -list type print a list of supported option arguments\n"
102 " -log format format of debugging information\n"
103 " -version print version information",
104 operators[] =
105 " -channel mask set the image channel mask\n"
106 " -colors value preferred number of colors in the image\n"
107 " -crop geometry preferred size and location of the cropped image\n"
108 " -extent geometry set the image size\n"
109 " -extract geometry extract area from image\n"
110 " -monochrome transform image to black and white\n"
111 " -resample geometry change the resolution of an image\n"
112 " -resize geometry resize the image\n"
113 " -rotate degrees apply Paeth rotation to the image\n"
114 " -strip strip image of all profiles and comments\n"
115 " -thumbnail geometry create a thumbnail of the image\n"
116 " -trim trim image edges",
117 settings[] =
118 " -alpha option on, activate, off, deactivate, set, opaque, copy\n"
119 " transparent, extract, background, or shape\n"
120 " -authenticate password\n"
121 " decipher image with this password\n"
122 " -backdrop display image centered on a backdrop\n"
123 " -colormap type Shared or Private\n"
124 " -colorspace type alternate image colorspace\n"
125 " -decipher filename convert cipher pixels to plain pixels\n"
126 " -define format:option\n"
127 " define one or more image format options\n"
128 " -delay value display the next image after pausing\n"
129 " -density geometry horizontal and vertical density of the image\n"
130 " -depth value image depth\n"
131 " -display server display image to this X server\n"
132 " -dispose method layer disposal method\n"
133 " -dither method apply error diffusion to image\n"
134 " -filter type use this filter when resizing an image\n"
135 " -format \"string\" output formatted image characteristics\n"
136 " -gamma value level of gamma correction\n"
137 " -geometry geometry preferred size and location of the Image window\n"
138 " -gravity type horizontal and vertical backdrop placement\n"
139 " -identify identify the format and characteristics of the image\n"
140 " -immutable displayed image cannot be modified\n"
141 " -interlace type type of image interlacing scheme\n"
142 " -interpolate method pixel color interpolation method\n"
143 " -limit type value pixel cache resource limit\n"
144 " -loop iterations loop images then exit\n"
145 " -matte store matte channel if the image has one\n"
146 " -map type display image using this Standard Colormap\n"
147 " -monitor monitor progress\n"
148 " -pause seconds to pause before reanimating\n"
149 " -page geometry size and location of an image canvas (setting)\n"
150 " -quantize colorspace reduce colors in this colorspace\n"
151 " -quiet suppress all warning messages\n"
152 " -regard-warnings pay attention to warning messages\n"
153 " -remote command execute a command in an remote display process\n"
154 " -repage geometry size and location of an image canvas (operator)\n"
155 " -respect-parentheses settings remain in effect until parenthesis boundary\n"
156 " -sampling-factor geometry\n"
157 " horizontal and vertical sampling factor\n"
158 " -scenes range image scene range\n"
159 " -seed value seed a new sequence of pseudo-random numbers\n"
160 " -set attribute value set an image attribute\n"
161 " -size geometry width and height of image\n"
162 " -support factor resize support: > 1.0 is blurry, < 1.0 is sharp\n"
163 " -transparent-color color\n"
164 " transparent color\n"
165 " -treedepth value color tree depth\n"
166 " -verbose print detailed information about the image\n"
167 " -visual type display image using this visual type\n"
168 " -virtual-pixel method\n"
169 " virtual pixel access method\n"
170 " -window id display image to background of this window",
171 sequence_operators[] =
172 " -coalesce merge a sequence of images\n"
173 " -flatten flatten a sequence of images";
174
175 ListMagickVersion(stdout);
176 (void) printf("Usage: %s [options ...] file [ [options ...] file ...]\n",
177 GetClientName());
178 (void) printf("\nImage Settings:\n");
179 (void) puts(settings);
180 (void) printf("\nImage Operators:\n");
181 (void) puts(operators);
182 (void) printf("\nImage Sequence Operators:\n");
183 (void) puts(sequence_operators);
184 (void) printf("\nMiscellaneous Options:\n");
185 (void) puts(miscellaneous);
186 (void) printf(
187 "\nIn addition to those listed above, you can specify these standard X\n");
188 (void) printf(
189 "resources as command line options: -background, -bordercolor,\n");
190 (void) printf(
191 "-mattecolor, -borderwidth, -font, -foreground, -iconGeometry,\n");
192 (void) printf("-iconic, -name, -shared-memory, or -title.\n");
193 (void) printf(
194 "\nBy default, the image format of 'file' is determined by its magic\n");
195 (void) printf(
196 "number. To specify a particular image format, precede the filename\n");
197 (void) printf(
198 "with an image format name and a colon (i.e. ps:image) or specify the\n");
199 (void) printf(
200 "image type as the filename suffix (i.e. image.ps). Specify 'file' as\n");
201 (void) printf("'-' for standard input or output.\n");
202 (void) printf("\nButtons: \n");
203 (void) puts(buttons);
204 return(MagickTrue);
205 }
206
AnimateImageCommand(ImageInfo * image_info,int argc,char ** argv,char ** wand_unused (metadata),ExceptionInfo * exception)207 WandExport MagickBooleanType AnimateImageCommand(ImageInfo *image_info,
208 int argc,char **argv,char **wand_unused(metadata),ExceptionInfo *exception)
209 {
210 #if defined(MAGICKCORE_X11_DELEGATE)
211 #define DestroyAnimate() \
212 { \
213 XDestroyResourceInfo(&resource_info); \
214 if (display != (Display *) NULL) \
215 { \
216 XCloseDisplay(display); \
217 display=(Display *) NULL; \
218 } \
219 XDestroyResourceInfo(&resource_info); \
220 DestroyImageStack(); \
221 for (i=0; i < (ssize_t) argc; i++) \
222 argv[i]=DestroyString(argv[i]); \
223 argv=(char **) RelinquishMagickMemory(argv); \
224 }
225 #define ThrowAnimateException(asperity,tag,option) \
226 { \
227 (void) ThrowMagickException(exception,GetMagickModule(),asperity,tag,"`%s'", \
228 option); \
229 DestroyAnimate(); \
230 return(MagickFalse); \
231 }
232 #define ThrowAnimateInvalidArgumentException(option,argument) \
233 { \
234 (void) ThrowMagickException(exception,GetMagickModule(),OptionError, \
235 "InvalidArgument","'%s': %s",option,argument); \
236 DestroyAnimate(); \
237 return(MagickFalse); \
238 }
239
240 char
241 *resource_value,
242 *server_name;
243
244 const char
245 *option;
246
247 Display
248 *display;
249
250 Image
251 *image;
252
253 ImageStack
254 image_stack[MaxImageStackDepth+1];
255
256 MagickBooleanType
257 fire,
258 pend,
259 respect_parenthesis;
260
261 MagickStatusType
262 status;
263
264 QuantizeInfo
265 *quantize_info;
266
267 ssize_t
268 i;
269
270 ssize_t
271 j,
272 k;
273
274 XResourceInfo
275 resource_info;
276
277 XrmDatabase
278 resource_database;
279
280 /*
281 Set defaults.
282 */
283 assert(image_info != (ImageInfo *) NULL);
284 assert(image_info->signature == MagickCoreSignature);
285 if (image_info->debug != MagickFalse)
286 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
287 assert(exception != (ExceptionInfo *) NULL);
288 if (argc == 2)
289 {
290 option=argv[1];
291 if ((LocaleCompare("version",option+1) == 0) ||
292 (LocaleCompare("-version",option+1) == 0))
293 {
294 ListMagickVersion(stdout);
295 return(MagickTrue);
296 }
297 }
298 status=MagickTrue;
299 SetNotifyHandlers;
300 display=(Display *) NULL;
301 j=1;
302 k=0;
303 NewImageStack();
304 option=(char *) NULL;
305 pend=MagickFalse;
306 respect_parenthesis=MagickFalse;
307 resource_database=(XrmDatabase) NULL;
308 (void) memset(&resource_info,0,sizeof(XResourceInfo));
309 server_name=(char *) NULL;
310 status=MagickTrue;
311 /*
312 Check for server name specified on the command line.
313 */
314 ReadCommandlLine(argc,&argv);
315 status=ExpandFilenames(&argc,&argv);
316 if (status == MagickFalse)
317 ThrowAnimateException(ResourceLimitError,"MemoryAllocationFailed",
318 image_info->filename);
319 for (i=1; i < (ssize_t) argc; i++)
320 {
321 /*
322 Check command line for server name.
323 */
324 option=argv[i];
325 if (IsCommandOption(option) == MagickFalse)
326 continue;
327 if (LocaleCompare("display",option+1) == 0)
328 {
329 /*
330 User specified server name.
331 */
332 i++;
333 if (i == (ssize_t) argc)
334 ThrowAnimateException(OptionError,"MissingArgument",option);
335 server_name=argv[i];
336 }
337 if ((LocaleCompare("help",option+1) == 0) ||
338 (LocaleCompare("-help",option+1) == 0))
339 {
340 DestroyAnimate();
341 return(AnimateUsage());
342 }
343 }
344 /*
345 Get user defaults from X resource database.
346 */
347 display=XOpenDisplay(server_name);
348 if (display == (Display *) NULL)
349 ThrowAnimateException(XServerError,"UnableToOpenXServer",
350 XDisplayName(server_name));
351 (void) XSetErrorHandler(XError);
352 resource_database=XGetResourceDatabase(display,GetClientName());
353 XGetResourceInfo(image_info,resource_database,GetClientName(),
354 &resource_info);
355 quantize_info=resource_info.quantize_info;
356 image_info->density=XGetResourceInstance(resource_database,GetClientName(),
357 "density",(char *) NULL);
358 if (image_info->density == (char *) NULL)
359 image_info->density=XGetScreenDensity(display);
360 resource_value=XGetResourceInstance(resource_database,GetClientName(),
361 "interlace","none");
362 image_info->interlace=(InterlaceType)
363 ParseCommandOption(MagickInterlaceOptions,MagickFalse,resource_value);
364 resource_value=XGetResourceInstance(resource_database,GetClientName(),
365 "verbose","False");
366 image_info->verbose=IsStringTrue(resource_value);
367 resource_value=XGetResourceInstance(resource_database,GetClientName(),
368 "dither","True");
369 quantize_info->dither_method=IsStringTrue(resource_value) != MagickFalse ?
370 RiemersmaDitherMethod : NoDitherMethod;
371 /*
372 Parse command line.
373 */
374 for (i=1; i <= (ssize_t) argc; i++)
375 {
376 if (i < (ssize_t) argc)
377 option=argv[i];
378 else
379 if (image != (Image *) NULL)
380 break;
381 else
382 if (isatty(STDIN_FILENO) != MagickFalse)
383 option="logo:";
384 else
385 option="-";
386 if (LocaleCompare(option,"(") == 0)
387 {
388 FireImageStack(MagickFalse,MagickTrue,pend);
389 if (k == MaxImageStackDepth)
390 ThrowAnimateException(OptionError,"ParenthesisNestedTooDeeply",
391 option);
392 PushImageStack();
393 continue;
394 }
395 if (LocaleCompare(option,")") == 0)
396 {
397 FireImageStack(MagickFalse,MagickTrue,MagickTrue);
398 if (k == 0)
399 ThrowAnimateException(OptionError,"UnableToParseExpression",option);
400 PopImageStack();
401 continue;
402 }
403 if (IsCommandOption(option) == MagickFalse)
404 {
405 const char
406 *filename;
407
408 Image
409 *images;
410
411 /*
412 Read input image.
413 */
414 FireImageStack(MagickFalse,MagickFalse,pend);
415 filename=option;
416 if ((LocaleCompare(filename,"--") == 0) && (i < (ssize_t) (argc-1)))
417 {
418 option=argv[++i];
419 filename=option;
420 }
421 if (image_info->ping != MagickFalse)
422 images=PingImages(image_info,filename,exception);
423 else
424 images=ReadImages(image_info,filename,exception);
425 status&=(images != (Image *) NULL) &&
426 (exception->severity < ErrorException);
427 if (images == (Image *) NULL)
428 continue;
429 AppendImageStack(images);
430 continue;
431 }
432 pend=image != (Image *) NULL ? MagickTrue : MagickFalse;
433 switch (*(option+1))
434 {
435 case 'a':
436 {
437 if (LocaleCompare("alpha",option+1) == 0)
438 {
439 ssize_t
440 type;
441
442 if (*option == '+')
443 break;
444 i++;
445 if (i == (ssize_t) argc)
446 ThrowAnimateException(OptionError,"MissingArgument",option);
447 type=ParseCommandOption(MagickAlphaChannelOptions,MagickFalse,
448 argv[i]);
449 if (type < 0)
450 ThrowAnimateException(OptionError,
451 "UnrecognizedAlphaChannelOption",argv[i]);
452 break;
453 }
454 if (LocaleCompare("authenticate",option+1) == 0)
455 {
456 if (*option == '+')
457 break;
458 i++;
459 if (i == (ssize_t) argc)
460 ThrowAnimateException(OptionError,"MissingArgument",option);
461 break;
462 }
463 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
464 }
465 case 'b':
466 {
467 if (LocaleCompare("backdrop",option+1) == 0)
468 {
469 resource_info.backdrop=(*option == '-') ? MagickTrue : MagickFalse;
470 break;
471 }
472 if (LocaleCompare("background",option+1) == 0)
473 {
474 if (*option == '+')
475 break;
476 i++;
477 if (i == (ssize_t) argc)
478 ThrowAnimateException(OptionError,"MissingArgument",option);
479 resource_info.background_color=argv[i];
480 break;
481 }
482 if (LocaleCompare("bordercolor",option+1) == 0)
483 {
484 if (*option == '+')
485 break;
486 i++;
487 if (i == (ssize_t) argc)
488 ThrowAnimateException(OptionError,"MissingArgument",option);
489 resource_info.border_color=argv[i];
490 break;
491 }
492 if (LocaleCompare("borderwidth",option+1) == 0)
493 {
494 resource_info.border_width=0;
495 if (*option == '+')
496 break;
497 i++;
498 if ((i == (ssize_t) argc) || (IsGeometry(argv[i]) == MagickFalse))
499 ThrowAnimateException(OptionError,"MissingArgument",option);
500 resource_info.border_width=(unsigned int)
501 StringToUnsignedLong(argv[i]);
502 break;
503 }
504 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
505 }
506 case 'c':
507 {
508 if (LocaleCompare("cache",option+1) == 0)
509 {
510 if (*option == '+')
511 break;
512 i++;
513 if (i == (ssize_t) argc)
514 ThrowAnimateException(OptionError,"MissingArgument",option);
515 if (IsGeometry(argv[i]) == MagickFalse)
516 ThrowAnimateInvalidArgumentException(option,argv[i]);
517 break;
518 }
519 if (LocaleCompare("channel",option+1) == 0)
520 {
521 ssize_t
522 channel;
523
524 if (*option == '+')
525 break;
526 i++;
527 if (i == (ssize_t) argc)
528 ThrowAnimateException(OptionError,"MissingArgument",option);
529 channel=ParseChannelOption(argv[i]);
530 if (channel < 0)
531 ThrowAnimateException(OptionError,"UnrecognizedChannelType",
532 argv[i]);
533 break;
534 }
535 if (LocaleCompare("clone",option+1) == 0)
536 {
537 Image
538 *clone_images;
539
540 clone_images=image;
541 if (k != 0)
542 clone_images=image_stack[k-1].image;
543 if (clone_images == (Image *) NULL)
544 ThrowAnimateException(ImageError,"UnableToCloneImage",option);
545 FireImageStack(MagickFalse,MagickTrue,MagickTrue);
546 if (*option == '+')
547 clone_images=CloneImages(clone_images,"-1",exception);
548 else
549 {
550 i++;
551 if (i == (ssize_t) argc)
552 ThrowAnimateException(OptionError,"MissingArgument",option);
553 if (IsSceneGeometry(argv[i],MagickFalse) == MagickFalse)
554 ThrowAnimateInvalidArgumentException(option,argv[i]);
555 clone_images=CloneImages(clone_images,argv[i],exception);
556 }
557 if (clone_images == (Image *) NULL)
558 ThrowAnimateException(OptionError,"NoSuchImage",option);
559 AppendImageStack(clone_images);
560 break;
561 }
562 if (LocaleCompare("coalesce",option+1) == 0)
563 break;
564 if (LocaleCompare("colormap",option+1) == 0)
565 {
566 resource_info.colormap=PrivateColormap;
567 if (*option == '+')
568 break;
569 i++;
570 if (i == (ssize_t) argc)
571 ThrowAnimateException(OptionError,"MissingArgument",option);
572 resource_info.colormap=UndefinedColormap;
573 if (LocaleCompare("private",argv[i]) == 0)
574 resource_info.colormap=PrivateColormap;
575 if (LocaleCompare("shared",argv[i]) == 0)
576 resource_info.colormap=SharedColormap;
577 if (resource_info.colormap == UndefinedColormap)
578 ThrowAnimateException(OptionError,"UnrecognizedColormapType",
579 argv[i]);
580 break;
581 }
582 if (LocaleCompare("colors",option+1) == 0)
583 {
584 quantize_info->number_colors=0;
585 if (*option == '+')
586 break;
587 i++;
588 if (i == (ssize_t) argc)
589 ThrowAnimateException(OptionError,"MissingArgument",option);
590 if (IsGeometry(argv[i]) == MagickFalse)
591 ThrowAnimateInvalidArgumentException(option,argv[i]);
592 quantize_info->number_colors=StringToUnsignedLong(argv[i]);
593 break;
594 }
595 if (LocaleCompare("colorspace",option+1) == 0)
596 {
597 ssize_t
598 colorspace;
599
600 if (*option == '+')
601 break;
602 i++;
603 if (i == (ssize_t) argc)
604 ThrowAnimateException(OptionError,"MissingArgument",option);
605 colorspace=ParseCommandOption(MagickColorspaceOptions,
606 MagickFalse,argv[i]);
607 if (colorspace < 0)
608 ThrowAnimateException(OptionError,"UnrecognizedColorspace",
609 argv[i]);
610 break;
611 }
612 if (LocaleCompare("concurrent",option+1) == 0)
613 break;
614 if (LocaleCompare("crop",option+1) == 0)
615 {
616 if (*option == '+')
617 break;
618 i++;
619 if (i == (ssize_t) argc)
620 ThrowAnimateException(OptionError,"MissingArgument",option);
621 if (IsGeometry(argv[i]) == MagickFalse)
622 ThrowAnimateInvalidArgumentException(option,argv[i]);
623 break;
624 }
625 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
626 }
627 case 'd':
628 {
629 if (LocaleCompare("debug",option+1) == 0)
630 {
631 ssize_t
632 event;
633
634 if (*option == '+')
635 break;
636 i++;
637 if (i == (ssize_t) argc)
638 ThrowAnimateException(OptionError,"MissingArgument",option);
639 event=ParseCommandOption(MagickLogEventOptions,MagickFalse,argv[i]);
640 if (event < 0)
641 ThrowAnimateException(OptionError,"UnrecognizedEventType",
642 argv[i]);
643 (void) SetLogEventMask(argv[i]);
644 break;
645 }
646 if (LocaleCompare("decipher",option+1) == 0)
647 {
648 if (*option == '+')
649 break;
650 i++;
651 if (i == (ssize_t) argc)
652 ThrowAnimateException(OptionError,"MissingArgument",option);
653 break;
654 }
655 if (LocaleCompare("define",option+1) == 0)
656 {
657 i++;
658 if (i == (ssize_t) argc)
659 ThrowAnimateException(OptionError,"MissingArgument",option);
660 if (*option == '+')
661 {
662 const char
663 *define;
664
665 define=GetImageOption(image_info,argv[i]);
666 if (define == (const char *) NULL)
667 ThrowAnimateException(OptionError,"NoSuchOption",argv[i]);
668 break;
669 }
670 break;
671 }
672 if (LocaleCompare("delay",option+1) == 0)
673 {
674 if (*option == '+')
675 break;
676 i++;
677 if (i == (ssize_t) argc)
678 ThrowAnimateException(OptionError,"MissingArgument",option);
679 if (IsGeometry(argv[i]) == MagickFalse)
680 ThrowAnimateInvalidArgumentException(option,argv[i]);
681 break;
682 }
683 if (LocaleCompare("density",option+1) == 0)
684 {
685 if (*option == '+')
686 break;
687 i++;
688 if (i == (ssize_t) argc)
689 ThrowAnimateException(OptionError,"MissingArgument",option);
690 if (IsGeometry(argv[i]) == MagickFalse)
691 ThrowAnimateInvalidArgumentException(option,argv[i]);
692 break;
693 }
694 if (LocaleCompare("depth",option+1) == 0)
695 {
696 if (*option == '+')
697 break;
698 i++;
699 if (i == (ssize_t) argc)
700 ThrowAnimateException(OptionError,"MissingArgument",option);
701 if (IsGeometry(argv[i]) == MagickFalse)
702 ThrowAnimateInvalidArgumentException(option,argv[i]);
703 break;
704 }
705 if (LocaleCompare("display",option+1) == 0)
706 {
707 if (*option == '+')
708 break;
709 i++;
710 if (i == (ssize_t) argc)
711 ThrowAnimateException(OptionError,"MissingArgument",option);
712 break;
713 }
714 if (LocaleCompare("dispose",option+1) == 0)
715 {
716 ssize_t
717 dispose;
718
719 if (*option == '+')
720 break;
721 i++;
722 if (i == (ssize_t) argc)
723 ThrowAnimateException(OptionError,"MissingArgument",option);
724 dispose=ParseCommandOption(MagickDisposeOptions,MagickFalse,argv[i]);
725 if (dispose < 0)
726 ThrowAnimateException(OptionError,"UnrecognizedDisposeMethod",
727 argv[i]);
728 break;
729 }
730 if (LocaleCompare("dither",option+1) == 0)
731 {
732 ssize_t
733 method;
734
735 quantize_info->dither_method=NoDitherMethod;
736 if (*option == '+')
737 break;
738 i++;
739 if (i == (ssize_t) argc)
740 ThrowAnimateException(OptionError,"MissingArgument",option);
741 method=ParseCommandOption(MagickDitherOptions,MagickFalse,argv[i]);
742 if (method < 0)
743 ThrowAnimateException(OptionError,"UnrecognizedDitherMethod",
744 argv[i]);
745 quantize_info->dither_method=(DitherMethod) method;
746 break;
747 }
748 if (LocaleCompare("duration",option+1) == 0)
749 {
750 if (*option == '+')
751 break;
752 i++;
753 if (i == (ssize_t) argc)
754 ThrowAnimateException(OptionError,"MissingArgument",option);
755 if (IsGeometry(argv[i]) == MagickFalse)
756 ThrowAnimateInvalidArgumentException(option,argv[i]);
757 break;
758 }
759 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
760 }
761 case 'e':
762 {
763 if (LocaleCompare("extent",option+1) == 0)
764 {
765 if (*option == '+')
766 break;
767 i++;
768 if (i == (ssize_t) argc)
769 ThrowAnimateException(OptionError,"MissingArgument",option);
770 if (IsGeometry(argv[i]) == MagickFalse)
771 ThrowAnimateInvalidArgumentException(option,argv[i]);
772 break;
773 }
774 if (LocaleCompare("extract",option+1) == 0)
775 {
776 if (*option == '+')
777 break;
778 i++;
779 if (i == (ssize_t) argc)
780 ThrowAnimateException(OptionError,"MissingArgument",option);
781 if (IsGeometry(argv[i]) == MagickFalse)
782 ThrowAnimateInvalidArgumentException(option,argv[i]);
783 break;
784 }
785 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
786 }
787 case 'f':
788 {
789 if (LocaleCompare("filter",option+1) == 0)
790 {
791 ssize_t
792 filter;
793
794 if (*option == '+')
795 break;
796 i++;
797 if (i == (ssize_t) argc)
798 ThrowAnimateException(OptionError,"MissingArgument",option);
799 filter=ParseCommandOption(MagickFilterOptions,MagickFalse,argv[i]);
800 if (filter < 0)
801 ThrowAnimateException(OptionError,"UnrecognizedImageFilter",
802 argv[i]);
803 break;
804 }
805 if (LocaleCompare("flatten",option+1) == 0)
806 break;
807 if (LocaleCompare("font",option+1) == 0)
808 {
809 if (*option == '+')
810 break;
811 i++;
812 if (i == (ssize_t) argc)
813 ThrowAnimateException(OptionError,"MissingArgument",option);
814 resource_info.font=XGetResourceClass(resource_database,
815 GetClientName(),"font",argv[i]);
816 break;
817 }
818 if (LocaleCompare("foreground",option+1) == 0)
819 {
820 if (*option == '+')
821 break;
822 i++;
823 if (i == (ssize_t) argc)
824 ThrowAnimateException(OptionError,"MissingArgument",option);
825 resource_info.foreground_color=argv[i];
826 break;
827 }
828 if (LocaleCompare("format",option+1) == 0)
829 {
830 if (*option == '+')
831 break;
832 i++;
833 if (i == (ssize_t) argc)
834 ThrowAnimateException(OptionError,"MissingArgument",option);
835 break;
836 }
837 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
838 }
839 case 'g':
840 {
841 if (LocaleCompare("gamma",option+1) == 0)
842 {
843 i++;
844 if (i == (ssize_t) argc)
845 ThrowAnimateException(OptionError,"MissingArgument",option);
846 if (IsGeometry(argv[i]) == MagickFalse)
847 ThrowAnimateInvalidArgumentException(option,argv[i]);
848 break;
849 }
850 if (LocaleCompare("geometry",option+1) == 0)
851 {
852 resource_info.image_geometry=(char *) NULL;
853 if (*option == '+')
854 break;
855 i++;
856 if (i == (ssize_t) argc)
857 ThrowAnimateException(OptionError,"MissingArgument",option);
858 if (IsGeometry(argv[i]) == MagickFalse)
859 ThrowAnimateInvalidArgumentException(option,argv[i]);
860 resource_info.image_geometry=ConstantString(argv[i]);
861 break;
862 }
863 if (LocaleCompare("gravity",option+1) == 0)
864 {
865 ssize_t
866 gravity;
867
868 if (*option == '+')
869 break;
870 i++;
871 if (i == (ssize_t) argc)
872 ThrowAnimateException(OptionError,"MissingArgument",option);
873 gravity=ParseCommandOption(MagickGravityOptions,MagickFalse,
874 argv[i]);
875 if (gravity < 0)
876 ThrowAnimateException(OptionError,"UnrecognizedGravityType",
877 argv[i]);
878 break;
879 }
880 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
881 }
882 case 'h':
883 {
884 if ((LocaleCompare("help",option+1) == 0) ||
885 (LocaleCompare("-help",option+1) == 0))
886 break;
887 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
888 }
889 case 'i':
890 {
891 if (LocaleCompare("iconGeometry",option+1) == 0)
892 {
893 resource_info.icon_geometry=(char *) NULL;
894 if (*option == '+')
895 break;
896 i++;
897 if (i == (ssize_t) argc)
898 ThrowAnimateException(OptionError,"MissingArgument",option);
899 if (IsGeometry(argv[i]) == MagickFalse)
900 ThrowAnimateInvalidArgumentException(option,argv[i]);
901 resource_info.icon_geometry=argv[i];
902 break;
903 }
904 if (LocaleCompare("iconic",option+1) == 0)
905 {
906 resource_info.iconic=(*option == '-') ? MagickTrue : MagickFalse;
907 break;
908 }
909 if (LocaleCompare("identify",option+1) == 0)
910 break;
911 if (LocaleCompare("immutable",option+1) == 0)
912 {
913 resource_info.immutable=(*option == '-') ? MagickTrue : MagickFalse;
914 break;
915 }
916 if (LocaleCompare("interlace",option+1) == 0)
917 {
918 ssize_t
919 interlace;
920
921 if (*option == '+')
922 break;
923 i++;
924 if (i == (ssize_t) argc)
925 ThrowAnimateException(OptionError,"MissingArgument",option);
926 interlace=ParseCommandOption(MagickInterlaceOptions,MagickFalse,
927 argv[i]);
928 if (interlace < 0)
929 ThrowAnimateException(OptionError,"UnrecognizedInterlaceType",
930 argv[i]);
931 break;
932 }
933 if (LocaleCompare("interpolate",option+1) == 0)
934 {
935 ssize_t
936 interpolate;
937
938 if (*option == '+')
939 break;
940 i++;
941 if (i == (ssize_t) argc)
942 ThrowAnimateException(OptionError,"MissingArgument",option);
943 interpolate=ParseCommandOption(MagickInterpolateOptions,MagickFalse,
944 argv[i]);
945 if (interpolate < 0)
946 ThrowAnimateException(OptionError,"UnrecognizedInterpolateMethod",
947 argv[i]);
948 break;
949 }
950 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
951 }
952 case 'l':
953 {
954 if (LocaleCompare("label",option+1) == 0)
955 {
956 if (*option == '+')
957 break;
958 i++;
959 if (i == (ssize_t) argc)
960 ThrowAnimateException(OptionError,"MissingArgument",option);
961 break;
962 }
963 if (LocaleCompare("limit",option+1) == 0)
964 {
965 char
966 *p;
967
968 double
969 value;
970
971 ssize_t
972 resource;
973
974 if (*option == '+')
975 break;
976 i++;
977 if (i == (ssize_t) argc)
978 ThrowAnimateException(OptionError,"MissingArgument",option);
979 resource=ParseCommandOption(MagickResourceOptions,MagickFalse,
980 argv[i]);
981 if (resource < 0)
982 ThrowAnimateException(OptionError,"UnrecognizedResourceType",
983 argv[i]);
984 i++;
985 if (i == (ssize_t) argc)
986 ThrowAnimateException(OptionError,"MissingArgument",option);
987 value=StringToDouble(argv[i],&p);
988 (void) value;
989 if ((p == argv[i]) && (LocaleCompare("unlimited",argv[i]) != 0))
990 ThrowAnimateInvalidArgumentException(option,argv[i]);
991 break;
992 }
993 if (LocaleCompare("list",option+1) == 0)
994 {
995 ssize_t
996 list;
997
998 if (*option == '+')
999 break;
1000 i++;
1001 if (i == (ssize_t) argc)
1002 ThrowAnimateException(OptionError,"MissingArgument",option);
1003 list=ParseCommandOption(MagickListOptions,MagickFalse,argv[i]);
1004 if (list < 0)
1005 ThrowAnimateException(OptionError,"UnrecognizedListType",argv[i]);
1006 status=MogrifyImageInfo(image_info,(int) (i-j+1),(const char **)
1007 argv+j,exception);
1008 DestroyAnimate();
1009 return(status == 0 ? MagickFalse : MagickTrue);
1010 }
1011 if (LocaleCompare("log",option+1) == 0)
1012 {
1013 if (*option == '+')
1014 break;
1015 i++;
1016 if ((i == (ssize_t) argc) ||
1017 (strchr(argv[i],'%') == (char *) NULL))
1018 ThrowAnimateException(OptionError,"MissingArgument",option);
1019 break;
1020 }
1021 if (LocaleCompare("loop",option+1) == 0)
1022 {
1023 if (*option == '+')
1024 break;
1025 i++;
1026 if (i == (ssize_t) argc)
1027 ThrowAnimateException(OptionError,"MissingArgument",option);
1028 if (IsGeometry(argv[i]) == MagickFalse)
1029 ThrowAnimateInvalidArgumentException(option,argv[i]);
1030 break;
1031 }
1032 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1033 }
1034 case 'm':
1035 {
1036 if (LocaleCompare("map",option+1) == 0)
1037 {
1038 resource_info.map_type=(char *) NULL;
1039 if (*option == '+')
1040 break;
1041 (void) CopyMagickString(argv[i]+1,"san",MagickPathExtent);
1042 i++;
1043 if (i == (ssize_t) argc)
1044 ThrowAnimateException(OptionError,"MissingArgument",option);
1045 resource_info.map_type=argv[i];
1046 break;
1047 }
1048 if (LocaleCompare("matte",option+1) == 0)
1049 break;
1050 if (LocaleCompare("mattecolor",option+1) == 0)
1051 {
1052 if (*option == '+')
1053 break;
1054 i++;
1055 if (i == (ssize_t) argc)
1056 ThrowAnimateException(OptionError,"MissingArgument",option);
1057 resource_info.matte_color=argv[i];
1058 break;
1059 }
1060 if (LocaleCompare("monitor",option+1) == 0)
1061 break;
1062 if (LocaleCompare("monochrome",option+1) == 0)
1063 {
1064 if (*option == '+')
1065 break;
1066 quantize_info->number_colors=2;
1067 quantize_info->colorspace=GRAYColorspace;
1068 break;
1069 }
1070 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1071 }
1072 case 'n':
1073 {
1074 if (LocaleCompare("name",option+1) == 0)
1075 {
1076 resource_info.name=(char *) NULL;
1077 if (*option == '+')
1078 break;
1079 i++;
1080 if (i == (ssize_t) argc)
1081 ThrowAnimateException(OptionError,"MissingArgument",option);
1082 resource_info.name=ConstantString(argv[i]);
1083 break;
1084 }
1085 if (LocaleCompare("noop",option+1) == 0)
1086 break;
1087 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1088 }
1089 case 'p':
1090 {
1091 if (LocaleCompare("pause",option+1) == 0)
1092 {
1093 resource_info.pause=0;
1094 if (*option == '+')
1095 break;
1096 i++;
1097 if (i == (ssize_t) argc)
1098 ThrowAnimateException(OptionError,"MissingArgument",option);
1099 if (IsGeometry(argv[i]) == MagickFalse)
1100 ThrowAnimateInvalidArgumentException(option,argv[i]);
1101 resource_info.pause=(unsigned int) StringToUnsignedLong(argv[i]);
1102 break;
1103 }
1104 if (LocaleCompare("page",option+1) == 0)
1105 {
1106 if (*option == '+')
1107 break;
1108 i++;
1109 if (i == (ssize_t) argc)
1110 ThrowAnimateException(OptionError,"MissingArgument",option);
1111 break;
1112 }
1113 if (LocaleCompare("profile",option+1) == 0)
1114 {
1115 i++;
1116 if (i == (ssize_t) argc)
1117 ThrowAnimateException(OptionError,"MissingArgument",option);
1118 break;
1119 }
1120 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1121 }
1122 case 'q':
1123 {
1124 if (LocaleCompare("quantize",option+1) == 0)
1125 {
1126 ssize_t
1127 colorspace;
1128
1129 if (*option == '+')
1130 break;
1131 i++;
1132 if (i == (ssize_t) argc)
1133 ThrowAnimateException(OptionError,"MissingArgument",option);
1134 colorspace=ParseCommandOption(MagickColorspaceOptions,
1135 MagickFalse,argv[i]);
1136 if (colorspace < 0)
1137 ThrowAnimateException(OptionError,"UnrecognizedColorspace",
1138 argv[i]);
1139 break;
1140 }
1141 if (LocaleCompare("quiet",option+1) == 0)
1142 break;
1143 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1144 }
1145 case 'r':
1146 {
1147 if (LocaleCompare("regard-warnings",option+1) == 0)
1148 break;
1149 if (LocaleCompare("remote",option+1) == 0)
1150 {
1151 i++;
1152 if (i == (ssize_t) argc)
1153 ThrowAnimateException(OptionError,"MissingArgument",option);
1154 if (XRemoteCommand(display,resource_info.window_id,argv[i]) != 0)
1155 {
1156 DestroyAnimate();
1157 return(MagickFalse);
1158 }
1159 i--;
1160 break;
1161 }
1162 if (LocaleCompare("repage",option+1) == 0)
1163 {
1164 if (*option == '+')
1165 break;
1166 i++;
1167 if (i == (ssize_t) argc)
1168 ThrowAnimateException(OptionError,"MissingArgument",option);
1169 if (IsGeometry(argv[i]) == MagickFalse)
1170 ThrowAnimateInvalidArgumentException(option,argv[i]);
1171 break;
1172 }
1173 if (LocaleCompare("resample",option+1) == 0)
1174 {
1175 if (*option == '+')
1176 break;
1177 i++;
1178 if (i == (ssize_t) argc)
1179 ThrowAnimateException(OptionError,"MissingArgument",option);
1180 if (IsGeometry(argv[i]) == MagickFalse)
1181 ThrowAnimateInvalidArgumentException(option,argv[i]);
1182 break;
1183 }
1184 if (LocaleCompare("resize",option+1) == 0)
1185 {
1186 if (*option == '+')
1187 break;
1188 i++;
1189 if (i == (ssize_t) argc)
1190 ThrowAnimateException(OptionError,"MissingArgument",option);
1191 if (IsGeometry(argv[i]) == MagickFalse)
1192 ThrowAnimateInvalidArgumentException(option,argv[i]);
1193 break;
1194 }
1195 if (LocaleNCompare("respect-parentheses",option+1,17) == 0)
1196 {
1197 respect_parenthesis=(*option == '-') ? MagickTrue : MagickFalse;
1198 break;
1199 }
1200 if (LocaleCompare("rotate",option+1) == 0)
1201 {
1202 i++;
1203 if (i == (ssize_t) argc)
1204 ThrowAnimateException(OptionError,"MissingArgument",option);
1205 if (IsGeometry(argv[i]) == MagickFalse)
1206 ThrowAnimateInvalidArgumentException(option,argv[i]);
1207 break;
1208 }
1209 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1210 }
1211 case 's':
1212 {
1213 if (LocaleCompare("sampling-factor",option+1) == 0)
1214 {
1215 if (*option == '+')
1216 break;
1217 i++;
1218 if (i == (ssize_t) argc)
1219 ThrowAnimateException(OptionError,"MissingArgument",option);
1220 if (IsGeometry(argv[i]) == MagickFalse)
1221 ThrowAnimateInvalidArgumentException(option,argv[i]);
1222 break;
1223 }
1224 if (LocaleCompare("seed",option+1) == 0)
1225 {
1226 if (*option == '+')
1227 break;
1228 i++;
1229 if (i == (ssize_t) argc)
1230 ThrowAnimateException(OptionError,"MissingArgument",option);
1231 if (IsGeometry(argv[i]) == MagickFalse)
1232 ThrowAnimateInvalidArgumentException(option,argv[i]);
1233 break;
1234 }
1235 if (LocaleCompare("scenes",option+1) == 0) /* deprecated */
1236 {
1237 if (*option == '+')
1238 break;
1239 i++;
1240 if (i == (ssize_t) argc)
1241 ThrowAnimateException(OptionError,"MissingArgument",option);
1242 if (IsSceneGeometry(argv[i],MagickFalse) == MagickFalse)
1243 ThrowAnimateInvalidArgumentException(option,argv[i]);
1244 break;
1245 }
1246 if (LocaleCompare("set",option+1) == 0)
1247 {
1248 i++;
1249 if (i == (ssize_t) argc)
1250 ThrowAnimateException(OptionError,"MissingArgument",option);
1251 if (*option == '+')
1252 break;
1253 i++;
1254 if (i == (ssize_t) argc)
1255 ThrowAnimateException(OptionError,"MissingArgument",option);
1256 break;
1257 }
1258 if (LocaleCompare("shared-memory",option+1) == 0)
1259 {
1260 resource_info.use_shared_memory=(*option == '-') ? MagickTrue :
1261 MagickFalse;
1262 break;
1263 }
1264 if (LocaleCompare("size",option+1) == 0)
1265 {
1266 if (*option == '+')
1267 break;
1268 i++;
1269 if (i == (ssize_t) argc)
1270 ThrowAnimateException(OptionError,"MissingArgument",option);
1271 if (IsGeometry(argv[i]) == MagickFalse)
1272 ThrowAnimateInvalidArgumentException(option,argv[i]);
1273 break;
1274 }
1275 if (LocaleCompare("strip",option+1) == 0)
1276 break;
1277 if (LocaleCompare("support",option+1) == 0)
1278 {
1279 i++; /* deprecated */
1280 break;
1281 }
1282 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1283 }
1284 case 't':
1285 {
1286 if (LocaleCompare("text-font",option+1) == 0)
1287 {
1288 resource_info.text_font=(char *) NULL;
1289 if (*option == '+')
1290 break;
1291 i++;
1292 if (i == (ssize_t) argc)
1293 ThrowAnimateException(OptionError,"MissingArgument",option);
1294 resource_info.text_font=XGetResourceClass(resource_database,
1295 GetClientName(),"font",argv[i]);
1296 break;
1297 }
1298 if (LocaleCompare("thumbnail",option+1) == 0)
1299 {
1300 if (*option == '+')
1301 break;
1302 i++;
1303 if (i == (ssize_t) argc)
1304 ThrowAnimateException(OptionError,"MissingArgument",option);
1305 if (IsGeometry(argv[i]) == MagickFalse)
1306 ThrowAnimateInvalidArgumentException(option,argv[i]);
1307 break;
1308 }
1309 if (LocaleCompare("title",option+1) == 0)
1310 {
1311 resource_info.title=(char *) NULL;
1312 if (*option == '+')
1313 break;
1314 i++;
1315 if (i == (ssize_t) argc)
1316 ThrowAnimateException(OptionError,"MissingArgument",option);
1317 resource_info.title=argv[i];
1318 break;
1319 }
1320 if (LocaleCompare("transparent-color",option+1) == 0)
1321 {
1322 if (*option == '+')
1323 break;
1324 i++;
1325 if (i == (ssize_t) argc)
1326 ThrowAnimateException(OptionError,"MissingArgument",option);
1327 break;
1328 }
1329 if (LocaleCompare("treedepth",option+1) == 0)
1330 {
1331 quantize_info->tree_depth=0;
1332 if (*option == '+')
1333 break;
1334 i++;
1335 if (i == (ssize_t) argc)
1336 ThrowAnimateException(OptionError,"MissingArgument",option);
1337 if (IsGeometry(argv[i]) == MagickFalse)
1338 ThrowAnimateInvalidArgumentException(option,argv[i]);
1339 quantize_info->tree_depth=StringToUnsignedLong(argv[i]);
1340 break;
1341 }
1342 if (LocaleCompare("trim",option+1) == 0)
1343 break;
1344 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1345 }
1346 case 'v':
1347 {
1348 if (LocaleCompare("verbose",option+1) == 0)
1349 break;
1350 if ((LocaleCompare("version",option+1) == 0) ||
1351 (LocaleCompare("-version",option+1) == 0))
1352 {
1353 ListMagickVersion(stdout);
1354 break;
1355 }
1356 if (LocaleCompare("virtual-pixel",option+1) == 0)
1357 {
1358 ssize_t
1359 method;
1360
1361 if (*option == '+')
1362 break;
1363 i++;
1364 if (i == (ssize_t) argc)
1365 ThrowAnimateException(OptionError,"MissingArgument",option);
1366 method=ParseCommandOption(MagickVirtualPixelOptions,MagickFalse,
1367 argv[i]);
1368 if (method < 0)
1369 ThrowAnimateException(OptionError,
1370 "UnrecognizedVirtualPixelMethod",argv[i]);
1371 break;
1372 }
1373 if (LocaleCompare("visual",option+1) == 0)
1374 {
1375 resource_info.visual_type=(char *) NULL;
1376 if (*option == '+')
1377 break;
1378 i++;
1379 if (i == (ssize_t) argc)
1380 ThrowAnimateException(OptionError,"MissingArgument",option);
1381 resource_info.visual_type=argv[i];
1382 break;
1383 }
1384 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1385 }
1386 case 'w':
1387 {
1388 if (LocaleCompare("window",option+1) == 0)
1389 {
1390 resource_info.window_id=(char *) NULL;
1391 if (*option == '+')
1392 break;
1393 i++;
1394 if (i == (ssize_t) argc)
1395 ThrowAnimateException(OptionError,"MissingArgument",option);
1396 resource_info.window_id=argv[i];
1397 break;
1398 }
1399 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1400 }
1401 case '?':
1402 break;
1403 default:
1404 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1405 }
1406 fire=(GetCommandOptionFlags(MagickCommandOptions,MagickFalse,option) &
1407 FireOptionFlag) == 0 ? MagickFalse : MagickTrue;
1408 if (fire != MagickFalse)
1409 FireImageStack(MagickFalse,MagickTrue,MagickTrue);
1410 }
1411 i--;
1412 if (k != 0)
1413 ThrowAnimateException(OptionError,"UnbalancedParenthesis",argv[i]);
1414 if (image == (Image *) NULL)
1415 ThrowAnimateException(OptionError,"MissingAnImageFilename",argv[argc-1])
1416 FinalizeImageSettings(image_info,image,MagickTrue);
1417 if (image == (Image *) NULL)
1418 ThrowAnimateException(OptionError,"MissingAnImageFilename",argv[argc-1])
1419 if (resource_info.window_id != (char *) NULL)
1420 {
1421 XAnimateBackgroundImage(display,&resource_info,image,exception);
1422 status&=MagickTrue;
1423 }
1424 else
1425 {
1426 Image
1427 *animate_image;
1428
1429 /*
1430 Animate image to X server.
1431 */
1432 animate_image=XAnimateImages(display,&resource_info,argv,argc,image,
1433 exception);
1434 while (animate_image != (Image *) NULL)
1435 {
1436 image=animate_image;
1437 animate_image=XAnimateImages(display,&resource_info,argv,argc,image,
1438 exception);
1439 if (animate_image != image)
1440 image=DestroyImageList(image);
1441 }
1442 }
1443 DestroyAnimate();
1444 return(status != 0 ? MagickTrue : MagickFalse);
1445 #else
1446 wand_unreferenced(argc);
1447 wand_unreferenced(argv);
1448 wand_unreferenced(metadata);
1449 (void) ThrowMagickException(exception,GetMagickModule(),MissingDelegateError,
1450 "DelegateLibrarySupportNotBuiltIn","'%s' (X11)",image_info->filename);
1451 return(AnimateUsage());
1452 #endif
1453 }
1454