2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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 %
13 % Methods to Interactively Animate an Image Sequence %
20 % Copyright 1999-2018 ImageMagick Studio LLC, a non-profit organization %
21 % dedicated to making software imaging solutions freely available. %
23 % You may not use this file except in compliance with the License. You may %
24 % obtain a copy of the License at %
26 % https://www.imagemagick.org/script/license.php %
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. %
34 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
36 % Use the animate program to animate an image sequence on any X server.
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"
50 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
54 + A n i m a t e I m a g e C o m m a n d %
58 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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
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
74 % The format of the AnimateImageCommand method is:
76 % MagickBooleanType AnimateImageCommand(ImageInfo *image_info,int argc,
77 % char **argv,char **metadata,ExceptionInfo *exception)
79 % A description of each parameter follows:
81 % o image_info: the image info.
83 % o argc: the number of elements in the argument vector.
85 % o argv: A text array containing the command line arguments.
87 % o metadata: any metadata is returned here.
89 % o exception: return any errors or warnings in this structure.
93 static MagickBooleanType AnimateUsage(void)
101 "Press any button to map or unmap the Command widget",
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",
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",
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",
185 *sequence_operators[]=
187 "-coalesce merge a sequence of images",
188 "-flatten flatten a sequence of images",
192 ListMagickVersion(stdout);
193 (void) printf("Usage: %s [options ...] file [ [options ...] file ...]\n",
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);
208 "\nIn addition to those listed above, you can specify these standard X\n");
210 "resources as command line options: -background, -bordercolor,\n");
212 "-mattecolor, -borderwidth, -font, -foreground, -iconGeometry,\n");
213 (void) printf("-iconic, -name, -shared-memory, or -title.\n");
215 "\nBy default, the image format of 'file' is determined by its magic\n");
217 "number. To specify a particular image format, precede the filename\n");
219 "with an image format name and a colon (i.e. ps:image) or specify the\n");
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);
229 WandExport MagickBooleanType AnimateImageCommand(ImageInfo *image_info,
230 int argc,char **argv,char **wand_unused(metadata),ExceptionInfo *exception)
232 #if defined(MAGICKCORE_X11_DELEGATE)
233 #define DestroyAnimate() \
235 XDestroyResourceInfo(&resource_info); \
236 if (display != (Display *) NULL) \
238 XCloseDisplay(display); \
239 display=(Display *) NULL; \
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); \
247 #define ThrowAnimateException(asperity,tag,option) \
249 (void) ThrowMagickException(exception,GetMagickModule(),asperity,tag,"`%s'", \
252 return(MagickFalse); \
254 #define ThrowAnimateInvalidArgumentException(option,argument) \
256 (void) ThrowMagickException(exception,GetMagickModule(),OptionError, \
257 "InvalidArgument","'%s': %s",option,argument); \
259 return(MagickFalse); \
276 image_stack[MaxImageStackDepth+1];
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);
313 if ((LocaleCompare("version",option+1) == 0) ||
314 (LocaleCompare("-version",option+1) == 0))
316 ListMagickVersion(stdout);
322 display=(Display *) NULL;
326 option=(char *) NULL;
328 respect_parenthesis=MagickFalse;
329 resource_database=(XrmDatabase) NULL;
330 (void) memset(&resource_info,0,sizeof(XResourceInfo));
331 server_name=(char *) NULL;
334 Check for server name specified on the command line.
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++)
344 Check command line for server name.
347 if (IsCommandOption(option) == MagickFalse)
349 if (LocaleCompare("display",option+1) == 0)
352 User specified server name.
355 if (i == (ssize_t) argc)
356 ThrowAnimateException(OptionError,"MissingArgument",option);
359 if ((LocaleCompare("help",option+1) == 0) ||
360 (LocaleCompare("-help",option+1) == 0))
361 return(AnimateUsage());
364 Get user defaults from X resource database.
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(),
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(),
381 image_info->interlace=(InterlaceType)
382 ParseCommandOption(MagickInterlaceOptions,MagickFalse,resource_value);
383 resource_value=XGetResourceInstance(resource_database,GetClientName(),
385 image_info->verbose=IsStringTrue(resource_value);
386 resource_value=XGetResourceInstance(resource_database,GetClientName(),
388 quantize_info->dither_method=IsStringTrue(resource_value) != MagickFalse ?
389 RiemersmaDitherMethod : NoDitherMethod;
393 for (i=1; i <= (ssize_t) argc; i++)
395 if (i < (ssize_t) argc)
398 if (image != (Image *) NULL)
401 if (isatty(STDIN_FILENO) != MagickFalse)
405 if (LocaleCompare(option,"(") == 0)
407 FireImageStack(MagickFalse,MagickTrue,pend);
408 if (k == MaxImageStackDepth)
409 ThrowAnimateException(OptionError,"ParenthesisNestedTooDeeply",
414 if (LocaleCompare(option,")") == 0)
416 FireImageStack(MagickFalse,MagickTrue,MagickTrue);
418 ThrowAnimateException(OptionError,"UnableToParseExpression",option);
422 if (IsCommandOption(option) == MagickFalse)
433 FireImageStack(MagickFalse,MagickFalse,pend);
435 if ((LocaleCompare(filename,"--") == 0) && (i < (ssize_t) (argc-1)))
440 if (image_info->ping != MagickFalse)
441 images=PingImages(image_info,filename,exception);
443 images=ReadImages(image_info,filename,exception);
444 status&=(images != (Image *) NULL) &&
445 (exception->severity < ErrorException);
446 if (images == (Image *) NULL)
448 AppendImageStack(images);
451 pend=image != (Image *) NULL ? MagickTrue : MagickFalse;
456 if (LocaleCompare("alpha",option+1) == 0)
464 if (i == (ssize_t) argc)
465 ThrowAnimateException(OptionError,"MissingArgument",option);
466 type=ParseCommandOption(MagickAlphaChannelOptions,MagickFalse,
469 ThrowAnimateException(OptionError,
470 "UnrecognizedAlphaChannelOption",argv[i]);
473 if (LocaleCompare("authenticate",option+1) == 0)
478 if (i == (ssize_t) argc)
479 ThrowAnimateException(OptionError,"MissingArgument",option);
482 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
486 if (LocaleCompare("backdrop",option+1) == 0)
488 resource_info.backdrop=(*option == '-') ? MagickTrue : MagickFalse;
491 if (LocaleCompare("background",option+1) == 0)
496 if (i == (ssize_t) argc)
497 ThrowAnimateException(OptionError,"MissingArgument",option);
498 resource_info.background_color=argv[i];
501 if (LocaleCompare("bordercolor",option+1) == 0)
506 if (i == (ssize_t) argc)
507 ThrowAnimateException(OptionError,"MissingArgument",option);
508 resource_info.border_color=argv[i];
511 if (LocaleCompare("borderwidth",option+1) == 0)
513 resource_info.border_width=0;
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]);
523 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
527 if (LocaleCompare("cache",option+1) == 0)
532 if (i == (ssize_t) argc)
533 ThrowAnimateException(OptionError,"MissingArgument",option);
534 if (IsGeometry(argv[i]) == MagickFalse)
535 ThrowAnimateInvalidArgumentException(option,argv[i]);
538 if (LocaleCompare("channel",option+1) == 0)
546 if (i == (ssize_t) argc)
547 ThrowAnimateException(OptionError,"MissingArgument",option);
548 channel=ParseChannelOption(argv[i]);
550 ThrowAnimateException(OptionError,"UnrecognizedChannelType",
554 if (LocaleCompare("clone",option+1) == 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);
566 clone_images=CloneImages(clone_images,"-1",exception);
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);
576 if (clone_images == (Image *) NULL)
577 ThrowAnimateException(OptionError,"NoSuchImage",option);
578 AppendImageStack(clone_images);
581 if (LocaleCompare("coalesce",option+1) == 0)
583 if (LocaleCompare("colormap",option+1) == 0)
585 resource_info.colormap=PrivateColormap;
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",
601 if (LocaleCompare("colors",option+1) == 0)
603 quantize_info->number_colors=0;
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]);
614 if (LocaleCompare("colorspace",option+1) == 0)
622 if (i == (ssize_t) argc)
623 ThrowAnimateException(OptionError,"MissingArgument",option);
624 colorspace=ParseCommandOption(MagickColorspaceOptions,
625 MagickFalse,argv[i]);
627 ThrowAnimateException(OptionError,"UnrecognizedColorspace",
631 if (LocaleCompare("concurrent",option+1) == 0)
633 if (LocaleCompare("crop",option+1) == 0)
638 if (i == (ssize_t) argc)
639 ThrowAnimateException(OptionError,"MissingArgument",option);
640 if (IsGeometry(argv[i]) == MagickFalse)
641 ThrowAnimateInvalidArgumentException(option,argv[i]);
644 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
648 if (LocaleCompare("debug",option+1) == 0)
656 if (i == (ssize_t) argc)
657 ThrowAnimateException(OptionError,"MissingArgument",option);
658 event=ParseCommandOption(MagickLogEventOptions,MagickFalse,argv[i]);
660 ThrowAnimateException(OptionError,"UnrecognizedEventType",
662 (void) SetLogEventMask(argv[i]);
665 if (LocaleCompare("decipher",option+1) == 0)
670 if (i == (ssize_t) argc)
671 ThrowAnimateException(OptionError,"MissingArgument",option);
674 if (LocaleCompare("define",option+1) == 0)
677 if (i == (ssize_t) argc)
678 ThrowAnimateException(OptionError,"MissingArgument",option);
684 define=GetImageOption(image_info,argv[i]);
685 if (define == (const char *) NULL)
686 ThrowAnimateException(OptionError,"NoSuchOption",argv[i]);
691 if (LocaleCompare("delay",option+1) == 0)
696 if (i == (ssize_t) argc)
697 ThrowAnimateException(OptionError,"MissingArgument",option);
698 if (IsGeometry(argv[i]) == MagickFalse)
699 ThrowAnimateInvalidArgumentException(option,argv[i]);
702 if (LocaleCompare("density",option+1) == 0)
707 if (i == (ssize_t) argc)
708 ThrowAnimateException(OptionError,"MissingArgument",option);
709 if (IsGeometry(argv[i]) == MagickFalse)
710 ThrowAnimateInvalidArgumentException(option,argv[i]);
713 if (LocaleCompare("depth",option+1) == 0)
718 if (i == (ssize_t) argc)
719 ThrowAnimateException(OptionError,"MissingArgument",option);
720 if (IsGeometry(argv[i]) == MagickFalse)
721 ThrowAnimateInvalidArgumentException(option,argv[i]);
724 if (LocaleCompare("display",option+1) == 0)
729 if (i == (ssize_t) argc)
730 ThrowAnimateException(OptionError,"MissingArgument",option);
733 if (LocaleCompare("dispose",option+1) == 0)
741 if (i == (ssize_t) argc)
742 ThrowAnimateException(OptionError,"MissingArgument",option);
743 dispose=ParseCommandOption(MagickDisposeOptions,MagickFalse,argv[i]);
745 ThrowAnimateException(OptionError,"UnrecognizedDisposeMethod",
749 if (LocaleCompare("dither",option+1) == 0)
754 quantize_info->dither_method=NoDitherMethod;
758 if (i == (ssize_t) argc)
759 ThrowAnimateException(OptionError,"MissingArgument",option);
760 method=ParseCommandOption(MagickDitherOptions,MagickFalse,argv[i]);
762 ThrowAnimateException(OptionError,"UnrecognizedDitherMethod",
764 quantize_info->dither_method=(DitherMethod) method;
767 if (LocaleCompare("duration",option+1) == 0)
772 if (i == (ssize_t) argc)
773 ThrowAnimateException(OptionError,"MissingArgument",option);
774 if (IsGeometry(argv[i]) == MagickFalse)
775 ThrowAnimateInvalidArgumentException(option,argv[i]);
778 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
782 if (LocaleCompare("extract",option+1) == 0)
787 if (i == (ssize_t) argc)
788 ThrowAnimateException(OptionError,"MissingArgument",option);
789 if (IsGeometry(argv[i]) == MagickFalse)
790 ThrowAnimateInvalidArgumentException(option,argv[i]);
793 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
797 if (LocaleCompare("filter",option+1) == 0)
805 if (i == (ssize_t) argc)
806 ThrowAnimateException(OptionError,"MissingArgument",option);
807 filter=ParseCommandOption(MagickFilterOptions,MagickFalse,argv[i]);
809 ThrowAnimateException(OptionError,"UnrecognizedImageFilter",
813 if (LocaleCompare("flatten",option+1) == 0)
815 if (LocaleCompare("font",option+1) == 0)
820 if (i == (ssize_t) argc)
821 ThrowAnimateException(OptionError,"MissingArgument",option);
822 resource_info.font=XGetResourceClass(resource_database,
823 GetClientName(),"font",argv[i]);
826 if (LocaleCompare("foreground",option+1) == 0)
831 if (i == (ssize_t) argc)
832 ThrowAnimateException(OptionError,"MissingArgument",option);
833 resource_info.foreground_color=argv[i];
836 if (LocaleCompare("format",option+1) == 0)
841 if (i == (ssize_t) argc)
842 ThrowAnimateException(OptionError,"MissingArgument",option);
845 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
849 if (LocaleCompare("gamma",option+1) == 0)
852 if (i == (ssize_t) argc)
853 ThrowAnimateException(OptionError,"MissingArgument",option);
854 if (IsGeometry(argv[i]) == MagickFalse)
855 ThrowAnimateInvalidArgumentException(option,argv[i]);
858 if (LocaleCompare("geometry",option+1) == 0)
860 resource_info.image_geometry=(char *) NULL;
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]);
871 if (LocaleCompare("gravity",option+1) == 0)
879 if (i == (ssize_t) argc)
880 ThrowAnimateException(OptionError,"MissingArgument",option);
881 gravity=ParseCommandOption(MagickGravityOptions,MagickFalse,
884 ThrowAnimateException(OptionError,"UnrecognizedGravityType",
888 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
892 if ((LocaleCompare("help",option+1) == 0) ||
893 (LocaleCompare("-help",option+1) == 0))
895 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
899 if (LocaleCompare("iconGeometry",option+1) == 0)
901 resource_info.icon_geometry=(char *) NULL;
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];
912 if (LocaleCompare("iconic",option+1) == 0)
914 resource_info.iconic=(*option == '-') ? MagickTrue : MagickFalse;
917 if (LocaleCompare("identify",option+1) == 0)
919 if (LocaleCompare("immutable",option+1) == 0)
921 resource_info.immutable=(*option == '-') ? MagickTrue : MagickFalse;
924 if (LocaleCompare("interlace",option+1) == 0)
932 if (i == (ssize_t) argc)
933 ThrowAnimateException(OptionError,"MissingArgument",option);
934 interlace=ParseCommandOption(MagickInterlaceOptions,MagickFalse,
937 ThrowAnimateException(OptionError,"UnrecognizedInterlaceType",
941 if (LocaleCompare("interpolate",option+1) == 0)
949 if (i == (ssize_t) argc)
950 ThrowAnimateException(OptionError,"MissingArgument",option);
951 interpolate=ParseCommandOption(MagickInterpolateOptions,MagickFalse,
954 ThrowAnimateException(OptionError,"UnrecognizedInterpolateMethod",
958 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
962 if (LocaleCompare("label",option+1) == 0)
967 if (i == (ssize_t) argc)
968 ThrowAnimateException(OptionError,"MissingArgument",option);
971 if (LocaleCompare("limit",option+1) == 0)
985 if (i == (ssize_t) argc)
986 ThrowAnimateException(OptionError,"MissingArgument",option);
987 resource=ParseCommandOption(MagickResourceOptions,MagickFalse,
990 ThrowAnimateException(OptionError,"UnrecognizedResourceType",
993 if (i == (ssize_t) argc)
994 ThrowAnimateException(OptionError,"MissingArgument",option);
995 value=StringToDouble(argv[i],&p);
997 if ((p == argv[i]) && (LocaleCompare("unlimited",argv[i]) != 0))
998 ThrowAnimateInvalidArgumentException(option,argv[i]);
1001 if (LocaleCompare("list",option+1) == 0)
1009 if (i == (ssize_t) argc)
1010 ThrowAnimateException(OptionError,"MissingArgument",option);
1011 list=ParseCommandOption(MagickListOptions,MagickFalse,argv[i]);
1013 ThrowAnimateException(OptionError,"UnrecognizedListType",argv[i]);
1014 status=MogrifyImageInfo(image_info,(int) (i-j+1),(const char **)
1017 return(status == 0 ? MagickTrue : MagickFalse);
1019 if (LocaleCompare("log",option+1) == 0)
1024 if ((i == (ssize_t) argc) ||
1025 (strchr(argv[i],'%') == (char *) NULL))
1026 ThrowAnimateException(OptionError,"MissingArgument",option);
1029 if (LocaleCompare("loop",option+1) == 0)
1034 if (i == (ssize_t) argc)
1035 ThrowAnimateException(OptionError,"MissingArgument",option);
1036 if (IsGeometry(argv[i]) == MagickFalse)
1037 ThrowAnimateInvalidArgumentException(option,argv[i]);
1040 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1044 if (LocaleCompare("map",option+1) == 0)
1046 resource_info.map_type=(char *) NULL;
1049 (void) CopyMagickString(argv[i]+1,"san",MagickPathExtent);
1051 if (i == (ssize_t) argc)
1052 ThrowAnimateException(OptionError,"MissingArgument",option);
1053 resource_info.map_type=argv[i];
1056 if (LocaleCompare("matte",option+1) == 0)
1058 if (LocaleCompare("mattecolor",option+1) == 0)
1063 if (i == (ssize_t) argc)
1064 ThrowAnimateException(OptionError,"MissingArgument",option);
1065 resource_info.matte_color=argv[i];
1068 if (LocaleCompare("monitor",option+1) == 0)
1070 if (LocaleCompare("monochrome",option+1) == 0)
1074 quantize_info->number_colors=2;
1075 quantize_info->colorspace=GRAYColorspace;
1078 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1082 if (LocaleCompare("name",option+1) == 0)
1084 resource_info.name=(char *) NULL;
1088 if (i == (ssize_t) argc)
1089 ThrowAnimateException(OptionError,"MissingArgument",option);
1090 resource_info.name=ConstantString(argv[i]);
1093 if (LocaleCompare("noop",option+1) == 0)
1095 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1099 if (LocaleCompare("pause",option+1) == 0)
1101 resource_info.pause=0;
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]);
1112 if (LocaleCompare("page",option+1) == 0)
1117 if (i == (ssize_t) argc)
1118 ThrowAnimateException(OptionError,"MissingArgument",option);
1121 if (LocaleCompare("profile",option+1) == 0)
1124 if (i == (ssize_t) argc)
1125 ThrowAnimateException(OptionError,"MissingArgument",option);
1128 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1132 if (LocaleCompare("quantize",option+1) == 0)
1140 if (i == (ssize_t) argc)
1141 ThrowAnimateException(OptionError,"MissingArgument",option);
1142 colorspace=ParseCommandOption(MagickColorspaceOptions,
1143 MagickFalse,argv[i]);
1145 ThrowAnimateException(OptionError,"UnrecognizedColorspace",
1149 if (LocaleCompare("quiet",option+1) == 0)
1151 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1155 if (LocaleCompare("regard-warnings",option+1) == 0)
1157 if (LocaleCompare("remote",option+1) == 0)
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);
1167 if (LocaleCompare("repage",option+1) == 0)
1172 if (i == (ssize_t) argc)
1173 ThrowAnimateException(OptionError,"MissingArgument",option);
1174 if (IsGeometry(argv[i]) == MagickFalse)
1175 ThrowAnimateInvalidArgumentException(option,argv[i]);
1178 if (LocaleCompare("resample",option+1) == 0)
1183 if (i == (ssize_t) argc)
1184 ThrowAnimateException(OptionError,"MissingArgument",option);
1185 if (IsGeometry(argv[i]) == MagickFalse)
1186 ThrowAnimateInvalidArgumentException(option,argv[i]);
1189 if (LocaleCompare("resize",option+1) == 0)
1194 if (i == (ssize_t) argc)
1195 ThrowAnimateException(OptionError,"MissingArgument",option);
1196 if (IsGeometry(argv[i]) == MagickFalse)
1197 ThrowAnimateInvalidArgumentException(option,argv[i]);
1200 if (LocaleNCompare("respect-parentheses",option+1,17) == 0)
1202 respect_parenthesis=(*option == '-') ? MagickTrue : MagickFalse;
1205 if (LocaleCompare("rotate",option+1) == 0)
1208 if (i == (ssize_t) argc)
1209 ThrowAnimateException(OptionError,"MissingArgument",option);
1210 if (IsGeometry(argv[i]) == MagickFalse)
1211 ThrowAnimateInvalidArgumentException(option,argv[i]);
1214 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1218 if (LocaleCompare("sampling-factor",option+1) == 0)
1223 if (i == (ssize_t) argc)
1224 ThrowAnimateException(OptionError,"MissingArgument",option);
1225 if (IsGeometry(argv[i]) == MagickFalse)
1226 ThrowAnimateInvalidArgumentException(option,argv[i]);
1229 if (LocaleCompare("seed",option+1) == 0)
1234 if (i == (ssize_t) argc)
1235 ThrowAnimateException(OptionError,"MissingArgument",option);
1236 if (IsGeometry(argv[i]) == MagickFalse)
1237 ThrowAnimateInvalidArgumentException(option,argv[i]);
1240 if (LocaleCompare("scenes",option+1) == 0) /* deprecated */
1245 if (i == (ssize_t) argc)
1246 ThrowAnimateException(OptionError,"MissingArgument",option);
1247 if (IsSceneGeometry(argv[i],MagickFalse) == MagickFalse)
1248 ThrowAnimateInvalidArgumentException(option,argv[i]);
1251 if (LocaleCompare("set",option+1) == 0)
1254 if (i == (ssize_t) argc)
1255 ThrowAnimateException(OptionError,"MissingArgument",option);
1259 if (i == (ssize_t) argc)
1260 ThrowAnimateException(OptionError,"MissingArgument",option);
1263 if (LocaleCompare("shared-memory",option+1) == 0)
1265 resource_info.use_shared_memory=(*option == '-') ? MagickTrue :
1269 if (LocaleCompare("size",option+1) == 0)
1274 if (i == (ssize_t) argc)
1275 ThrowAnimateException(OptionError,"MissingArgument",option);
1276 if (IsGeometry(argv[i]) == MagickFalse)
1277 ThrowAnimateInvalidArgumentException(option,argv[i]);
1280 if (LocaleCompare("strip",option+1) == 0)
1282 if (LocaleCompare("support",option+1) == 0)
1284 i++; /* deprecated */
1287 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1291 if (LocaleCompare("text-font",option+1) == 0)
1293 resource_info.text_font=(char *) NULL;
1297 if (i == (ssize_t) argc)
1298 ThrowAnimateException(OptionError,"MissingArgument",option);
1299 resource_info.text_font=XGetResourceClass(resource_database,
1300 GetClientName(),"font",argv[i]);
1303 if (LocaleCompare("thumbnail",option+1) == 0)
1308 if (i == (ssize_t) argc)
1309 ThrowAnimateException(OptionError,"MissingArgument",option);
1310 if (IsGeometry(argv[i]) == MagickFalse)
1311 ThrowAnimateInvalidArgumentException(option,argv[i]);
1314 if (LocaleCompare("title",option+1) == 0)
1316 resource_info.title=(char *) NULL;
1320 if (i == (ssize_t) argc)
1321 ThrowAnimateException(OptionError,"MissingArgument",option);
1322 resource_info.title=argv[i];
1325 if (LocaleCompare("transparent-color",option+1) == 0)
1330 if (i == (ssize_t) argc)
1331 ThrowAnimateException(OptionError,"MissingArgument",option);
1334 if (LocaleCompare("treedepth",option+1) == 0)
1336 quantize_info->tree_depth=0;
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]);
1347 if (LocaleCompare("trim",option+1) == 0)
1349 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1353 if (LocaleCompare("verbose",option+1) == 0)
1355 if ((LocaleCompare("version",option+1) == 0) ||
1356 (LocaleCompare("-version",option+1) == 0))
1358 ListMagickVersion(stdout);
1361 if (LocaleCompare("virtual-pixel",option+1) == 0)
1369 if (i == (ssize_t) argc)
1370 ThrowAnimateException(OptionError,"MissingArgument",option);
1371 method=ParseCommandOption(MagickVirtualPixelOptions,MagickFalse,
1374 ThrowAnimateException(OptionError,
1375 "UnrecognizedVirtualPixelMethod",argv[i]);
1378 if (LocaleCompare("visual",option+1) == 0)
1380 resource_info.visual_type=(char *) NULL;
1384 if (i == (ssize_t) argc)
1385 ThrowAnimateException(OptionError,"MissingArgument",option);
1386 resource_info.visual_type=argv[i];
1389 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1393 if (LocaleCompare("window",option+1) == 0)
1395 resource_info.window_id=(char *) NULL;
1399 if (i == (ssize_t) argc)
1400 ThrowAnimateException(OptionError,"MissingArgument",option);
1401 resource_info.window_id=argv[i];
1404 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1409 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1411 fire=(GetCommandOptionFlags(MagickCommandOptions,MagickFalse,option) &
1412 FireOptionFlag) == 0 ? MagickFalse : MagickTrue;
1413 if (fire != MagickFalse)
1414 FireImageStack(MagickFalse,MagickTrue,MagickTrue);
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)
1426 XAnimateBackgroundImage(display,&resource_info,image,exception);
1435 Animate image to X server.
1437 animate_image=XAnimateImages(display,&resource_info,argv,argc,image,
1439 while (animate_image != (Image *) NULL)
1441 image=animate_image;
1442 animate_image=XAnimateImages(display,&resource_info,argv,argc,image,
1444 if (animate_image != image)
1445 image=DestroyImageList(image);
1449 return(status != 0 ? MagickTrue : MagickFalse);
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());