MagickWand 7.1.1
Convert, Edit, Or Compose Bitmap Images
Loading...
Searching...
No Matches
animate.c
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 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
93static 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
207#if defined(MAGICKCORE_X11_DELEGATE)
208WandExport MagickBooleanType AnimateImageCommand(ImageInfo *image_info,
209 int argc,char **argv,char **wand_unused(metadata),ExceptionInfo *exception)
210{
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
254 image_stack[MaxImageStackDepth+1];
255
256 MagickBooleanType
257 fire,
258 pend,
259 respect_parentheses;
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 assert(exception != (ExceptionInfo *) NULL);
286 wand_unreferenced(metadata);
287 if (IsEventLogging() != MagickFalse)
288 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
289 if (argc == 2)
290 {
291 option=argv[1];
292 if ((LocaleCompare("version",option+1) == 0) ||
293 (LocaleCompare("-version",option+1) == 0))
294 {
295 ListMagickVersion(stdout);
296 return(MagickTrue);
297 }
298 }
299 status=MagickTrue;
300 SetNotifyHandlers;
301 display=(Display *) NULL;
302 j=1;
303 k=0;
304 NewImageStack();
305 option=(char *) NULL;
306 pend=MagickFalse;
307 respect_parentheses=MagickFalse;
308 resource_database=(XrmDatabase) NULL;
309 (void) memset(&resource_info,0,sizeof(XResourceInfo));
310 server_name=(char *) NULL;
311 status=MagickTrue;
312 /*
313 Check for server name specified on the command line.
314 */
315 ReadCommandlLine(argc,&argv);
316 status=ExpandFilenames(&argc,&argv);
317 if (status == MagickFalse)
318 ThrowAnimateException(ResourceLimitError,"MemoryAllocationFailed",
319 image_info->filename);
320 for (i=1; i < (ssize_t) argc; i++)
321 {
322 /*
323 Check command line for server name.
324 */
325 option=argv[i];
326 if (IsCommandOption(option) == MagickFalse)
327 continue;
328 if (LocaleCompare("display",option+1) == 0)
329 {
330 /*
331 User specified server name.
332 */
333 i++;
334 if (i == (ssize_t) argc)
335 ThrowAnimateException(OptionError,"MissingArgument",option);
336 server_name=argv[i];
337 }
338 if ((LocaleCompare("help",option+1) == 0) ||
339 (LocaleCompare("-help",option+1) == 0))
340 {
341 DestroyAnimate();
342 return(AnimateUsage());
343 }
344 }
345 /*
346 Get user defaults from X resource database.
347 */
348 display=XOpenDisplay(server_name);
349 if (display == (Display *) NULL)
350 ThrowAnimateException(XServerError,"UnableToOpenXServer",
351 XDisplayName(server_name));
352 (void) XSetErrorHandler(XError);
353 resource_database=XGetResourceDatabase(display,GetClientName());
354 XGetResourceInfo(image_info,resource_database,GetClientName(),
355 &resource_info);
356 quantize_info=resource_info.quantize_info;
357 image_info->density=XGetResourceInstance(resource_database,GetClientName(),
358 "density",(char *) NULL);
359 if (image_info->density == (char *) NULL)
360 image_info->density=XGetScreenDensity(display);
361 resource_value=XGetResourceInstance(resource_database,GetClientName(),
362 "interlace","none");
363 image_info->interlace=(InterlaceType)
364 ParseCommandOption(MagickInterlaceOptions,MagickFalse,resource_value);
365 resource_value=XGetResourceInstance(resource_database,GetClientName(),
366 "verbose","False");
367 image_info->verbose=IsStringTrue(resource_value);
368 resource_value=XGetResourceInstance(resource_database,GetClientName(),
369 "dither","True");
370 quantize_info->dither_method=IsStringTrue(resource_value) != MagickFalse ?
371 RiemersmaDitherMethod : NoDitherMethod;
372 /*
373 Parse command line.
374 */
375 for (i=1; i <= (ssize_t) argc; i++)
376 {
377 if (i < (ssize_t) argc)
378 option=argv[i];
379 else
380 if (image != (Image *) NULL)
381 break;
382 else
383 if (isatty(STDIN_FILENO) != MagickFalse)
384 option="logo:";
385 else
386 option="-";
387 if (LocaleCompare(option,"(") == 0)
388 {
389 FireImageStack(MagickFalse,MagickTrue,pend);
390 if (k == MaxImageStackDepth)
391 ThrowAnimateException(OptionError,"ParenthesisNestedTooDeeply",
392 option);
393 PushImageStack();
394 continue;
395 }
396 if (LocaleCompare(option,")") == 0)
397 {
398 FireImageStack(MagickFalse,MagickTrue,MagickTrue);
399 if (k == 0)
400 ThrowAnimateException(OptionError,"UnableToParseExpression",option);
401 PopImageStack();
402 continue;
403 }
404 if (IsCommandOption(option) == MagickFalse)
405 {
406 const char
407 *filename;
408
409 Image
410 *images;
411
412 /*
413 Read input image.
414 */
415 FireImageStack(MagickFalse,MagickFalse,pend);
416 filename=option;
417 if ((LocaleCompare(filename,"--") == 0) && (i < (ssize_t) (argc-1)))
418 {
419 option=argv[++i];
420 filename=option;
421 }
422 if (image_info->ping != MagickFalse)
423 images=PingImages(image_info,filename,exception);
424 else
425 images=ReadImages(image_info,filename,exception);
426 status&=(MagickStatusType) (images != (Image *) NULL) &&
427 (exception->severity < ErrorException);
428 if (images == (Image *) NULL)
429 continue;
430 AppendImageStack(images);
431 continue;
432 }
433 pend=image != (Image *) NULL ? MagickTrue : MagickFalse;
434 switch (*(option+1))
435 {
436 case 'a':
437 {
438 if (LocaleCompare("alpha",option+1) == 0)
439 {
440 ssize_t
441 type;
442
443 if (*option == '+')
444 break;
445 i++;
446 if (i == (ssize_t) argc)
447 ThrowAnimateException(OptionError,"MissingArgument",option);
448 type=ParseCommandOption(MagickAlphaChannelOptions,MagickFalse,
449 argv[i]);
450 if (type < 0)
451 ThrowAnimateException(OptionError,
452 "UnrecognizedAlphaChannelOption",argv[i]);
453 break;
454 }
455 if (LocaleCompare("authenticate",option+1) == 0)
456 {
457 if (*option == '+')
458 break;
459 i++;
460 if (i == (ssize_t) argc)
461 ThrowAnimateException(OptionError,"MissingArgument",option);
462 break;
463 }
464 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
465 }
466 case 'b':
467 {
468 if (LocaleCompare("backdrop",option+1) == 0)
469 {
470 resource_info.backdrop=(*option == '-') ? MagickTrue : MagickFalse;
471 break;
472 }
473 if (LocaleCompare("background",option+1) == 0)
474 {
475 if (*option == '+')
476 break;
477 i++;
478 if (i == (ssize_t) argc)
479 ThrowAnimateException(OptionError,"MissingArgument",option);
480 resource_info.background_color=argv[i];
481 break;
482 }
483 if (LocaleCompare("bordercolor",option+1) == 0)
484 {
485 if (*option == '+')
486 break;
487 i++;
488 if (i == (ssize_t) argc)
489 ThrowAnimateException(OptionError,"MissingArgument",option);
490 resource_info.border_color=argv[i];
491 break;
492 }
493 if (LocaleCompare("borderwidth",option+1) == 0)
494 {
495 resource_info.border_width=0;
496 if (*option == '+')
497 break;
498 i++;
499 if ((i == (ssize_t) argc) || (IsGeometry(argv[i]) == MagickFalse))
500 ThrowAnimateException(OptionError,"MissingArgument",option);
501 resource_info.border_width=(unsigned int)
502 StringToUnsignedLong(argv[i]);
503 break;
504 }
505 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
506 }
507 case 'c':
508 {
509 if (LocaleCompare("cache",option+1) == 0)
510 {
511 if (*option == '+')
512 break;
513 i++;
514 if (i == (ssize_t) argc)
515 ThrowAnimateException(OptionError,"MissingArgument",option);
516 if (IsGeometry(argv[i]) == MagickFalse)
517 ThrowAnimateInvalidArgumentException(option,argv[i]);
518 break;
519 }
520 if (LocaleCompare("channel",option+1) == 0)
521 {
522 ssize_t
523 channel;
524
525 if (*option == '+')
526 break;
527 i++;
528 if (i == (ssize_t) argc)
529 ThrowAnimateException(OptionError,"MissingArgument",option);
530 channel=ParseChannelOption(argv[i]);
531 if (channel < 0)
532 ThrowAnimateException(OptionError,"UnrecognizedChannelType",
533 argv[i]);
534 break;
535 }
536 if (LocaleCompare("clone",option+1) == 0)
537 {
538 Image
539 *clone_images;
540
541 clone_images=image;
542 if (k != 0)
543 clone_images=image_stack[k-1].image;
544 if (clone_images == (Image *) NULL)
545 ThrowAnimateException(ImageError,"UnableToCloneImage",option);
546 FireImageStack(MagickFalse,MagickTrue,MagickTrue);
547 if (*option == '+')
548 clone_images=CloneImages(clone_images,"-1",exception);
549 else
550 {
551 i++;
552 if (i == (ssize_t) argc)
553 ThrowAnimateException(OptionError,"MissingArgument",option);
554 if (IsSceneGeometry(argv[i],MagickFalse) == MagickFalse)
555 ThrowAnimateInvalidArgumentException(option,argv[i]);
556 clone_images=CloneImages(clone_images,argv[i],exception);
557 }
558 if (clone_images == (Image *) NULL)
559 ThrowAnimateException(OptionError,"NoSuchImage",option);
560 AppendImageStack(clone_images);
561 break;
562 }
563 if (LocaleCompare("coalesce",option+1) == 0)
564 break;
565 if (LocaleCompare("colormap",option+1) == 0)
566 {
567 resource_info.colormap=PrivateColormap;
568 if (*option == '+')
569 break;
570 i++;
571 if (i == (ssize_t) argc)
572 ThrowAnimateException(OptionError,"MissingArgument",option);
573 resource_info.colormap=UndefinedColormap;
574 if (LocaleCompare("private",argv[i]) == 0)
575 resource_info.colormap=PrivateColormap;
576 if (LocaleCompare("shared",argv[i]) == 0)
577 resource_info.colormap=SharedColormap;
578 if (resource_info.colormap == UndefinedColormap)
579 ThrowAnimateException(OptionError,"UnrecognizedColormapType",
580 argv[i]);
581 break;
582 }
583 if (LocaleCompare("colors",option+1) == 0)
584 {
585 quantize_info->number_colors=0;
586 if (*option == '+')
587 break;
588 i++;
589 if (i == (ssize_t) argc)
590 ThrowAnimateException(OptionError,"MissingArgument",option);
591 if (IsGeometry(argv[i]) == MagickFalse)
592 ThrowAnimateInvalidArgumentException(option,argv[i]);
593 quantize_info->number_colors=StringToUnsignedLong(argv[i]);
594 break;
595 }
596 if (LocaleCompare("colorspace",option+1) == 0)
597 {
598 ssize_t
599 colorspace;
600
601 if (*option == '+')
602 break;
603 i++;
604 if (i == (ssize_t) argc)
605 ThrowAnimateException(OptionError,"MissingArgument",option);
606 colorspace=ParseCommandOption(MagickColorspaceOptions,
607 MagickFalse,argv[i]);
608 if (colorspace < 0)
609 ThrowAnimateException(OptionError,"UnrecognizedColorspace",
610 argv[i]);
611 break;
612 }
613 if (LocaleCompare("concurrent",option+1) == 0)
614 break;
615 if (LocaleCompare("crop",option+1) == 0)
616 {
617 if (*option == '+')
618 break;
619 i++;
620 if (i == (ssize_t) argc)
621 ThrowAnimateException(OptionError,"MissingArgument",option);
622 if (IsGeometry(argv[i]) == MagickFalse)
623 ThrowAnimateInvalidArgumentException(option,argv[i]);
624 break;
625 }
626 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
627 }
628 case 'd':
629 {
630 if (LocaleCompare("debug",option+1) == 0)
631 {
632 ssize_t
633 event;
634
635 if (*option == '+')
636 break;
637 i++;
638 if (i == (ssize_t) argc)
639 ThrowAnimateException(OptionError,"MissingArgument",option);
640 event=ParseCommandOption(MagickLogEventOptions,MagickFalse,argv[i]);
641 if (event < 0)
642 ThrowAnimateException(OptionError,"UnrecognizedEventType",
643 argv[i]);
644 (void) SetLogEventMask(argv[i]);
645 break;
646 }
647 if (LocaleCompare("decipher",option+1) == 0)
648 {
649 if (*option == '+')
650 break;
651 i++;
652 if (i == (ssize_t) argc)
653 ThrowAnimateException(OptionError,"MissingArgument",option);
654 break;
655 }
656 if (LocaleCompare("define",option+1) == 0)
657 {
658 i++;
659 if (i == (ssize_t) argc)
660 ThrowAnimateException(OptionError,"MissingArgument",option);
661 if (*option == '+')
662 {
663 const char
664 *define;
665
666 define=GetImageOption(image_info,argv[i]);
667 if (define == (const char *) NULL)
668 ThrowAnimateException(OptionError,"NoSuchOption",argv[i]);
669 break;
670 }
671 break;
672 }
673 if (LocaleCompare("delay",option+1) == 0)
674 {
675 if (*option == '+')
676 break;
677 i++;
678 if (i == (ssize_t) argc)
679 ThrowAnimateException(OptionError,"MissingArgument",option);
680 if (IsGeometry(argv[i]) == MagickFalse)
681 ThrowAnimateInvalidArgumentException(option,argv[i]);
682 break;
683 }
684 if (LocaleCompare("density",option+1) == 0)
685 {
686 if (*option == '+')
687 break;
688 i++;
689 if (i == (ssize_t) argc)
690 ThrowAnimateException(OptionError,"MissingArgument",option);
691 if (IsGeometry(argv[i]) == MagickFalse)
692 ThrowAnimateInvalidArgumentException(option,argv[i]);
693 break;
694 }
695 if (LocaleCompare("depth",option+1) == 0)
696 {
697 if (*option == '+')
698 break;
699 i++;
700 if (i == (ssize_t) argc)
701 ThrowAnimateException(OptionError,"MissingArgument",option);
702 if (IsGeometry(argv[i]) == MagickFalse)
703 ThrowAnimateInvalidArgumentException(option,argv[i]);
704 break;
705 }
706 if (LocaleCompare("display",option+1) == 0)
707 {
708 if (*option == '+')
709 break;
710 i++;
711 if (i == (ssize_t) argc)
712 ThrowAnimateException(OptionError,"MissingArgument",option);
713 break;
714 }
715 if (LocaleCompare("dispose",option+1) == 0)
716 {
717 ssize_t
718 dispose;
719
720 if (*option == '+')
721 break;
722 i++;
723 if (i == (ssize_t) argc)
724 ThrowAnimateException(OptionError,"MissingArgument",option);
725 dispose=ParseCommandOption(MagickDisposeOptions,MagickFalse,argv[i]);
726 if (dispose < 0)
727 ThrowAnimateException(OptionError,"UnrecognizedDisposeMethod",
728 argv[i]);
729 break;
730 }
731 if (LocaleCompare("dither",option+1) == 0)
732 {
733 ssize_t
734 method;
735
736 quantize_info->dither_method=NoDitherMethod;
737 if (*option == '+')
738 break;
739 i++;
740 if (i == (ssize_t) argc)
741 ThrowAnimateException(OptionError,"MissingArgument",option);
742 method=ParseCommandOption(MagickDitherOptions,MagickFalse,argv[i]);
743 if (method < 0)
744 ThrowAnimateException(OptionError,"UnrecognizedDitherMethod",
745 argv[i]);
746 quantize_info->dither_method=(DitherMethod) method;
747 break;
748 }
749 if (LocaleCompare("duration",option+1) == 0)
750 {
751 if (*option == '+')
752 break;
753 i++;
754 if (i == (ssize_t) argc)
755 ThrowAnimateException(OptionError,"MissingArgument",option);
756 if (IsGeometry(argv[i]) == MagickFalse)
757 ThrowAnimateInvalidArgumentException(option,argv[i]);
758 break;
759 }
760 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
761 }
762 case 'e':
763 {
764 if (LocaleCompare("extent",option+1) == 0)
765 {
766 if (*option == '+')
767 break;
768 i++;
769 if (i == (ssize_t) argc)
770 ThrowAnimateException(OptionError,"MissingArgument",option);
771 if (IsGeometry(argv[i]) == MagickFalse)
772 ThrowAnimateInvalidArgumentException(option,argv[i]);
773 break;
774 }
775 if (LocaleCompare("extract",option+1) == 0)
776 {
777 if (*option == '+')
778 break;
779 i++;
780 if (i == (ssize_t) argc)
781 ThrowAnimateException(OptionError,"MissingArgument",option);
782 if (IsGeometry(argv[i]) == MagickFalse)
783 ThrowAnimateInvalidArgumentException(option,argv[i]);
784 break;
785 }
786 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
787 }
788 case 'f':
789 {
790 if (LocaleCompare("filter",option+1) == 0)
791 {
792 ssize_t
793 filter;
794
795 if (*option == '+')
796 break;
797 i++;
798 if (i == (ssize_t) argc)
799 ThrowAnimateException(OptionError,"MissingArgument",option);
800 filter=ParseCommandOption(MagickFilterOptions,MagickFalse,argv[i]);
801 if (filter < 0)
802 ThrowAnimateException(OptionError,"UnrecognizedImageFilter",
803 argv[i]);
804 break;
805 }
806 if (LocaleCompare("flatten",option+1) == 0)
807 break;
808 if (LocaleCompare("font",option+1) == 0)
809 {
810 if (*option == '+')
811 break;
812 i++;
813 if (i == (ssize_t) argc)
814 ThrowAnimateException(OptionError,"MissingArgument",option);
815 resource_info.font=XGetResourceClass(resource_database,
816 GetClientName(),"font",argv[i]);
817 break;
818 }
819 if (LocaleCompare("foreground",option+1) == 0)
820 {
821 if (*option == '+')
822 break;
823 i++;
824 if (i == (ssize_t) argc)
825 ThrowAnimateException(OptionError,"MissingArgument",option);
826 resource_info.foreground_color=argv[i];
827 break;
828 }
829 if (LocaleCompare("format",option+1) == 0)
830 {
831 if (*option == '+')
832 break;
833 i++;
834 if (i == (ssize_t) argc)
835 ThrowAnimateException(OptionError,"MissingArgument",option);
836 break;
837 }
838 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
839 }
840 case 'g':
841 {
842 if (LocaleCompare("gamma",option+1) == 0)
843 {
844 i++;
845 if (i == (ssize_t) argc)
846 ThrowAnimateException(OptionError,"MissingArgument",option);
847 if (IsGeometry(argv[i]) == MagickFalse)
848 ThrowAnimateInvalidArgumentException(option,argv[i]);
849 break;
850 }
851 if (LocaleCompare("geometry",option+1) == 0)
852 {
853 resource_info.image_geometry=(char *) NULL;
854 if (*option == '+')
855 break;
856 i++;
857 if (i == (ssize_t) argc)
858 ThrowAnimateException(OptionError,"MissingArgument",option);
859 if (IsGeometry(argv[i]) == MagickFalse)
860 ThrowAnimateInvalidArgumentException(option,argv[i]);
861 resource_info.image_geometry=ConstantString(argv[i]);
862 break;
863 }
864 if (LocaleCompare("gravity",option+1) == 0)
865 {
866 ssize_t
867 gravity;
868
869 if (*option == '+')
870 break;
871 i++;
872 if (i == (ssize_t) argc)
873 ThrowAnimateException(OptionError,"MissingArgument",option);
874 gravity=ParseCommandOption(MagickGravityOptions,MagickFalse,
875 argv[i]);
876 if (gravity < 0)
877 ThrowAnimateException(OptionError,"UnrecognizedGravityType",
878 argv[i]);
879 break;
880 }
881 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
882 }
883 case 'h':
884 {
885 if ((LocaleCompare("help",option+1) == 0) ||
886 (LocaleCompare("-help",option+1) == 0))
887 break;
888 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
889 }
890 case 'i':
891 {
892 if (LocaleCompare("iconGeometry",option+1) == 0)
893 {
894 resource_info.icon_geometry=(char *) NULL;
895 if (*option == '+')
896 break;
897 i++;
898 if (i == (ssize_t) argc)
899 ThrowAnimateException(OptionError,"MissingArgument",option);
900 if (IsGeometry(argv[i]) == MagickFalse)
901 ThrowAnimateInvalidArgumentException(option,argv[i]);
902 resource_info.icon_geometry=argv[i];
903 break;
904 }
905 if (LocaleCompare("iconic",option+1) == 0)
906 {
907 resource_info.iconic=(*option == '-') ? MagickTrue : MagickFalse;
908 break;
909 }
910 if (LocaleCompare("identify",option+1) == 0)
911 break;
912 if (LocaleCompare("immutable",option+1) == 0)
913 {
914 resource_info.immutable=(*option == '-') ? MagickTrue : MagickFalse;
915 break;
916 }
917 if (LocaleCompare("interlace",option+1) == 0)
918 {
919 ssize_t
920 interlace;
921
922 if (*option == '+')
923 break;
924 i++;
925 if (i == (ssize_t) argc)
926 ThrowAnimateException(OptionError,"MissingArgument",option);
927 interlace=ParseCommandOption(MagickInterlaceOptions,MagickFalse,
928 argv[i]);
929 if (interlace < 0)
930 ThrowAnimateException(OptionError,"UnrecognizedInterlaceType",
931 argv[i]);
932 break;
933 }
934 if (LocaleCompare("interpolate",option+1) == 0)
935 {
936 ssize_t
937 interpolate;
938
939 if (*option == '+')
940 break;
941 i++;
942 if (i == (ssize_t) argc)
943 ThrowAnimateException(OptionError,"MissingArgument",option);
944 interpolate=ParseCommandOption(MagickInterpolateOptions,MagickFalse,
945 argv[i]);
946 if (interpolate < 0)
947 ThrowAnimateException(OptionError,"UnrecognizedInterpolateMethod",
948 argv[i]);
949 break;
950 }
951 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
952 }
953 case 'l':
954 {
955 if (LocaleCompare("label",option+1) == 0)
956 {
957 if (*option == '+')
958 break;
959 i++;
960 if (i == (ssize_t) argc)
961 ThrowAnimateException(OptionError,"MissingArgument",option);
962 break;
963 }
964 if (LocaleCompare("limit",option+1) == 0)
965 {
966 char
967 *p;
968
969 double
970 value;
971
972 ssize_t
973 resource;
974
975 if (*option == '+')
976 break;
977 i++;
978 if (i == (ssize_t) argc)
979 ThrowAnimateException(OptionError,"MissingArgument",option);
980 resource=ParseCommandOption(MagickResourceOptions,MagickFalse,
981 argv[i]);
982 if (resource < 0)
983 ThrowAnimateException(OptionError,"UnrecognizedResourceType",
984 argv[i]);
985 i++;
986 if (i == (ssize_t) argc)
987 ThrowAnimateException(OptionError,"MissingArgument",option);
988 value=StringToDouble(argv[i],&p);
989 (void) value;
990 if ((p == argv[i]) && (LocaleCompare("unlimited",argv[i]) != 0))
991 ThrowAnimateInvalidArgumentException(option,argv[i]);
992 break;
993 }
994 if (LocaleCompare("list",option+1) == 0)
995 {
996 ssize_t
997 list;
998
999 if (*option == '+')
1000 break;
1001 i++;
1002 if (i == (ssize_t) argc)
1003 ThrowAnimateException(OptionError,"MissingArgument",option);
1004 list=ParseCommandOption(MagickListOptions,MagickFalse,argv[i]);
1005 if (list < 0)
1006 ThrowAnimateException(OptionError,"UnrecognizedListType",argv[i]);
1007 status=MogrifyImageInfo(image_info,(int) (i-j+1),(const char **)
1008 argv+j,exception);
1009 DestroyAnimate();
1010 return(status == 0 ? MagickFalse : MagickTrue);
1011 }
1012 if (LocaleCompare("log",option+1) == 0)
1013 {
1014 if (*option == '+')
1015 break;
1016 i++;
1017 if ((i == (ssize_t) argc) ||
1018 (strchr(argv[i],'%') == (char *) NULL))
1019 ThrowAnimateException(OptionError,"MissingArgument",option);
1020 break;
1021 }
1022 if (LocaleCompare("loop",option+1) == 0)
1023 {
1024 if (*option == '+')
1025 break;
1026 i++;
1027 if (i == (ssize_t) argc)
1028 ThrowAnimateException(OptionError,"MissingArgument",option);
1029 if (IsGeometry(argv[i]) == MagickFalse)
1030 ThrowAnimateInvalidArgumentException(option,argv[i]);
1031 break;
1032 }
1033 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1034 }
1035 case 'm':
1036 {
1037 if (LocaleCompare("map",option+1) == 0)
1038 {
1039 resource_info.map_type=(char *) NULL;
1040 if (*option == '+')
1041 break;
1042 (void) CopyMagickString(argv[i]+1,"san",MagickPathExtent);
1043 i++;
1044 if (i == (ssize_t) argc)
1045 ThrowAnimateException(OptionError,"MissingArgument",option);
1046 resource_info.map_type=argv[i];
1047 break;
1048 }
1049 if (LocaleCompare("matte",option+1) == 0)
1050 break;
1051 if (LocaleCompare("mattecolor",option+1) == 0)
1052 {
1053 if (*option == '+')
1054 break;
1055 i++;
1056 if (i == (ssize_t) argc)
1057 ThrowAnimateException(OptionError,"MissingArgument",option);
1058 resource_info.matte_color=argv[i];
1059 break;
1060 }
1061 if (LocaleCompare("monitor",option+1) == 0)
1062 break;
1063 if (LocaleCompare("monochrome",option+1) == 0)
1064 {
1065 if (*option == '+')
1066 break;
1067 quantize_info->number_colors=2;
1068 quantize_info->colorspace=GRAYColorspace;
1069 break;
1070 }
1071 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1072 }
1073 case 'n':
1074 {
1075 if (LocaleCompare("name",option+1) == 0)
1076 {
1077 resource_info.name=(char *) NULL;
1078 if (*option == '+')
1079 break;
1080 i++;
1081 if (i == (ssize_t) argc)
1082 ThrowAnimateException(OptionError,"MissingArgument",option);
1083 resource_info.name=ConstantString(argv[i]);
1084 break;
1085 }
1086 if (LocaleCompare("noop",option+1) == 0)
1087 break;
1088 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1089 }
1090 case 'p':
1091 {
1092 if (LocaleCompare("pause",option+1) == 0)
1093 {
1094 resource_info.pause=0;
1095 if (*option == '+')
1096 break;
1097 i++;
1098 if (i == (ssize_t) argc)
1099 ThrowAnimateException(OptionError,"MissingArgument",option);
1100 if (IsGeometry(argv[i]) == MagickFalse)
1101 ThrowAnimateInvalidArgumentException(option,argv[i]);
1102 resource_info.pause=(unsigned int) StringToUnsignedLong(argv[i]);
1103 break;
1104 }
1105 if (LocaleCompare("page",option+1) == 0)
1106 {
1107 if (*option == '+')
1108 break;
1109 i++;
1110 if (i == (ssize_t) argc)
1111 ThrowAnimateException(OptionError,"MissingArgument",option);
1112 break;
1113 }
1114 if (LocaleCompare("profile",option+1) == 0)
1115 {
1116 i++;
1117 if (i == (ssize_t) argc)
1118 ThrowAnimateException(OptionError,"MissingArgument",option);
1119 break;
1120 }
1121 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1122 }
1123 case 'q':
1124 {
1125 if (LocaleCompare("quantize",option+1) == 0)
1126 {
1127 ssize_t
1128 colorspace;
1129
1130 if (*option == '+')
1131 break;
1132 i++;
1133 if (i == (ssize_t) argc)
1134 ThrowAnimateException(OptionError,"MissingArgument",option);
1135 colorspace=ParseCommandOption(MagickColorspaceOptions,
1136 MagickFalse,argv[i]);
1137 if (colorspace < 0)
1138 ThrowAnimateException(OptionError,"UnrecognizedColorspace",
1139 argv[i]);
1140 break;
1141 }
1142 if (LocaleCompare("quiet",option+1) == 0)
1143 break;
1144 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1145 }
1146 case 'r':
1147 {
1148 if (LocaleCompare("regard-warnings",option+1) == 0)
1149 break;
1150 if (LocaleCompare("remote",option+1) == 0)
1151 {
1152 i++;
1153 if (i == (ssize_t) argc)
1154 ThrowAnimateException(OptionError,"MissingArgument",option);
1155 if (XRemoteCommand(display,resource_info.window_id,argv[i]) != 0)
1156 {
1157 DestroyAnimate();
1158 return(MagickFalse);
1159 }
1160 i--;
1161 break;
1162 }
1163 if (LocaleCompare("repage",option+1) == 0)
1164 {
1165 if (*option == '+')
1166 break;
1167 i++;
1168 if (i == (ssize_t) argc)
1169 ThrowAnimateException(OptionError,"MissingArgument",option);
1170 if (IsGeometry(argv[i]) == MagickFalse)
1171 ThrowAnimateInvalidArgumentException(option,argv[i]);
1172 break;
1173 }
1174 if (LocaleCompare("resample",option+1) == 0)
1175 {
1176 if (*option == '+')
1177 break;
1178 i++;
1179 if (i == (ssize_t) argc)
1180 ThrowAnimateException(OptionError,"MissingArgument",option);
1181 if (IsGeometry(argv[i]) == MagickFalse)
1182 ThrowAnimateInvalidArgumentException(option,argv[i]);
1183 break;
1184 }
1185 if (LocaleCompare("resize",option+1) == 0)
1186 {
1187 if (*option == '+')
1188 break;
1189 i++;
1190 if (i == (ssize_t) argc)
1191 ThrowAnimateException(OptionError,"MissingArgument",option);
1192 if (IsGeometry(argv[i]) == MagickFalse)
1193 ThrowAnimateInvalidArgumentException(option,argv[i]);
1194 break;
1195 }
1196 if (LocaleNCompare("respect-parentheses",option+1,17) == 0)
1197 {
1198 respect_parentheses=(*option == '-') ? MagickTrue : MagickFalse;
1199 break;
1200 }
1201 if (LocaleCompare("rotate",option+1) == 0)
1202 {
1203 i++;
1204 if (i == (ssize_t) argc)
1205 ThrowAnimateException(OptionError,"MissingArgument",option);
1206 if (IsGeometry(argv[i]) == MagickFalse)
1207 ThrowAnimateInvalidArgumentException(option,argv[i]);
1208 break;
1209 }
1210 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1211 }
1212 case 's':
1213 {
1214 if (LocaleCompare("sampling-factor",option+1) == 0)
1215 {
1216 if (*option == '+')
1217 break;
1218 i++;
1219 if (i == (ssize_t) argc)
1220 ThrowAnimateException(OptionError,"MissingArgument",option);
1221 if (IsGeometry(argv[i]) == MagickFalse)
1222 ThrowAnimateInvalidArgumentException(option,argv[i]);
1223 break;
1224 }
1225 if (LocaleCompare("seed",option+1) == 0)
1226 {
1227 if (*option == '+')
1228 break;
1229 i++;
1230 if (i == (ssize_t) argc)
1231 ThrowAnimateException(OptionError,"MissingArgument",option);
1232 if (IsGeometry(argv[i]) == MagickFalse)
1233 ThrowAnimateInvalidArgumentException(option,argv[i]);
1234 break;
1235 }
1236 if (LocaleCompare("scenes",option+1) == 0) /* deprecated */
1237 {
1238 if (*option == '+')
1239 break;
1240 i++;
1241 if (i == (ssize_t) argc)
1242 ThrowAnimateException(OptionError,"MissingArgument",option);
1243 if (IsSceneGeometry(argv[i],MagickFalse) == MagickFalse)
1244 ThrowAnimateInvalidArgumentException(option,argv[i]);
1245 break;
1246 }
1247 if (LocaleCompare("set",option+1) == 0)
1248 {
1249 i++;
1250 if (i == (ssize_t) argc)
1251 ThrowAnimateException(OptionError,"MissingArgument",option);
1252 if (*option == '+')
1253 break;
1254 i++;
1255 if (i == (ssize_t) argc)
1256 ThrowAnimateException(OptionError,"MissingArgument",option);
1257 break;
1258 }
1259 if (LocaleCompare("shared-memory",option+1) == 0)
1260 {
1261 resource_info.use_shared_memory=(*option == '-') ? MagickTrue :
1262 MagickFalse;
1263 break;
1264 }
1265 if (LocaleCompare("size",option+1) == 0)
1266 {
1267 if (*option == '+')
1268 break;
1269 i++;
1270 if (i == (ssize_t) argc)
1271 ThrowAnimateException(OptionError,"MissingArgument",option);
1272 if (IsGeometry(argv[i]) == MagickFalse)
1273 ThrowAnimateInvalidArgumentException(option,argv[i]);
1274 break;
1275 }
1276 if (LocaleCompare("strip",option+1) == 0)
1277 break;
1278 if (LocaleCompare("support",option+1) == 0)
1279 {
1280 i++; /* deprecated */
1281 break;
1282 }
1283 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1284 }
1285 case 't':
1286 {
1287 if (LocaleCompare("text-font",option+1) == 0)
1288 {
1289 resource_info.text_font=(char *) NULL;
1290 if (*option == '+')
1291 break;
1292 i++;
1293 if (i == (ssize_t) argc)
1294 ThrowAnimateException(OptionError,"MissingArgument",option);
1295 resource_info.text_font=XGetResourceClass(resource_database,
1296 GetClientName(),"font",argv[i]);
1297 break;
1298 }
1299 if (LocaleCompare("thumbnail",option+1) == 0)
1300 {
1301 if (*option == '+')
1302 break;
1303 i++;
1304 if (i == (ssize_t) argc)
1305 ThrowAnimateException(OptionError,"MissingArgument",option);
1306 if (IsGeometry(argv[i]) == MagickFalse)
1307 ThrowAnimateInvalidArgumentException(option,argv[i]);
1308 break;
1309 }
1310 if (LocaleCompare("title",option+1) == 0)
1311 {
1312 resource_info.title=(char *) NULL;
1313 if (*option == '+')
1314 break;
1315 i++;
1316 if (i == (ssize_t) argc)
1317 ThrowAnimateException(OptionError,"MissingArgument",option);
1318 resource_info.title=argv[i];
1319 break;
1320 }
1321 if (LocaleCompare("transparent-color",option+1) == 0)
1322 {
1323 if (*option == '+')
1324 break;
1325 i++;
1326 if (i == (ssize_t) argc)
1327 ThrowAnimateException(OptionError,"MissingArgument",option);
1328 break;
1329 }
1330 if (LocaleCompare("treedepth",option+1) == 0)
1331 {
1332 quantize_info->tree_depth=0;
1333 if (*option == '+')
1334 break;
1335 i++;
1336 if (i == (ssize_t) argc)
1337 ThrowAnimateException(OptionError,"MissingArgument",option);
1338 if (IsGeometry(argv[i]) == MagickFalse)
1339 ThrowAnimateInvalidArgumentException(option,argv[i]);
1340 quantize_info->tree_depth=StringToUnsignedLong(argv[i]);
1341 break;
1342 }
1343 if (LocaleCompare("trim",option+1) == 0)
1344 break;
1345 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1346 }
1347 case 'v':
1348 {
1349 if (LocaleCompare("verbose",option+1) == 0)
1350 break;
1351 if ((LocaleCompare("version",option+1) == 0) ||
1352 (LocaleCompare("-version",option+1) == 0))
1353 {
1354 ListMagickVersion(stdout);
1355 break;
1356 }
1357 if (LocaleCompare("virtual-pixel",option+1) == 0)
1358 {
1359 ssize_t
1360 method;
1361
1362 if (*option == '+')
1363 break;
1364 i++;
1365 if (i == (ssize_t) argc)
1366 ThrowAnimateException(OptionError,"MissingArgument",option);
1367 method=ParseCommandOption(MagickVirtualPixelOptions,MagickFalse,
1368 argv[i]);
1369 if (method < 0)
1370 ThrowAnimateException(OptionError,
1371 "UnrecognizedVirtualPixelMethod",argv[i]);
1372 break;
1373 }
1374 if (LocaleCompare("visual",option+1) == 0)
1375 {
1376 resource_info.visual_type=(char *) NULL;
1377 if (*option == '+')
1378 break;
1379 i++;
1380 if (i == (ssize_t) argc)
1381 ThrowAnimateException(OptionError,"MissingArgument",option);
1382 resource_info.visual_type=argv[i];
1383 break;
1384 }
1385 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1386 }
1387 case 'w':
1388 {
1389 if (LocaleCompare("window",option+1) == 0)
1390 {
1391 resource_info.window_id=(char *) NULL;
1392 if (*option == '+')
1393 break;
1394 i++;
1395 if (i == (ssize_t) argc)
1396 ThrowAnimateException(OptionError,"MissingArgument",option);
1397 resource_info.window_id=argv[i];
1398 break;
1399 }
1400 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1401 }
1402 case '?':
1403 break;
1404 default:
1405 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1406 }
1407 fire=(GetCommandOptionFlags(MagickCommandOptions,MagickFalse,option) &
1408 FireOptionFlag) == 0 ? MagickFalse : MagickTrue;
1409 if (fire != MagickFalse)
1410 FireImageStack(MagickFalse,MagickTrue,MagickTrue);
1411 }
1412 i--;
1413 if (k != 0)
1414 ThrowAnimateException(OptionError,"UnbalancedParenthesis",argv[i]);
1415 if (image == (Image *) NULL)
1416 ThrowAnimateException(OptionError,"MissingAnImageFilename",argv[argc-1])
1417 FinalizeImageSettings(image_info,image,MagickTrue);
1418 if (image == (Image *) NULL)
1419 ThrowAnimateException(OptionError,"MissingAnImageFilename",argv[argc-1])
1420 if (resource_info.window_id != (char *) NULL)
1421 {
1422 XAnimateBackgroundImage(display,&resource_info,image,exception);
1423 status&=(MagickStatusType) MagickTrue;
1424 }
1425 else
1426 {
1427 Image
1428 *animate_image;
1429
1430 /*
1431 Animate image to X server.
1432 */
1433 animate_image=XAnimateImages(display,&resource_info,argv,argc,image,
1434 exception);
1435 while (animate_image != (Image *) NULL)
1436 {
1437 image=animate_image;
1438 animate_image=XAnimateImages(display,&resource_info,argv,argc,image,
1439 exception);
1440 if (animate_image != image)
1441 image=DestroyImageList(image);
1442 }
1443 }
1444 DestroyAnimate();
1445 return(status != 0 ? MagickTrue : MagickFalse);
1446#else
1447WandExport MagickBooleanType AnimateImageCommand(ImageInfo *image_info,
1448 int wand_unused(argc),char **wand_unused(argv),char **wand_unused(metadata),
1449 ExceptionInfo *exception)
1450{
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}