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