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-2015 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 % http://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 "-repage geometry size and location of an image canvas (operator)",
121 "-resample geometry change the resolution of an image",
122 "-resize geometry resize the image",
123 "-rotate degrees apply Paeth rotation to the image",
124 "-strip strip image of all profiles and comments",
125 "-thumbnail geometry create a thumbnail of the image",
126 "-trim trim image edges",
131 "-alpha option on, activate, off, deactivate, set, opaque, copy",
132 " transparent, extract, background, or shape",
133 "-authenticate password",
134 " decipher image with this password",
135 "-backdrop display image centered on a backdrop",
136 "-colormap type Shared or Private",
137 "-colorspace type alternate image colorspace",
138 "-decipher filename convert cipher pixels to plain pixels",
139 "-define format:option",
140 " define one or more image format options",
141 "-delay value display the next image after pausing",
142 "-density geometry horizontal and vertical density of the image",
143 "-depth value image depth",
144 "-display server display image to this X server",
145 "-dispose method layer disposal method",
146 "-dither method apply error diffusion to image",
147 "-filter type use this filter when resizing an image",
148 "-format \"string\" output formatted image characteristics",
149 "-gamma value level of gamma correction",
150 "-geometry geometry preferred size and location of the Image window",
151 "-gravity type horizontal and vertical backdrop placement",
152 "-identify identify the format and characteristics of the image",
153 "-immutable displayed image cannot be modified",
154 "-interlace type type of image interlacing scheme",
155 "-interpolate method pixel color interpolation method",
156 "-limit type value pixel cache resource limit",
157 "-loop iterations loop images then exit",
158 "-matte store matte channel if the image has one",
159 "-map type display image using this Standard Colormap",
160 "-monitor monitor progress",
161 "-pause seconds to pause before reanimating",
162 "-page geometry size and location of an image canvas (setting)",
163 "-quantize colorspace reduce colors in this colorspace",
164 "-quiet suppress all warning messages",
165 "-regard-warnings pay attention to warning messages",
166 "-remote command execute a command in an remote display process",
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 "-borderwidth, -font, -foreground, -iconGeometry, -iconic, -name,\n");
213 (void) printf("-mattecolor, -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) ResetMagickMemory(&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 (LocaleCompare("display",option+1) == 0)
350 User specified server name.
353 if (i == (ssize_t) argc)
354 ThrowAnimateException(OptionError,"MissingArgument",option);
357 if ((LocaleCompare("help",option+1) == 0) ||
358 (LocaleCompare("-help",option+1) == 0))
359 return(AnimateUsage());
362 Get user defaults from X resource database.
364 display=XOpenDisplay(server_name);
365 if (display == (Display *) NULL)
366 ThrowAnimateException(XServerError,"UnableToOpenXServer",
367 XDisplayName(server_name));
368 (void) XSetErrorHandler(XError);
369 resource_database=XGetResourceDatabase(display,GetClientName());
370 XGetResourceInfo(image_info,resource_database,GetClientName(),
372 quantize_info=resource_info.quantize_info;
373 image_info->density=XGetResourceInstance(resource_database,GetClientName(),
374 "density",(char *) NULL);
375 if (image_info->density == (char *) NULL)
376 image_info->density=XGetScreenDensity(display);
377 resource_value=XGetResourceInstance(resource_database,GetClientName(),
379 image_info->interlace=(InterlaceType)
380 ParseCommandOption(MagickInterlaceOptions,MagickFalse,resource_value);
381 resource_value=XGetResourceInstance(resource_database,GetClientName(),
383 image_info->verbose=IsStringTrue(resource_value);
384 resource_value=XGetResourceInstance(resource_database,GetClientName(),
386 quantize_info->dither_method=IsStringTrue(resource_value) != MagickFalse ?
387 RiemersmaDitherMethod : NoDitherMethod;
391 for (i=1; i <= (ssize_t) argc; i++)
393 if (i < (ssize_t) argc)
396 if (image != (Image *) NULL)
399 if (isatty(STDIN_FILENO) != MagickFalse)
403 if (LocaleCompare(option,"(") == 0)
405 FireImageStack(MagickFalse,MagickTrue,pend);
406 if (k == MaxImageStackDepth)
407 ThrowAnimateException(OptionError,"ParenthesisNestedTooDeeply",
412 if (LocaleCompare(option,")") == 0)
414 FireImageStack(MagickFalse,MagickTrue,MagickTrue);
416 ThrowAnimateException(OptionError,"UnableToParseExpression",option);
420 if (IsCommandOption(option) == MagickFalse)
431 FireImageStack(MagickFalse,MagickFalse,pend);
433 if ((LocaleCompare(filename,"--") == 0) && (i < (ssize_t) (argc-1)))
438 if (image_info->ping != MagickFalse)
439 images=PingImages(image_info,filename,exception);
441 images=ReadImages(image_info,filename,exception);
442 status&=(images != (Image *) NULL) &&
443 (exception->severity < ErrorException);
444 if (images == (Image *) NULL)
446 AppendImageStack(images);
449 pend=image != (Image *) NULL ? MagickTrue : MagickFalse;
454 if (LocaleCompare("alpha",option+1) == 0)
462 if (i == (ssize_t) argc)
463 ThrowAnimateException(OptionError,"MissingArgument",option);
464 type=ParseCommandOption(MagickAlphaChannelOptions,MagickFalse,argv[i]);
466 ThrowAnimateException(OptionError,"UnrecognizedAlphaChannelOption",
470 if (LocaleCompare("authenticate",option+1) == 0)
475 if (i == (ssize_t) argc)
476 ThrowAnimateException(OptionError,"MissingArgument",option);
479 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
483 if (LocaleCompare("backdrop",option+1) == 0)
485 resource_info.backdrop=(*option == '-') ? MagickTrue : MagickFalse;
488 if (LocaleCompare("background",option+1) == 0)
493 if (i == (ssize_t) argc)
494 ThrowAnimateException(OptionError,"MissingArgument",option);
495 resource_info.background_color=argv[i];
498 if (LocaleCompare("bordercolor",option+1) == 0)
503 if (i == (ssize_t) argc)
504 ThrowAnimateException(OptionError,"MissingArgument",option);
505 resource_info.border_color=argv[i];
508 if (LocaleCompare("borderwidth",option+1) == 0)
510 resource_info.border_width=0;
514 if ((i == (ssize_t) argc) || (IsGeometry(argv[i]) == MagickFalse))
515 ThrowAnimateException(OptionError,"MissingArgument",option);
516 resource_info.border_width=(unsigned int)
517 StringToUnsignedLong(argv[i]);
520 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
524 if (LocaleCompare("cache",option+1) == 0)
529 if (i == (ssize_t) argc)
530 ThrowAnimateException(OptionError,"MissingArgument",option);
531 if (IsGeometry(argv[i]) == MagickFalse)
532 ThrowAnimateInvalidArgumentException(option,argv[i]);
535 if (LocaleCompare("channel",option+1) == 0)
543 if (i == (ssize_t) argc)
544 ThrowAnimateException(OptionError,"MissingArgument",option);
545 channel=ParseChannelOption(argv[i]);
547 ThrowAnimateException(OptionError,"UnrecognizedChannelType",
551 if (LocaleCompare("clone",option+1) == 0)
558 clone_images=image_stack[k-1].image;
559 if (clone_images == (Image *) NULL)
560 ThrowAnimateException(ImageError,"UnableToCloneImage",option);
561 FireImageStack(MagickFalse,MagickTrue,MagickTrue);
563 clone_images=CloneImages(clone_images,"-1",exception);
567 if (i == (ssize_t) argc)
568 ThrowAnimateException(OptionError,"MissingArgument",option);
569 if (IsSceneGeometry(argv[i],MagickFalse) == MagickFalse)
570 ThrowAnimateInvalidArgumentException(option,argv[i]);
571 clone_images=CloneImages(clone_images,argv[i],exception);
573 if (clone_images == (Image *) NULL)
574 ThrowAnimateException(OptionError,"NoSuchImage",option);
575 AppendImageStack(clone_images);
578 if (LocaleCompare("coalesce",option+1) == 0)
580 if (LocaleCompare("colormap",option+1) == 0)
582 resource_info.colormap=PrivateColormap;
586 if (i == (ssize_t) argc)
587 ThrowAnimateException(OptionError,"MissingArgument",option);
588 resource_info.colormap=UndefinedColormap;
589 if (LocaleCompare("private",argv[i]) == 0)
590 resource_info.colormap=PrivateColormap;
591 if (LocaleCompare("shared",argv[i]) == 0)
592 resource_info.colormap=SharedColormap;
593 if (resource_info.colormap == UndefinedColormap)
594 ThrowAnimateException(OptionError,"UnrecognizedColormapType",
598 if (LocaleCompare("colors",option+1) == 0)
600 quantize_info->number_colors=0;
604 if (i == (ssize_t) argc)
605 ThrowAnimateException(OptionError,"MissingArgument",option);
606 if (IsGeometry(argv[i]) == MagickFalse)
607 ThrowAnimateInvalidArgumentException(option,argv[i]);
608 quantize_info->number_colors=StringToUnsignedLong(argv[i]);
611 if (LocaleCompare("colorspace",option+1) == 0)
619 if (i == (ssize_t) argc)
620 ThrowAnimateException(OptionError,"MissingArgument",option);
621 colorspace=ParseCommandOption(MagickColorspaceOptions,
622 MagickFalse,argv[i]);
624 ThrowAnimateException(OptionError,"UnrecognizedColorspace",
628 if (LocaleCompare("concurrent",option+1) == 0)
630 if (LocaleCompare("crop",option+1) == 0)
635 if (i == (ssize_t) argc)
636 ThrowAnimateException(OptionError,"MissingArgument",option);
637 if (IsGeometry(argv[i]) == MagickFalse)
638 ThrowAnimateInvalidArgumentException(option,argv[i]);
641 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
645 if (LocaleCompare("debug",option+1) == 0)
653 if (i == (ssize_t) argc)
654 ThrowAnimateException(OptionError,"MissingArgument",option);
655 event=ParseCommandOption(MagickLogEventOptions,MagickFalse,argv[i]);
657 ThrowAnimateException(OptionError,"UnrecognizedEventType",
659 (void) SetLogEventMask(argv[i]);
662 if (LocaleCompare("decipher",option+1) == 0)
667 if (i == (ssize_t) argc)
668 ThrowAnimateException(OptionError,"MissingArgument",option);
671 if (LocaleCompare("define",option+1) == 0)
674 if (i == (ssize_t) argc)
675 ThrowAnimateException(OptionError,"MissingArgument",option);
681 define=GetImageOption(image_info,argv[i]);
682 if (define == (const char *) NULL)
683 ThrowAnimateException(OptionError,"NoSuchOption",argv[i]);
688 if (LocaleCompare("delay",option+1) == 0)
693 if (i == (ssize_t) argc)
694 ThrowAnimateException(OptionError,"MissingArgument",option);
695 if (IsGeometry(argv[i]) == MagickFalse)
696 ThrowAnimateInvalidArgumentException(option,argv[i]);
699 if (LocaleCompare("density",option+1) == 0)
704 if (i == (ssize_t) argc)
705 ThrowAnimateException(OptionError,"MissingArgument",option);
706 if (IsGeometry(argv[i]) == MagickFalse)
707 ThrowAnimateInvalidArgumentException(option,argv[i]);
710 if (LocaleCompare("depth",option+1) == 0)
715 if (i == (ssize_t) argc)
716 ThrowAnimateException(OptionError,"MissingArgument",option);
717 if (IsGeometry(argv[i]) == MagickFalse)
718 ThrowAnimateInvalidArgumentException(option,argv[i]);
721 if (LocaleCompare("display",option+1) == 0)
726 if (i == (ssize_t) argc)
727 ThrowAnimateException(OptionError,"MissingArgument",option);
730 if (LocaleCompare("dispose",option+1) == 0)
738 if (i == (ssize_t) argc)
739 ThrowAnimateException(OptionError,"MissingArgument",option);
740 dispose=ParseCommandOption(MagickDisposeOptions,MagickFalse,argv[i]);
742 ThrowAnimateException(OptionError,"UnrecognizedDisposeMethod",
746 if (LocaleCompare("dither",option+1) == 0)
751 quantize_info->dither_method=NoDitherMethod;
755 if (i == (ssize_t) argc)
756 ThrowAnimateException(OptionError,"MissingArgument",option);
757 method=ParseCommandOption(MagickDitherOptions,MagickFalse,argv[i]);
759 ThrowAnimateException(OptionError,"UnrecognizedDitherMethod",
761 quantize_info->dither_method=(DitherMethod) method;
764 if (LocaleCompare("duration",option+1) == 0)
769 if (i == (ssize_t) argc)
770 ThrowAnimateException(OptionError,"MissingArgument",option);
771 if (IsGeometry(argv[i]) == MagickFalse)
772 ThrowAnimateInvalidArgumentException(option,argv[i]);
775 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
779 if (LocaleCompare("extract",option+1) == 0)
784 if (i == (ssize_t) argc)
785 ThrowAnimateException(OptionError,"MissingArgument",option);
786 if (IsGeometry(argv[i]) == MagickFalse)
787 ThrowAnimateInvalidArgumentException(option,argv[i]);
790 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
794 if (LocaleCompare("filter",option+1) == 0)
802 if (i == (ssize_t) argc)
803 ThrowAnimateException(OptionError,"MissingArgument",option);
804 filter=ParseCommandOption(MagickFilterOptions,MagickFalse,argv[i]);
806 ThrowAnimateException(OptionError,"UnrecognizedImageFilter",
810 if (LocaleCompare("flatten",option+1) == 0)
812 if (LocaleCompare("font",option+1) == 0)
817 if (i == (ssize_t) argc)
818 ThrowAnimateException(OptionError,"MissingArgument",option);
819 resource_info.font=XGetResourceClass(resource_database,
820 GetClientName(),"font",argv[i]);
823 if (LocaleCompare("foreground",option+1) == 0)
828 if (i == (ssize_t) argc)
829 ThrowAnimateException(OptionError,"MissingArgument",option);
830 resource_info.foreground_color=argv[i];
833 if (LocaleCompare("format",option+1) == 0)
838 if (i == (ssize_t) argc)
839 ThrowAnimateException(OptionError,"MissingArgument",option);
842 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
846 if (LocaleCompare("gamma",option+1) == 0)
849 if (i == (ssize_t) argc)
850 ThrowAnimateException(OptionError,"MissingArgument",option);
851 if (IsGeometry(argv[i]) == MagickFalse)
852 ThrowAnimateInvalidArgumentException(option,argv[i]);
855 if (LocaleCompare("geometry",option+1) == 0)
857 resource_info.image_geometry=(char *) NULL;
861 if (i == (ssize_t) argc)
862 ThrowAnimateException(OptionError,"MissingArgument",option);
863 if (IsGeometry(argv[i]) == MagickFalse)
864 ThrowAnimateInvalidArgumentException(option,argv[i]);
865 resource_info.image_geometry=ConstantString(argv[i]);
868 if (LocaleCompare("gravity",option+1) == 0)
876 if (i == (ssize_t) argc)
877 ThrowAnimateException(OptionError,"MissingArgument",option);
878 gravity=ParseCommandOption(MagickGravityOptions,MagickFalse,
881 ThrowAnimateException(OptionError,"UnrecognizedGravityType",
885 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
889 if ((LocaleCompare("help",option+1) == 0) ||
890 (LocaleCompare("-help",option+1) == 0))
892 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
896 if (LocaleCompare("iconGeometry",option+1) == 0)
898 resource_info.icon_geometry=(char *) NULL;
902 if (i == (ssize_t) argc)
903 ThrowAnimateException(OptionError,"MissingArgument",option);
904 if (IsGeometry(argv[i]) == MagickFalse)
905 ThrowAnimateInvalidArgumentException(option,argv[i]);
906 resource_info.icon_geometry=argv[i];
909 if (LocaleCompare("iconic",option+1) == 0)
911 resource_info.iconic=(*option == '-') ? MagickTrue : MagickFalse;
914 if (LocaleCompare("identify",option+1) == 0)
916 if (LocaleCompare("immutable",option+1) == 0)
918 resource_info.immutable=(*option == '-') ? MagickTrue : MagickFalse;
921 if (LocaleCompare("interlace",option+1) == 0)
929 if (i == (ssize_t) argc)
930 ThrowAnimateException(OptionError,"MissingArgument",option);
931 interlace=ParseCommandOption(MagickInterlaceOptions,MagickFalse,
934 ThrowAnimateException(OptionError,"UnrecognizedInterlaceType",
938 if (LocaleCompare("interpolate",option+1) == 0)
946 if (i == (ssize_t) argc)
947 ThrowAnimateException(OptionError,"MissingArgument",option);
948 interpolate=ParseCommandOption(MagickInterpolateOptions,MagickFalse,
951 ThrowAnimateException(OptionError,"UnrecognizedInterpolateMethod",
955 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
959 if (LocaleCompare("label",option+1) == 0)
964 if (i == (ssize_t) argc)
965 ThrowAnimateException(OptionError,"MissingArgument",option);
968 if (LocaleCompare("limit",option+1) == 0)
982 if (i == (ssize_t) argc)
983 ThrowAnimateException(OptionError,"MissingArgument",option);
984 resource=ParseCommandOption(MagickResourceOptions,MagickFalse,
987 ThrowAnimateException(OptionError,"UnrecognizedResourceType",
990 if (i == (ssize_t) argc)
991 ThrowAnimateException(OptionError,"MissingArgument",option);
992 value=StringToDouble(argv[i],&p);
994 if ((p == argv[i]) && (LocaleCompare("unlimited",argv[i]) != 0))
995 ThrowAnimateInvalidArgumentException(option,argv[i]);
998 if (LocaleCompare("list",option+1) == 0)
1006 if (i == (ssize_t) argc)
1007 ThrowAnimateException(OptionError,"MissingArgument",option);
1008 list=ParseCommandOption(MagickListOptions,MagickFalse,argv[i]);
1010 ThrowAnimateException(OptionError,"UnrecognizedListType",argv[i]);
1011 status=MogrifyImageInfo(image_info,(int) (i-j+1),(const char **)
1014 return(status == 0 ? MagickTrue : MagickFalse);
1016 if (LocaleCompare("log",option+1) == 0)
1021 if ((i == (ssize_t) argc) ||
1022 (strchr(argv[i],'%') == (char *) NULL))
1023 ThrowAnimateException(OptionError,"MissingArgument",option);
1026 if (LocaleCompare("loop",option+1) == 0)
1031 if (i == (ssize_t) argc)
1032 ThrowAnimateException(OptionError,"MissingArgument",option);
1033 if (IsGeometry(argv[i]) == MagickFalse)
1034 ThrowAnimateInvalidArgumentException(option,argv[i]);
1037 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1041 if (LocaleCompare("map",option+1) == 0)
1043 resource_info.map_type=(char *) NULL;
1046 (void) CopyMagickString(argv[i]+1,"san",MagickPathExtent);
1048 if (i == (ssize_t) argc)
1049 ThrowAnimateException(OptionError,"MissingArgument",option);
1050 resource_info.map_type=argv[i];
1053 if (LocaleCompare("matte",option+1) == 0)
1055 if (LocaleCompare("mattecolor",option+1) == 0)
1060 if (i == (ssize_t) argc)
1061 ThrowAnimateException(OptionError,"MissingArgument",option);
1062 resource_info.matte_color=argv[i];
1065 if (LocaleCompare("monitor",option+1) == 0)
1067 if (LocaleCompare("monochrome",option+1) == 0)
1071 quantize_info->number_colors=2;
1072 quantize_info->colorspace=GRAYColorspace;
1075 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1079 if (LocaleCompare("name",option+1) == 0)
1081 resource_info.name=(char *) NULL;
1085 if (i == (ssize_t) argc)
1086 ThrowAnimateException(OptionError,"MissingArgument",option);
1087 resource_info.name=ConstantString(argv[i]);
1090 if (LocaleCompare("noop",option+1) == 0)
1092 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1096 if (LocaleCompare("pause",option+1) == 0)
1098 resource_info.pause=0;
1102 if (i == (ssize_t) argc)
1103 ThrowAnimateException(OptionError,"MissingArgument",option);
1104 if (IsGeometry(argv[i]) == MagickFalse)
1105 ThrowAnimateInvalidArgumentException(option,argv[i]);
1106 resource_info.pause=(unsigned int) StringToUnsignedLong(argv[i]);
1109 if (LocaleCompare("page",option+1) == 0)
1114 if (i == (ssize_t) argc)
1115 ThrowAnimateException(OptionError,"MissingArgument",option);
1118 if (LocaleCompare("profile",option+1) == 0)
1121 if (i == (ssize_t) argc)
1122 ThrowAnimateException(OptionError,"MissingArgument",option);
1125 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1129 if (LocaleCompare("quantize",option+1) == 0)
1137 if (i == (ssize_t) argc)
1138 ThrowAnimateException(OptionError,"MissingArgument",option);
1139 colorspace=ParseCommandOption(MagickColorspaceOptions,
1140 MagickFalse,argv[i]);
1142 ThrowAnimateException(OptionError,"UnrecognizedColorspace",
1146 if (LocaleCompare("quiet",option+1) == 0)
1148 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1152 if (LocaleCompare("regard-warnings",option+1) == 0)
1154 if (LocaleCompare("remote",option+1) == 0)
1157 if (i == (ssize_t) argc)
1158 ThrowAnimateException(OptionError,"MissingArgument",option);
1159 if (XRemoteCommand(display,resource_info.window_id,argv[i]) != 0)
1160 return(MagickFalse);
1164 if (LocaleCompare("repage",option+1) == 0)
1169 if (i == (ssize_t) argc)
1170 ThrowAnimateException(OptionError,"MissingArgument",option);
1171 if (IsGeometry(argv[i]) == MagickFalse)
1172 ThrowAnimateInvalidArgumentException(option,argv[i]);
1175 if (LocaleCompare("resample",option+1) == 0)
1180 if (i == (ssize_t) argc)
1181 ThrowAnimateException(OptionError,"MissingArgument",option);
1182 if (IsGeometry(argv[i]) == MagickFalse)
1183 ThrowAnimateInvalidArgumentException(option,argv[i]);
1186 if (LocaleCompare("resize",option+1) == 0)
1191 if (i == (ssize_t) argc)
1192 ThrowAnimateException(OptionError,"MissingArgument",option);
1193 if (IsGeometry(argv[i]) == MagickFalse)
1194 ThrowAnimateInvalidArgumentException(option,argv[i]);
1197 if (LocaleNCompare("respect-parentheses",option+1,17) == 0)
1199 respect_parenthesis=(*option == '-') ? MagickTrue : MagickFalse;
1202 if (LocaleCompare("rotate",option+1) == 0)
1205 if (i == (ssize_t) argc)
1206 ThrowAnimateException(OptionError,"MissingArgument",option);
1207 if (IsGeometry(argv[i]) == MagickFalse)
1208 ThrowAnimateInvalidArgumentException(option,argv[i]);
1211 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1215 if (LocaleCompare("sampling-factor",option+1) == 0)
1220 if (i == (ssize_t) argc)
1221 ThrowAnimateException(OptionError,"MissingArgument",option);
1222 if (IsGeometry(argv[i]) == MagickFalse)
1223 ThrowAnimateInvalidArgumentException(option,argv[i]);
1226 if (LocaleCompare("seed",option+1) == 0)
1231 if (i == (ssize_t) argc)
1232 ThrowAnimateException(OptionError,"MissingArgument",option);
1233 if (IsGeometry(argv[i]) == MagickFalse)
1234 ThrowAnimateInvalidArgumentException(option,argv[i]);
1237 if (LocaleCompare("scenes",option+1) == 0) /* deprecated */
1242 if (i == (ssize_t) argc)
1243 ThrowAnimateException(OptionError,"MissingArgument",option);
1244 if (IsSceneGeometry(argv[i],MagickFalse) == MagickFalse)
1245 ThrowAnimateInvalidArgumentException(option,argv[i]);
1248 if (LocaleCompare("set",option+1) == 0)
1251 if (i == (ssize_t) argc)
1252 ThrowAnimateException(OptionError,"MissingArgument",option);
1256 if (i == (ssize_t) argc)
1257 ThrowAnimateException(OptionError,"MissingArgument",option);
1260 if (LocaleCompare("shared-memory",option+1) == 0)
1262 resource_info.use_shared_memory=(*option == '-') ? MagickTrue :
1266 if (LocaleCompare("size",option+1) == 0)
1271 if (i == (ssize_t) argc)
1272 ThrowAnimateException(OptionError,"MissingArgument",option);
1273 if (IsGeometry(argv[i]) == MagickFalse)
1274 ThrowAnimateInvalidArgumentException(option,argv[i]);
1277 if (LocaleCompare("strip",option+1) == 0)
1279 if (LocaleCompare("support",option+1) == 0)
1281 i++; /* deprecated */
1284 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1288 if (LocaleCompare("text-font",option+1) == 0)
1290 resource_info.text_font=(char *) NULL;
1294 if (i == (ssize_t) argc)
1295 ThrowAnimateException(OptionError,"MissingArgument",option);
1296 resource_info.text_font=XGetResourceClass(resource_database,
1297 GetClientName(),"font",argv[i]);
1300 if (LocaleCompare("thumbnail",option+1) == 0)
1305 if (i == (ssize_t) argc)
1306 ThrowAnimateException(OptionError,"MissingArgument",option);
1307 if (IsGeometry(argv[i]) == MagickFalse)
1308 ThrowAnimateInvalidArgumentException(option,argv[i]);
1311 if (LocaleCompare("title",option+1) == 0)
1313 resource_info.title=(char *) NULL;
1317 if (i == (ssize_t) argc)
1318 ThrowAnimateException(OptionError,"MissingArgument",option);
1319 resource_info.title=argv[i];
1322 if (LocaleCompare("transparent-color",option+1) == 0)
1327 if (i == (ssize_t) argc)
1328 ThrowAnimateException(OptionError,"MissingArgument",option);
1331 if (LocaleCompare("treedepth",option+1) == 0)
1333 quantize_info->tree_depth=0;
1337 if (i == (ssize_t) argc)
1338 ThrowAnimateException(OptionError,"MissingArgument",option);
1339 if (IsGeometry(argv[i]) == MagickFalse)
1340 ThrowAnimateInvalidArgumentException(option,argv[i]);
1341 quantize_info->tree_depth=StringToUnsignedLong(argv[i]);
1344 if (LocaleCompare("trim",option+1) == 0)
1346 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1350 if (LocaleCompare("verbose",option+1) == 0)
1352 if ((LocaleCompare("version",option+1) == 0) ||
1353 (LocaleCompare("-version",option+1) == 0))
1355 ListMagickVersion(stdout);
1358 if (LocaleCompare("virtual-pixel",option+1) == 0)
1366 if (i == (ssize_t) argc)
1367 ThrowAnimateException(OptionError,"MissingArgument",option);
1368 method=ParseCommandOption(MagickVirtualPixelOptions,MagickFalse,
1371 ThrowAnimateException(OptionError,
1372 "UnrecognizedVirtualPixelMethod",argv[i]);
1375 if (LocaleCompare("visual",option+1) == 0)
1377 resource_info.visual_type=(char *) NULL;
1381 if (i == (ssize_t) argc)
1382 ThrowAnimateException(OptionError,"MissingArgument",option);
1383 resource_info.visual_type=argv[i];
1386 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1390 if (LocaleCompare("window",option+1) == 0)
1392 resource_info.window_id=(char *) NULL;
1396 if (i == (ssize_t) argc)
1397 ThrowAnimateException(OptionError,"MissingArgument",option);
1398 resource_info.window_id=argv[i];
1401 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1406 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1408 fire=(GetCommandOptionFlags(MagickCommandOptions,MagickFalse,option) &
1409 FireOptionFlag) == 0 ? MagickFalse : MagickTrue;
1410 if (fire != MagickFalse)
1411 FireImageStack(MagickFalse,MagickTrue,MagickTrue);
1415 ThrowAnimateException(OptionError,"UnbalancedParenthesis",argv[i]);
1416 if (image == (Image *) NULL)
1417 ThrowAnimateException(OptionError,"MissingAnImageFilename",argv[argc-1])
1418 FinalizeImageSettings(image_info,image,MagickTrue);
1419 if (image == (Image *) NULL)
1420 ThrowAnimateException(OptionError,"MissingAnImageFilename",argv[argc-1])
1421 if (resource_info.window_id != (char *) NULL)
1423 XAnimateBackgroundImage(display,&resource_info,image,exception);
1432 Animate image to X server.
1434 animate_image=XAnimateImages(display,&resource_info,argv,argc,image,
1436 while (animate_image != (Image *) NULL)
1438 image=animate_image;
1439 animate_image=XAnimateImages(display,&resource_info,argv,argc,image,
1441 if (animate_image != image)
1442 image=DestroyImageList(image);
1446 return(status != 0 ? MagickTrue : MagickFalse);
1450 (void) ThrowMagickException(exception,GetMagickModule(),MissingDelegateError,
1451 "DelegateLibrarySupportNotBuiltIn","'%s' (X11)",image_info->filename);
1452 return(AnimateUsage());