MagickWand  6.9.12-67
Convert, Edit, Or Compose Bitmap Images
 All Data Structures
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-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 "wand/studio.h"
44 #include "wand/MagickWand.h"
45 #include "wand/mogrify-private.h"
46 #include "magick/animate-private.h"
47 #include "magick/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 
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  " -colors value preferred number of colors in the image\n"
106  " -crop geometry preferred size and location of the cropped image\n"
107  " -extract geometry extract area from image\n"
108  " -monochrome transform image to black and white\n"
109  " -resample geometry change the resolution of an image\n"
110  " -resize geometry resize the image\n"
111  " -rotate degrees apply Paeth rotation to the image\n"
112  " -strip strip image of all profiles and comments\n"
113  " -thumbnail geometry create a thumbnail of the image\n"
114  " -trim trim image edges",
115  settings[] =
116  " -alpha option on, activate, off, deactivate, set, opaque, copy\n"
117  " transparent, extract, background, or shape\n"
118  " -authenticate password\n"
119  " decipher image with this password\n"
120  " -backdrop display image centered on a backdrop\n"
121  " -channel type apply option to select image channels\n"
122  " -colormap type Shared or Private\n"
123  " -colorspace type alternate image colorspace\n"
124  " -decipher filename convert cipher pixels to plain pixels\n"
125  " -define format:option\n"
126  " define one or more image format options\n"
127  " -delay value display the next image after pausing\n"
128  " -density geometry horizontal and vertical density of the image\n"
129  " -depth value image depth\n"
130  " -display server display image to this X server\n"
131  " -dispose method layer disposal method\n"
132  " -dither method apply error diffusion to image\n"
133  " -filter type use this filter when resizing an image\n"
134  " -format \"string\" output formatted image characteristics\n"
135  " -gamma value level of gamma correction\n"
136  " -geometry geometry preferred size and location of the Image window\n"
137  " -gravity type horizontal and vertical backdrop placement\n"
138  " -identify identify the format and characteristics of the image\n"
139  " -immutable displayed image cannot be modified\n"
140  " -interlace type type of image interlacing scheme\n"
141  " -interpolate method pixel color interpolation method\n"
142  " -limit type value pixel cache resource limit\n"
143  " -loop iterations loop images then exit\n"
144  " -matte store matte channel if the image has one\n"
145  " -map type display image using this Standard Colormap\n"
146  " -monitor monitor progress\n"
147  " -pause seconds to pause before reanimating\n"
148  " -page geometry size and location of an image canvas (setting)\n"
149  " -quantize colorspace reduce colors in this colorspace\n"
150  " -quiet suppress all warning messages\n"
151  " -regard-warnings pay attention to warning messages\n"
152  " -remote command execute a command in an remote display process\n"
153  " -repage geometry size and location of an image canvas (operator)\n"
154  " -respect-parentheses settings remain in effect until parenthesis boundary\n"
155  " -sampling-factor geometry\n"
156  " horizontal and vertical sampling factor\n"
157  " -scenes range image scene range\n"
158  " -seed value seed a new sequence of pseudo-random numbers\n"
159  " -set attribute value set an image attribute\n"
160  " -size geometry width and height of image\n"
161  " -support factor resize support: > 1.0 is blurry, < 1.0 is sharp\n"
162  " -transparent-color color\n"
163  " transparent color\n"
164  " -treedepth value color tree depth\n"
165  " -verbose print detailed information about the image\n"
166  " -visual type display image using this visual type\n"
167  " -virtual-pixel method\n"
168  " virtual pixel access method\n"
169  " -window id display image to background of this window",
170  sequence_operators[] =
171  " -coalesce merge a sequence of images\n"
172  " -flatten flatten a sequence of images";
173 
174  ListMagickVersion(stdout);
175  (void) printf("Usage: %s [options ...] file [ [options ...] file ...]\n",
176  GetClientName());
177  (void) printf("\nImage Settings:\n");
178  (void) puts(settings);
179  (void) printf("\nImage Operators:\n");
180  (void) puts(operators);
181  (void) printf("\nImage Sequence Operators:\n");
182  (void) puts(sequence_operators);
183  (void) printf("\nMiscellaneous Options:\n");
184  (void) puts(miscellaneous);
185  (void) printf(
186  "\nIn addition to those listed above, you can specify these standard X\n");
187  (void) printf(
188  "resources as command line options: -background, -bordercolor,\n");
189  (void) printf(
190  "-borderwidth, -font, -foreground, -iconGeometry, -iconic, -name,\n");
191  (void) printf("-mattecolor, -shared-memory, or -title.\n");
192  (void) printf(
193  "\nBy default, the image format of `file' is determined by its magic\n");
194  (void) printf(
195  "number. To specify a particular image format, precede the filename\n");
196  (void) printf(
197  "with an image format name and a colon (i.e. ps:image) or specify the\n");
198  (void) printf(
199  "image type as the filename suffix (i.e. image.ps). Specify 'file' as\n");
200  (void) printf("'-' for standard input or output.\n");
201  (void) printf("\nButtons: \n");
202  (void) puts(buttons);
203  return(MagickTrue);
204 }
205 
206 WandExport MagickBooleanType AnimateImageCommand(ImageInfo *image_info,
207  int argc,char **argv,char **wand_unused(metadata),ExceptionInfo *exception)
208 {
209 #if defined(MAGICKCORE_X11_DELEGATE)
210 #define DestroyAnimate() \
211 { \
212  XDestroyResourceInfo(&resource_info); \
213  if (display != (Display *) NULL) \
214  { \
215  XCloseDisplay(display); \
216  display=(Display *) NULL; \
217  } \
218  XDestroyResourceInfo(&resource_info); \
219  DestroyImageStack(); \
220  for (i=0; i < (ssize_t) argc; i++) \
221  argv[i]=DestroyString(argv[i]); \
222  argv=(char **) RelinquishMagickMemory(argv); \
223 }
224 #define ThrowAnimateException(asperity,tag,option) \
225 { \
226  (void) ThrowMagickException(exception,GetMagickModule(),asperity,tag,"`%s'", \
227  option); \
228  DestroyAnimate(); \
229  return(MagickFalse); \
230 }
231 #define ThrowAnimateInvalidArgumentException(option,argument) \
232 { \
233  (void) ThrowMagickException(exception,GetMagickModule(),OptionError, \
234  "InvalidArgument","`%s': %s",option,argument); \
235  DestroyAnimate(); \
236  return(MagickFalse); \
237 }
238 
239  char
240  *resource_value,
241  *server_name;
242 
243  const char
244  *option;
245 
246  Display
247  *display;
248 
249  Image
250  *image;
251 
252  ImageStack
253  image_stack[MaxImageStackDepth+1];
254 
255  MagickBooleanType
256  fire,
257  pend,
258  respect_parenthesis;
259 
260  MagickStatusType
261  status;
262 
263  QuantizeInfo
264  *quantize_info;
265 
266  ssize_t
267  i;
268 
269  ssize_t
270  j,
271  k;
272 
273  XResourceInfo
274  resource_info;
275 
276  XrmDatabase
277  resource_database;
278 
279  wand_unreferenced(metadata);
280 
281  /*
282  Set defaults.
283  */
284  assert(image_info != (ImageInfo *) NULL);
285  assert(image_info->signature == MagickCoreSignature);
286  assert(exception != (ExceptionInfo *) NULL);
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_parenthesis=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=IsMagickTrue(resource_value);
368  resource_value=XGetResourceInstance(resource_database,GetClientName(),
369  "dither","True");
370  quantize_info->dither=IsMagickTrue(resource_value);
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  (void) SetImageOption(image_info,"filename",filename);
422  (void) CopyMagickString(image_info->filename,filename,MaxTextExtent);
423  if (image_info->ping != MagickFalse)
424  images=PingImages(image_info,exception);
425  else
426  images=ReadImages(image_info,exception);
427  status&=(images != (Image *) NULL) &&
428  (exception->severity < ErrorException);
429  if (images == (Image *) NULL)
430  continue;
431  AppendImageStack(images);
432  continue;
433  }
434  pend=image != (Image *) NULL ? MagickTrue : MagickFalse;
435  switch (*(option+1))
436  {
437  case 'a':
438  {
439  if (LocaleCompare("alpha",option+1) == 0)
440  {
441  ssize_t
442  type;
443 
444  if (*option == '+')
445  break;
446  i++;
447  if (i == (ssize_t) argc)
448  ThrowAnimateException(OptionError,"MissingArgument",option);
449  type=ParseCommandOption(MagickAlphaOptions,MagickFalse,argv[i]);
450  if (type < 0)
451  ThrowAnimateException(OptionError,"UnrecognizedAlphaChannelType",
452  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,"ImageSequenceRequired",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=MagickFalse;
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=MagickTrue;
747  quantize_info->dither_method=(DitherMethod) method;
748  break;
749  }
750  if (LocaleCompare("duration",option+1) == 0)
751  {
752  if (*option == '+')
753  break;
754  i++;
755  if (i == (ssize_t) argc)
756  ThrowAnimateException(OptionError,"MissingArgument",option);
757  if (IsGeometry(argv[i]) == MagickFalse)
758  ThrowAnimateInvalidArgumentException(option,argv[i]);
759  break;
760  }
761  ThrowAnimateException(OptionError,"UnrecognizedOption",option);
762  }
763  case 'e':
764  {
765  if (LocaleCompare("extract",option+1) == 0)
766  {
767  if (*option == '+')
768  break;
769  i++;
770  if (i == (ssize_t) argc)
771  ThrowAnimateException(OptionError,"MissingArgument",option);
772  if (IsGeometry(argv[i]) == MagickFalse)
773  ThrowAnimateInvalidArgumentException(option,argv[i]);
774  break;
775  }
776  ThrowAnimateException(OptionError,"UnrecognizedOption",option);
777  }
778  case 'f':
779  {
780  if (LocaleCompare("filter",option+1) == 0)
781  {
782  ssize_t
783  filter;
784 
785  if (*option == '+')
786  break;
787  i++;
788  if (i == (ssize_t) argc)
789  ThrowAnimateException(OptionError,"MissingArgument",option);
790  filter=ParseCommandOption(MagickFilterOptions,MagickFalse,argv[i]);
791  if (filter < 0)
792  ThrowAnimateException(OptionError,"UnrecognizedImageFilter",
793  argv[i]);
794  break;
795  }
796  if (LocaleCompare("flatten",option+1) == 0)
797  break;
798  if (LocaleCompare("font",option+1) == 0)
799  {
800  if (*option == '+')
801  break;
802  i++;
803  if (i == (ssize_t) argc)
804  ThrowAnimateException(OptionError,"MissingArgument",option);
805  resource_info.font=XGetResourceClass(resource_database,
806  GetClientName(),"font",argv[i]);
807  break;
808  }
809  if (LocaleCompare("foreground",option+1) == 0)
810  {
811  if (*option == '+')
812  break;
813  i++;
814  if (i == (ssize_t) argc)
815  ThrowAnimateException(OptionError,"MissingArgument",option);
816  resource_info.foreground_color=argv[i];
817  break;
818  }
819  if (LocaleCompare("format",option+1) == 0)
820  {
821  if (*option == '+')
822  break;
823  i++;
824  if (i == (ssize_t) argc)
825  ThrowAnimateException(OptionError,"MissingArgument",option);
826  break;
827  }
828  ThrowAnimateException(OptionError,"UnrecognizedOption",option);
829  }
830  case 'g':
831  {
832  if (LocaleCompare("gamma",option+1) == 0)
833  {
834  i++;
835  if (i == (ssize_t) argc)
836  ThrowAnimateException(OptionError,"MissingArgument",option);
837  if (IsGeometry(argv[i]) == MagickFalse)
838  ThrowAnimateInvalidArgumentException(option,argv[i]);
839  break;
840  }
841  if (LocaleCompare("geometry",option+1) == 0)
842  {
843  resource_info.image_geometry=(char *) NULL;
844  if (*option == '+')
845  break;
846  i++;
847  if (i == (ssize_t) argc)
848  ThrowAnimateException(OptionError,"MissingArgument",option);
849  if (IsGeometry(argv[i]) == MagickFalse)
850  ThrowAnimateInvalidArgumentException(option,argv[i]);
851  resource_info.image_geometry=ConstantString(argv[i]);
852  break;
853  }
854  if (LocaleCompare("gravity",option+1) == 0)
855  {
856  ssize_t
857  gravity;
858 
859  if (*option == '+')
860  break;
861  i++;
862  if (i == (ssize_t) argc)
863  ThrowAnimateException(OptionError,"MissingArgument",option);
864  gravity=ParseCommandOption(MagickGravityOptions,MagickFalse,
865  argv[i]);
866  if (gravity < 0)
867  ThrowAnimateException(OptionError,"UnrecognizedGravityType",
868  argv[i]);
869  break;
870  }
871  ThrowAnimateException(OptionError,"UnrecognizedOption",option);
872  }
873  case 'h':
874  {
875  if ((LocaleCompare("help",option+1) == 0) ||
876  (LocaleCompare("-help",option+1) == 0))
877  break;
878  ThrowAnimateException(OptionError,"UnrecognizedOption",option);
879  }
880  case 'i':
881  {
882  if (LocaleCompare("iconGeometry",option+1) == 0)
883  {
884  resource_info.icon_geometry=(char *) NULL;
885  if (*option == '+')
886  break;
887  i++;
888  if (i == (ssize_t) argc)
889  ThrowAnimateException(OptionError,"MissingArgument",option);
890  if (IsGeometry(argv[i]) == MagickFalse)
891  ThrowAnimateInvalidArgumentException(option,argv[i]);
892  resource_info.icon_geometry=argv[i];
893  break;
894  }
895  if (LocaleCompare("iconic",option+1) == 0)
896  {
897  resource_info.iconic=(*option == '-') ? MagickTrue : MagickFalse;
898  break;
899  }
900  if (LocaleCompare("identify",option+1) == 0)
901  break;
902  if (LocaleCompare("immutable",option+1) == 0)
903  {
904  resource_info.immutable=(*option == '-') ? MagickTrue : MagickFalse;
905  break;
906  }
907  if (LocaleCompare("interlace",option+1) == 0)
908  {
909  ssize_t
910  interlace;
911 
912  if (*option == '+')
913  break;
914  i++;
915  if (i == (ssize_t) argc)
916  ThrowAnimateException(OptionError,"MissingArgument",option);
917  interlace=ParseCommandOption(MagickInterlaceOptions,MagickFalse,
918  argv[i]);
919  if (interlace < 0)
920  ThrowAnimateException(OptionError,"UnrecognizedInterlaceType",
921  argv[i]);
922  break;
923  }
924  if (LocaleCompare("interpolate",option+1) == 0)
925  {
926  ssize_t
927  interpolate;
928 
929  if (*option == '+')
930  break;
931  i++;
932  if (i == (ssize_t) argc)
933  ThrowAnimateException(OptionError,"MissingArgument",option);
934  interpolate=ParseCommandOption(MagickInterpolateOptions,MagickFalse,
935  argv[i]);
936  if (interpolate < 0)
937  ThrowAnimateException(OptionError,"UnrecognizedInterpolateMethod",
938  argv[i]);
939  break;
940  }
941  ThrowAnimateException(OptionError,"UnrecognizedOption",option);
942  }
943  case 'l':
944  {
945  if (LocaleCompare("label",option+1) == 0)
946  {
947  if (*option == '+')
948  break;
949  i++;
950  if (i == (ssize_t) argc)
951  ThrowAnimateException(OptionError,"MissingArgument",option);
952  break;
953  }
954  if (LocaleCompare("limit",option+1) == 0)
955  {
956  char
957  *p;
958 
959  double
960  value;
961 
962  ssize_t
963  resource;
964 
965  if (*option == '+')
966  break;
967  i++;
968  if (i == (ssize_t) argc)
969  ThrowAnimateException(OptionError,"MissingArgument",option);
970  resource=ParseCommandOption(MagickResourceOptions,MagickFalse,
971  argv[i]);
972  if (resource < 0)
973  ThrowAnimateException(OptionError,"UnrecognizedResourceType",
974  argv[i]);
975  i++;
976  if (i == (ssize_t) argc)
977  ThrowAnimateException(OptionError,"MissingArgument",option);
978  value=StringToDouble(argv[i],&p);
979  (void) value;
980  if ((p == argv[i]) && (LocaleCompare("unlimited",argv[i]) != 0))
981  ThrowAnimateInvalidArgumentException(option,argv[i]);
982  break;
983  }
984  if (LocaleCompare("list",option+1) == 0)
985  {
986  ssize_t
987  list;
988 
989  if (*option == '+')
990  break;
991  i++;
992  if (i == (ssize_t) argc)
993  ThrowAnimateException(OptionError,"MissingArgument",option);
994  list=ParseCommandOption(MagickListOptions,MagickFalse,argv[i]);
995  if (list < 0)
996  ThrowAnimateException(OptionError,"UnrecognizedListType",argv[i]);
997  status=MogrifyImageInfo(image_info,(int) (i-j+1),(const char **)
998  argv+j,exception);
999  DestroyAnimate();
1000  return(status == 0 ? MagickFalse : MagickTrue);
1001  }
1002  if (LocaleCompare("log",option+1) == 0)
1003  {
1004  if (*option == '+')
1005  break;
1006  i++;
1007  if ((i == (ssize_t) argc) ||
1008  (strchr(argv[i],'%') == (char *) NULL))
1009  ThrowAnimateException(OptionError,"MissingArgument",option);
1010  break;
1011  }
1012  if (LocaleCompare("loop",option+1) == 0)
1013  {
1014  if (*option == '+')
1015  break;
1016  i++;
1017  if (i == (ssize_t) argc)
1018  ThrowAnimateException(OptionError,"MissingArgument",option);
1019  if (IsGeometry(argv[i]) == MagickFalse)
1020  ThrowAnimateInvalidArgumentException(option,argv[i]);
1021  break;
1022  }
1023  ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1024  }
1025  case 'm':
1026  {
1027  if (LocaleCompare("map",option+1) == 0)
1028  {
1029  resource_info.map_type=(char *) NULL;
1030  if (*option == '+')
1031  break;
1032  (void) CopyMagickString(argv[i]+1,"san",MaxTextExtent);
1033  i++;
1034  if (i == (ssize_t) argc)
1035  ThrowAnimateException(OptionError,"MissingArgument",option);
1036  resource_info.map_type=argv[i];
1037  break;
1038  }
1039  if (LocaleCompare("matte",option+1) == 0)
1040  break;
1041  if (LocaleCompare("mattecolor",option+1) == 0)
1042  {
1043  if (*option == '+')
1044  break;
1045  i++;
1046  if (i == (ssize_t) argc)
1047  ThrowAnimateException(OptionError,"MissingArgument",option);
1048  resource_info.matte_color=argv[i];
1049  break;
1050  }
1051  if (LocaleCompare("monitor",option+1) == 0)
1052  break;
1053  if (LocaleCompare("monochrome",option+1) == 0)
1054  {
1055  if (*option == '+')
1056  break;
1057  quantize_info->number_colors=2;
1058  quantize_info->colorspace=GRAYColorspace;
1059  break;
1060  }
1061  ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1062  }
1063  case 'n':
1064  {
1065  if (LocaleCompare("name",option+1) == 0)
1066  {
1067  resource_info.name=(char *) NULL;
1068  if (*option == '+')
1069  break;
1070  i++;
1071  if (i == (ssize_t) argc)
1072  ThrowAnimateException(OptionError,"MissingArgument",option);
1073  resource_info.name=ConstantString(argv[i]);
1074  break;
1075  }
1076  if (LocaleCompare("noop",option+1) == 0)
1077  break;
1078  ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1079  }
1080  case 'p':
1081  {
1082  if (LocaleCompare("pause",option+1) == 0)
1083  {
1084  resource_info.pause=0;
1085  if (*option == '+')
1086  break;
1087  i++;
1088  if (i == (ssize_t) argc)
1089  ThrowAnimateException(OptionError,"MissingArgument",option);
1090  if (IsGeometry(argv[i]) == MagickFalse)
1091  ThrowAnimateInvalidArgumentException(option,argv[i]);
1092  resource_info.pause=(unsigned int) StringToUnsignedLong(argv[i]);
1093  break;
1094  }
1095  if (LocaleCompare("page",option+1) == 0)
1096  {
1097  if (*option == '+')
1098  break;
1099  i++;
1100  if (i == (ssize_t) argc)
1101  ThrowAnimateException(OptionError,"MissingArgument",option);
1102  break;
1103  }
1104  if (LocaleCompare("profile",option+1) == 0)
1105  {
1106  i++;
1107  if (i == (ssize_t) argc)
1108  ThrowAnimateException(OptionError,"MissingArgument",option);
1109  break;
1110  }
1111  ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1112  }
1113  case 'q':
1114  {
1115  if (LocaleCompare("quantize",option+1) == 0)
1116  {
1117  ssize_t
1118  colorspace;
1119 
1120  if (*option == '+')
1121  break;
1122  i++;
1123  if (i == (ssize_t) argc)
1124  ThrowAnimateException(OptionError,"MissingArgument",option);
1125  colorspace=ParseCommandOption(MagickColorspaceOptions,
1126  MagickFalse,argv[i]);
1127  if (colorspace < 0)
1128  ThrowAnimateException(OptionError,"UnrecognizedColorspace",
1129  argv[i]);
1130  break;
1131  }
1132  if (LocaleCompare("quiet",option+1) == 0)
1133  break;
1134  ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1135  }
1136  case 'r':
1137  {
1138  if (LocaleCompare("regard-warnings",option+1) == 0)
1139  break;
1140  if (LocaleCompare("remote",option+1) == 0)
1141  {
1142  i++;
1143  if (i == (ssize_t) argc)
1144  ThrowAnimateException(OptionError,"MissingArgument",option);
1145  if (XRemoteCommand(display,resource_info.window_id,argv[i]) != 0)
1146  {
1147  DestroyAnimate();
1148  return(MagickFalse);
1149  }
1150  i--;
1151  break;
1152  }
1153  if (LocaleCompare("repage",option+1) == 0)
1154  {
1155  if (*option == '+')
1156  break;
1157  i++;
1158  if (i == (ssize_t) argc)
1159  ThrowAnimateException(OptionError,"MissingArgument",option);
1160  if (IsGeometry(argv[i]) == MagickFalse)
1161  ThrowAnimateInvalidArgumentException(option,argv[i]);
1162  break;
1163  }
1164  if (LocaleCompare("resample",option+1) == 0)
1165  {
1166  if (*option == '+')
1167  break;
1168  i++;
1169  if (i == (ssize_t) argc)
1170  ThrowAnimateException(OptionError,"MissingArgument",option);
1171  if (IsGeometry(argv[i]) == MagickFalse)
1172  ThrowAnimateInvalidArgumentException(option,argv[i]);
1173  break;
1174  }
1175  if (LocaleCompare("resize",option+1) == 0)
1176  {
1177  if (*option == '+')
1178  break;
1179  i++;
1180  if (i == (ssize_t) argc)
1181  ThrowAnimateException(OptionError,"MissingArgument",option);
1182  if (IsGeometry(argv[i]) == MagickFalse)
1183  ThrowAnimateInvalidArgumentException(option,argv[i]);
1184  break;
1185  }
1186  if (LocaleNCompare("respect-parentheses",option+1,17) == 0)
1187  {
1188  respect_parenthesis=(*option == '-') ? MagickTrue : MagickFalse;
1189  break;
1190  }
1191  if (LocaleCompare("rotate",option+1) == 0)
1192  {
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  ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1201  }
1202  case 's':
1203  {
1204  if (LocaleCompare("sampling-factor",option+1) == 0)
1205  {
1206  if (*option == '+')
1207  break;
1208  i++;
1209  if (i == (ssize_t) argc)
1210  ThrowAnimateException(OptionError,"MissingArgument",option);
1211  if (IsGeometry(argv[i]) == MagickFalse)
1212  ThrowAnimateInvalidArgumentException(option,argv[i]);
1213  break;
1214  }
1215  if (LocaleCompare("seed",option+1) == 0)
1216  {
1217  if (*option == '+')
1218  break;
1219  i++;
1220  if (i == (ssize_t) argc)
1221  ThrowAnimateException(OptionError,"MissingArgument",option);
1222  if (IsGeometry(argv[i]) == MagickFalse)
1223  ThrowAnimateInvalidArgumentException(option,argv[i]);
1224  break;
1225  }
1226  if (LocaleCompare("scenes",option+1) == 0) /* deprecated */
1227  {
1228  if (*option == '+')
1229  break;
1230  i++;
1231  if (i == (ssize_t) argc)
1232  ThrowAnimateException(OptionError,"MissingArgument",option);
1233  if (IsSceneGeometry(argv[i],MagickFalse) == MagickFalse)
1234  ThrowAnimateInvalidArgumentException(option,argv[i]);
1235  break;
1236  }
1237  if (LocaleCompare("set",option+1) == 0)
1238  {
1239  i++;
1240  if (i == (ssize_t) argc)
1241  ThrowAnimateException(OptionError,"MissingArgument",option);
1242  if (*option == '+')
1243  break;
1244  i++;
1245  if (i == (ssize_t) argc)
1246  ThrowAnimateException(OptionError,"MissingArgument",option);
1247  break;
1248  }
1249  if (LocaleCompare("shared-memory",option+1) == 0)
1250  {
1251  resource_info.use_shared_memory=(*option == '-') ? MagickTrue :
1252  MagickFalse;
1253  break;
1254  }
1255  if (LocaleCompare("size",option+1) == 0)
1256  {
1257  if (*option == '+')
1258  break;
1259  i++;
1260  if (i == (ssize_t) argc)
1261  ThrowAnimateException(OptionError,"MissingArgument",option);
1262  if (IsGeometry(argv[i]) == MagickFalse)
1263  ThrowAnimateInvalidArgumentException(option,argv[i]);
1264  break;
1265  }
1266  if (LocaleCompare("strip",option+1) == 0)
1267  break;
1268  if (LocaleCompare("support",option+1) == 0)
1269  {
1270  i++; /* deprecated */
1271  break;
1272  }
1273  ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1274  }
1275  case 't':
1276  {
1277  if (LocaleCompare("text-font",option+1) == 0)
1278  {
1279  resource_info.text_font=(char *) NULL;
1280  if (*option == '+')
1281  break;
1282  i++;
1283  if (i == (ssize_t) argc)
1284  ThrowAnimateException(OptionError,"MissingArgument",option);
1285  resource_info.text_font=XGetResourceClass(resource_database,
1286  GetClientName(),"font",argv[i]);
1287  break;
1288  }
1289  if (LocaleCompare("thumbnail",option+1) == 0)
1290  {
1291  if (*option == '+')
1292  break;
1293  i++;
1294  if (i == (ssize_t) argc)
1295  ThrowAnimateException(OptionError,"MissingArgument",option);
1296  if (IsGeometry(argv[i]) == MagickFalse)
1297  ThrowAnimateInvalidArgumentException(option,argv[i]);
1298  break;
1299  }
1300  if (LocaleCompare("title",option+1) == 0)
1301  {
1302  resource_info.title=(char *) NULL;
1303  if (*option == '+')
1304  break;
1305  i++;
1306  if (i == (ssize_t) argc)
1307  ThrowAnimateException(OptionError,"MissingArgument",option);
1308  resource_info.title=argv[i];
1309  break;
1310  }
1311  if (LocaleCompare("transparent-color",option+1) == 0)
1312  {
1313  if (*option == '+')
1314  break;
1315  i++;
1316  if (i == (ssize_t) argc)
1317  ThrowAnimateException(OptionError,"MissingArgument",option);
1318  break;
1319  }
1320  if (LocaleCompare("treedepth",option+1) == 0)
1321  {
1322  quantize_info->tree_depth=0;
1323  if (*option == '+')
1324  break;
1325  i++;
1326  if (i == (ssize_t) argc)
1327  ThrowAnimateException(OptionError,"MissingArgument",option);
1328  if (IsGeometry(argv[i]) == MagickFalse)
1329  ThrowAnimateInvalidArgumentException(option,argv[i]);
1330  quantize_info->tree_depth=StringToUnsignedLong(argv[i]);
1331  break;
1332  }
1333  if (LocaleCompare("trim",option+1) == 0)
1334  break;
1335  ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1336  }
1337  case 'v':
1338  {
1339  if (LocaleCompare("verbose",option+1) == 0)
1340  break;
1341  if ((LocaleCompare("version",option+1) == 0) ||
1342  (LocaleCompare("-version",option+1) == 0))
1343  {
1344  ListMagickVersion(stdout);
1345  break;
1346  }
1347  if (LocaleCompare("virtual-pixel",option+1) == 0)
1348  {
1349  ssize_t
1350  method;
1351 
1352  if (*option == '+')
1353  break;
1354  i++;
1355  if (i == (ssize_t) argc)
1356  ThrowAnimateException(OptionError,"MissingArgument",option);
1357  method=ParseCommandOption(MagickVirtualPixelOptions,MagickFalse,
1358  argv[i]);
1359  if (method < 0)
1360  ThrowAnimateException(OptionError,
1361  "UnrecognizedVirtualPixelMethod",argv[i]);
1362  break;
1363  }
1364  if (LocaleCompare("visual",option+1) == 0)
1365  {
1366  resource_info.visual_type=(char *) NULL;
1367  if (*option == '+')
1368  break;
1369  i++;
1370  if (i == (ssize_t) argc)
1371  ThrowAnimateException(OptionError,"MissingArgument",option);
1372  resource_info.visual_type=argv[i];
1373  break;
1374  }
1375  ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1376  }
1377  case 'w':
1378  {
1379  if (LocaleCompare("window",option+1) == 0)
1380  {
1381  resource_info.window_id=(char *) NULL;
1382  if (*option == '+')
1383  break;
1384  i++;
1385  if (i == (ssize_t) argc)
1386  ThrowAnimateException(OptionError,"MissingArgument",option);
1387  resource_info.window_id=argv[i];
1388  break;
1389  }
1390  ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1391  }
1392  case '?':
1393  break;
1394  default:
1395  ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1396  }
1397  fire=(GetCommandOptionFlags(MagickCommandOptions,MagickFalse,option) &
1398  FireOptionFlag) == 0 ? MagickFalse : MagickTrue;
1399  if (fire != MagickFalse)
1400  FireImageStack(MagickFalse,MagickTrue,MagickTrue);
1401  }
1402  i--;
1403  if (k != 0)
1404  ThrowAnimateException(OptionError,"UnbalancedParenthesis",argv[i]);
1405  if (image == (Image *) NULL)
1406  ThrowAnimateException(OptionError,"MissingAnImageFilename",argv[argc-1])
1407  FinalizeImageSettings(image_info,image,MagickTrue);
1408  if (image == (Image *) NULL)
1409  ThrowAnimateException(OptionError,"MissingAnImageFilename",argv[argc-1])
1410  if (resource_info.window_id != (char *) NULL)
1411  {
1412  XAnimateBackgroundImage(display,&resource_info,image);
1413  status&=MagickTrue;
1414  }
1415  else
1416  {
1417  Image
1418  *animate_image;
1419 
1420  /*
1421  Animate image to X server.
1422  */
1423  animate_image=XAnimateImages(display,&resource_info,argv,argc,image);
1424  while (animate_image != (Image *) NULL)
1425  {
1426  image=animate_image;
1427  animate_image=XAnimateImages(display,&resource_info,argv,argc,image);
1428  if (animate_image != image)
1429  image=DestroyImageList(image);
1430  }
1431  }
1432  DestroyAnimate();
1433  return(status != 0 ? MagickTrue : MagickFalse);
1434 #else
1435  magick_unreferenced(argc);
1436  magick_unreferenced(argv);
1437  magick_unreferenced(metadata);
1438 
1439  (void) ThrowMagickException(exception,GetMagickModule(),MissingDelegateError,
1440  "DelegateLibrarySupportNotBuiltIn","`%s' (X11)",image_info->filename);
1441  return(AnimateUsage());
1442 #endif
1443 }