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-2017 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 "-alpha-color, -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) 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,
467 ThrowAnimateException(OptionError,
468 "UnrecognizedAlphaChannelOption",argv[i]);
471 if (LocaleCompare("alpha-color",option+1) == 0)
476 if (i == (ssize_t) argc)
477 ThrowAnimateException(OptionError,"MissingArgument",option);
478 resource_info.alpha_color=argv[i];
481 if (LocaleCompare("authenticate",option+1) == 0)
486 if (i == (ssize_t) argc)
487 ThrowAnimateException(OptionError,"MissingArgument",option);
490 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
494 if (LocaleCompare("backdrop",option+1) == 0)
496 resource_info.backdrop=(*option == '-') ? MagickTrue : MagickFalse;
499 if (LocaleCompare("background",option+1) == 0)
504 if (i == (ssize_t) argc)
505 ThrowAnimateException(OptionError,"MissingArgument",option);
506 resource_info.background_color=argv[i];
509 if (LocaleCompare("bordercolor",option+1) == 0)
514 if (i == (ssize_t) argc)
515 ThrowAnimateException(OptionError,"MissingArgument",option);
516 resource_info.border_color=argv[i];
519 if (LocaleCompare("borderwidth",option+1) == 0)
521 resource_info.border_width=0;
525 if ((i == (ssize_t) argc) || (IsGeometry(argv[i]) == MagickFalse))
526 ThrowAnimateException(OptionError,"MissingArgument",option);
527 resource_info.border_width=(unsigned int)
528 StringToUnsignedLong(argv[i]);
531 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
535 if (LocaleCompare("cache",option+1) == 0)
540 if (i == (ssize_t) argc)
541 ThrowAnimateException(OptionError,"MissingArgument",option);
542 if (IsGeometry(argv[i]) == MagickFalse)
543 ThrowAnimateInvalidArgumentException(option,argv[i]);
546 if (LocaleCompare("channel",option+1) == 0)
554 if (i == (ssize_t) argc)
555 ThrowAnimateException(OptionError,"MissingArgument",option);
556 channel=ParseChannelOption(argv[i]);
558 ThrowAnimateException(OptionError,"UnrecognizedChannelType",
562 if (LocaleCompare("clone",option+1) == 0)
569 clone_images=image_stack[k-1].image;
570 if (clone_images == (Image *) NULL)
571 ThrowAnimateException(ImageError,"UnableToCloneImage",option);
572 FireImageStack(MagickFalse,MagickTrue,MagickTrue);
574 clone_images=CloneImages(clone_images,"-1",exception);
578 if (i == (ssize_t) argc)
579 ThrowAnimateException(OptionError,"MissingArgument",option);
580 if (IsSceneGeometry(argv[i],MagickFalse) == MagickFalse)
581 ThrowAnimateInvalidArgumentException(option,argv[i]);
582 clone_images=CloneImages(clone_images,argv[i],exception);
584 if (clone_images == (Image *) NULL)
585 ThrowAnimateException(OptionError,"NoSuchImage",option);
586 AppendImageStack(clone_images);
589 if (LocaleCompare("coalesce",option+1) == 0)
591 if (LocaleCompare("colormap",option+1) == 0)
593 resource_info.colormap=PrivateColormap;
597 if (i == (ssize_t) argc)
598 ThrowAnimateException(OptionError,"MissingArgument",option);
599 resource_info.colormap=UndefinedColormap;
600 if (LocaleCompare("private",argv[i]) == 0)
601 resource_info.colormap=PrivateColormap;
602 if (LocaleCompare("shared",argv[i]) == 0)
603 resource_info.colormap=SharedColormap;
604 if (resource_info.colormap == UndefinedColormap)
605 ThrowAnimateException(OptionError,"UnrecognizedColormapType",
609 if (LocaleCompare("colors",option+1) == 0)
611 quantize_info->number_colors=0;
615 if (i == (ssize_t) argc)
616 ThrowAnimateException(OptionError,"MissingArgument",option);
617 if (IsGeometry(argv[i]) == MagickFalse)
618 ThrowAnimateInvalidArgumentException(option,argv[i]);
619 quantize_info->number_colors=StringToUnsignedLong(argv[i]);
622 if (LocaleCompare("colorspace",option+1) == 0)
630 if (i == (ssize_t) argc)
631 ThrowAnimateException(OptionError,"MissingArgument",option);
632 colorspace=ParseCommandOption(MagickColorspaceOptions,
633 MagickFalse,argv[i]);
635 ThrowAnimateException(OptionError,"UnrecognizedColorspace",
639 if (LocaleCompare("concurrent",option+1) == 0)
641 if (LocaleCompare("crop",option+1) == 0)
646 if (i == (ssize_t) argc)
647 ThrowAnimateException(OptionError,"MissingArgument",option);
648 if (IsGeometry(argv[i]) == MagickFalse)
649 ThrowAnimateInvalidArgumentException(option,argv[i]);
652 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
656 if (LocaleCompare("debug",option+1) == 0)
664 if (i == (ssize_t) argc)
665 ThrowAnimateException(OptionError,"MissingArgument",option);
666 event=ParseCommandOption(MagickLogEventOptions,MagickFalse,argv[i]);
668 ThrowAnimateException(OptionError,"UnrecognizedEventType",
670 (void) SetLogEventMask(argv[i]);
673 if (LocaleCompare("decipher",option+1) == 0)
678 if (i == (ssize_t) argc)
679 ThrowAnimateException(OptionError,"MissingArgument",option);
682 if (LocaleCompare("define",option+1) == 0)
685 if (i == (ssize_t) argc)
686 ThrowAnimateException(OptionError,"MissingArgument",option);
692 define=GetImageOption(image_info,argv[i]);
693 if (define == (const char *) NULL)
694 ThrowAnimateException(OptionError,"NoSuchOption",argv[i]);
699 if (LocaleCompare("delay",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("density",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("depth",option+1) == 0)
726 if (i == (ssize_t) argc)
727 ThrowAnimateException(OptionError,"MissingArgument",option);
728 if (IsGeometry(argv[i]) == MagickFalse)
729 ThrowAnimateInvalidArgumentException(option,argv[i]);
732 if (LocaleCompare("display",option+1) == 0)
737 if (i == (ssize_t) argc)
738 ThrowAnimateException(OptionError,"MissingArgument",option);
741 if (LocaleCompare("dispose",option+1) == 0)
749 if (i == (ssize_t) argc)
750 ThrowAnimateException(OptionError,"MissingArgument",option);
751 dispose=ParseCommandOption(MagickDisposeOptions,MagickFalse,argv[i]);
753 ThrowAnimateException(OptionError,"UnrecognizedDisposeMethod",
757 if (LocaleCompare("dither",option+1) == 0)
762 quantize_info->dither_method=NoDitherMethod;
766 if (i == (ssize_t) argc)
767 ThrowAnimateException(OptionError,"MissingArgument",option);
768 method=ParseCommandOption(MagickDitherOptions,MagickFalse,argv[i]);
770 ThrowAnimateException(OptionError,"UnrecognizedDitherMethod",
772 quantize_info->dither_method=(DitherMethod) method;
775 if (LocaleCompare("duration",option+1) == 0)
780 if (i == (ssize_t) argc)
781 ThrowAnimateException(OptionError,"MissingArgument",option);
782 if (IsGeometry(argv[i]) == MagickFalse)
783 ThrowAnimateInvalidArgumentException(option,argv[i]);
786 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
790 if (LocaleCompare("extract",option+1) == 0)
795 if (i == (ssize_t) argc)
796 ThrowAnimateException(OptionError,"MissingArgument",option);
797 if (IsGeometry(argv[i]) == MagickFalse)
798 ThrowAnimateInvalidArgumentException(option,argv[i]);
801 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
805 if (LocaleCompare("filter",option+1) == 0)
813 if (i == (ssize_t) argc)
814 ThrowAnimateException(OptionError,"MissingArgument",option);
815 filter=ParseCommandOption(MagickFilterOptions,MagickFalse,argv[i]);
817 ThrowAnimateException(OptionError,"UnrecognizedImageFilter",
821 if (LocaleCompare("flatten",option+1) == 0)
823 if (LocaleCompare("font",option+1) == 0)
828 if (i == (ssize_t) argc)
829 ThrowAnimateException(OptionError,"MissingArgument",option);
830 resource_info.font=XGetResourceClass(resource_database,
831 GetClientName(),"font",argv[i]);
834 if (LocaleCompare("foreground",option+1) == 0)
839 if (i == (ssize_t) argc)
840 ThrowAnimateException(OptionError,"MissingArgument",option);
841 resource_info.foreground_color=argv[i];
844 if (LocaleCompare("format",option+1) == 0)
849 if (i == (ssize_t) argc)
850 ThrowAnimateException(OptionError,"MissingArgument",option);
853 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
857 if (LocaleCompare("gamma",option+1) == 0)
860 if (i == (ssize_t) argc)
861 ThrowAnimateException(OptionError,"MissingArgument",option);
862 if (IsGeometry(argv[i]) == MagickFalse)
863 ThrowAnimateInvalidArgumentException(option,argv[i]);
866 if (LocaleCompare("geometry",option+1) == 0)
868 resource_info.image_geometry=(char *) NULL;
872 if (i == (ssize_t) argc)
873 ThrowAnimateException(OptionError,"MissingArgument",option);
874 if (IsGeometry(argv[i]) == MagickFalse)
875 ThrowAnimateInvalidArgumentException(option,argv[i]);
876 resource_info.image_geometry=ConstantString(argv[i]);
879 if (LocaleCompare("gravity",option+1) == 0)
887 if (i == (ssize_t) argc)
888 ThrowAnimateException(OptionError,"MissingArgument",option);
889 gravity=ParseCommandOption(MagickGravityOptions,MagickFalse,
892 ThrowAnimateException(OptionError,"UnrecognizedGravityType",
896 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
900 if ((LocaleCompare("help",option+1) == 0) ||
901 (LocaleCompare("-help",option+1) == 0))
903 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
907 if (LocaleCompare("iconGeometry",option+1) == 0)
909 resource_info.icon_geometry=(char *) NULL;
913 if (i == (ssize_t) argc)
914 ThrowAnimateException(OptionError,"MissingArgument",option);
915 if (IsGeometry(argv[i]) == MagickFalse)
916 ThrowAnimateInvalidArgumentException(option,argv[i]);
917 resource_info.icon_geometry=argv[i];
920 if (LocaleCompare("iconic",option+1) == 0)
922 resource_info.iconic=(*option == '-') ? MagickTrue : MagickFalse;
925 if (LocaleCompare("identify",option+1) == 0)
927 if (LocaleCompare("immutable",option+1) == 0)
929 resource_info.immutable=(*option == '-') ? MagickTrue : MagickFalse;
932 if (LocaleCompare("interlace",option+1) == 0)
940 if (i == (ssize_t) argc)
941 ThrowAnimateException(OptionError,"MissingArgument",option);
942 interlace=ParseCommandOption(MagickInterlaceOptions,MagickFalse,
945 ThrowAnimateException(OptionError,"UnrecognizedInterlaceType",
949 if (LocaleCompare("interpolate",option+1) == 0)
957 if (i == (ssize_t) argc)
958 ThrowAnimateException(OptionError,"MissingArgument",option);
959 interpolate=ParseCommandOption(MagickInterpolateOptions,MagickFalse,
962 ThrowAnimateException(OptionError,"UnrecognizedInterpolateMethod",
966 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
970 if (LocaleCompare("label",option+1) == 0)
975 if (i == (ssize_t) argc)
976 ThrowAnimateException(OptionError,"MissingArgument",option);
979 if (LocaleCompare("limit",option+1) == 0)
993 if (i == (ssize_t) argc)
994 ThrowAnimateException(OptionError,"MissingArgument",option);
995 resource=ParseCommandOption(MagickResourceOptions,MagickFalse,
998 ThrowAnimateException(OptionError,"UnrecognizedResourceType",
1001 if (i == (ssize_t) argc)
1002 ThrowAnimateException(OptionError,"MissingArgument",option);
1003 value=StringToDouble(argv[i],&p);
1005 if ((p == argv[i]) && (LocaleCompare("unlimited",argv[i]) != 0))
1006 ThrowAnimateInvalidArgumentException(option,argv[i]);
1009 if (LocaleCompare("list",option+1) == 0)
1017 if (i == (ssize_t) argc)
1018 ThrowAnimateException(OptionError,"MissingArgument",option);
1019 list=ParseCommandOption(MagickListOptions,MagickFalse,argv[i]);
1021 ThrowAnimateException(OptionError,"UnrecognizedListType",argv[i]);
1022 status=MogrifyImageInfo(image_info,(int) (i-j+1),(const char **)
1025 return(status == 0 ? MagickTrue : MagickFalse);
1027 if (LocaleCompare("log",option+1) == 0)
1032 if ((i == (ssize_t) argc) ||
1033 (strchr(argv[i],'%') == (char *) NULL))
1034 ThrowAnimateException(OptionError,"MissingArgument",option);
1037 if (LocaleCompare("loop",option+1) == 0)
1042 if (i == (ssize_t) argc)
1043 ThrowAnimateException(OptionError,"MissingArgument",option);
1044 if (IsGeometry(argv[i]) == MagickFalse)
1045 ThrowAnimateInvalidArgumentException(option,argv[i]);
1048 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1052 if (LocaleCompare("map",option+1) == 0)
1054 resource_info.map_type=(char *) NULL;
1057 (void) CopyMagickString(argv[i]+1,"san",MagickPathExtent);
1059 if (i == (ssize_t) argc)
1060 ThrowAnimateException(OptionError,"MissingArgument",option);
1061 resource_info.map_type=argv[i];
1064 if (LocaleCompare("matte",option+1) == 0)
1066 if (LocaleCompare("monitor",option+1) == 0)
1068 if (LocaleCompare("monochrome",option+1) == 0)
1072 quantize_info->number_colors=2;
1073 quantize_info->colorspace=GRAYColorspace;
1076 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1080 if (LocaleCompare("name",option+1) == 0)
1082 resource_info.name=(char *) NULL;
1086 if (i == (ssize_t) argc)
1087 ThrowAnimateException(OptionError,"MissingArgument",option);
1088 resource_info.name=ConstantString(argv[i]);
1091 if (LocaleCompare("noop",option+1) == 0)
1093 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1097 if (LocaleCompare("pause",option+1) == 0)
1099 resource_info.pause=0;
1103 if (i == (ssize_t) argc)
1104 ThrowAnimateException(OptionError,"MissingArgument",option);
1105 if (IsGeometry(argv[i]) == MagickFalse)
1106 ThrowAnimateInvalidArgumentException(option,argv[i]);
1107 resource_info.pause=(unsigned int) StringToUnsignedLong(argv[i]);
1110 if (LocaleCompare("page",option+1) == 0)
1115 if (i == (ssize_t) argc)
1116 ThrowAnimateException(OptionError,"MissingArgument",option);
1119 if (LocaleCompare("profile",option+1) == 0)
1122 if (i == (ssize_t) argc)
1123 ThrowAnimateException(OptionError,"MissingArgument",option);
1126 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1130 if (LocaleCompare("quantize",option+1) == 0)
1138 if (i == (ssize_t) argc)
1139 ThrowAnimateException(OptionError,"MissingArgument",option);
1140 colorspace=ParseCommandOption(MagickColorspaceOptions,
1141 MagickFalse,argv[i]);
1143 ThrowAnimateException(OptionError,"UnrecognizedColorspace",
1147 if (LocaleCompare("quiet",option+1) == 0)
1149 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1153 if (LocaleCompare("regard-warnings",option+1) == 0)
1155 if (LocaleCompare("remote",option+1) == 0)
1158 if (i == (ssize_t) argc)
1159 ThrowAnimateException(OptionError,"MissingArgument",option);
1160 if (XRemoteCommand(display,resource_info.window_id,argv[i]) != 0)
1161 return(MagickFalse);
1165 if (LocaleCompare("repage",option+1) == 0)
1170 if (i == (ssize_t) argc)
1171 ThrowAnimateException(OptionError,"MissingArgument",option);
1172 if (IsGeometry(argv[i]) == MagickFalse)
1173 ThrowAnimateInvalidArgumentException(option,argv[i]);
1176 if (LocaleCompare("resample",option+1) == 0)
1181 if (i == (ssize_t) argc)
1182 ThrowAnimateException(OptionError,"MissingArgument",option);
1183 if (IsGeometry(argv[i]) == MagickFalse)
1184 ThrowAnimateInvalidArgumentException(option,argv[i]);
1187 if (LocaleCompare("resize",option+1) == 0)
1192 if (i == (ssize_t) argc)
1193 ThrowAnimateException(OptionError,"MissingArgument",option);
1194 if (IsGeometry(argv[i]) == MagickFalse)
1195 ThrowAnimateInvalidArgumentException(option,argv[i]);
1198 if (LocaleNCompare("respect-parentheses",option+1,17) == 0)
1200 respect_parenthesis=(*option == '-') ? MagickTrue : MagickFalse;
1203 if (LocaleCompare("rotate",option+1) == 0)
1206 if (i == (ssize_t) argc)
1207 ThrowAnimateException(OptionError,"MissingArgument",option);
1208 if (IsGeometry(argv[i]) == MagickFalse)
1209 ThrowAnimateInvalidArgumentException(option,argv[i]);
1212 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1216 if (LocaleCompare("sampling-factor",option+1) == 0)
1221 if (i == (ssize_t) argc)
1222 ThrowAnimateException(OptionError,"MissingArgument",option);
1223 if (IsGeometry(argv[i]) == MagickFalse)
1224 ThrowAnimateInvalidArgumentException(option,argv[i]);
1227 if (LocaleCompare("seed",option+1) == 0)
1232 if (i == (ssize_t) argc)
1233 ThrowAnimateException(OptionError,"MissingArgument",option);
1234 if (IsGeometry(argv[i]) == MagickFalse)
1235 ThrowAnimateInvalidArgumentException(option,argv[i]);
1238 if (LocaleCompare("scenes",option+1) == 0) /* deprecated */
1243 if (i == (ssize_t) argc)
1244 ThrowAnimateException(OptionError,"MissingArgument",option);
1245 if (IsSceneGeometry(argv[i],MagickFalse) == MagickFalse)
1246 ThrowAnimateInvalidArgumentException(option,argv[i]);
1249 if (LocaleCompare("set",option+1) == 0)
1252 if (i == (ssize_t) argc)
1253 ThrowAnimateException(OptionError,"MissingArgument",option);
1257 if (i == (ssize_t) argc)
1258 ThrowAnimateException(OptionError,"MissingArgument",option);
1261 if (LocaleCompare("shared-memory",option+1) == 0)
1263 resource_info.use_shared_memory=(*option == '-') ? MagickTrue :
1267 if (LocaleCompare("size",option+1) == 0)
1272 if (i == (ssize_t) argc)
1273 ThrowAnimateException(OptionError,"MissingArgument",option);
1274 if (IsGeometry(argv[i]) == MagickFalse)
1275 ThrowAnimateInvalidArgumentException(option,argv[i]);
1278 if (LocaleCompare("strip",option+1) == 0)
1280 if (LocaleCompare("support",option+1) == 0)
1282 i++; /* deprecated */
1285 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1289 if (LocaleCompare("text-font",option+1) == 0)
1291 resource_info.text_font=(char *) NULL;
1295 if (i == (ssize_t) argc)
1296 ThrowAnimateException(OptionError,"MissingArgument",option);
1297 resource_info.text_font=XGetResourceClass(resource_database,
1298 GetClientName(),"font",argv[i]);
1301 if (LocaleCompare("thumbnail",option+1) == 0)
1306 if (i == (ssize_t) argc)
1307 ThrowAnimateException(OptionError,"MissingArgument",option);
1308 if (IsGeometry(argv[i]) == MagickFalse)
1309 ThrowAnimateInvalidArgumentException(option,argv[i]);
1312 if (LocaleCompare("title",option+1) == 0)
1314 resource_info.title=(char *) NULL;
1318 if (i == (ssize_t) argc)
1319 ThrowAnimateException(OptionError,"MissingArgument",option);
1320 resource_info.title=argv[i];
1323 if (LocaleCompare("transparent-color",option+1) == 0)
1328 if (i == (ssize_t) argc)
1329 ThrowAnimateException(OptionError,"MissingArgument",option);
1332 if (LocaleCompare("treedepth",option+1) == 0)
1334 quantize_info->tree_depth=0;
1338 if (i == (ssize_t) argc)
1339 ThrowAnimateException(OptionError,"MissingArgument",option);
1340 if (IsGeometry(argv[i]) == MagickFalse)
1341 ThrowAnimateInvalidArgumentException(option,argv[i]);
1342 quantize_info->tree_depth=StringToUnsignedLong(argv[i]);
1345 if (LocaleCompare("trim",option+1) == 0)
1347 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1351 if (LocaleCompare("verbose",option+1) == 0)
1353 if ((LocaleCompare("version",option+1) == 0) ||
1354 (LocaleCompare("-version",option+1) == 0))
1356 ListMagickVersion(stdout);
1359 if (LocaleCompare("virtual-pixel",option+1) == 0)
1367 if (i == (ssize_t) argc)
1368 ThrowAnimateException(OptionError,"MissingArgument",option);
1369 method=ParseCommandOption(MagickVirtualPixelOptions,MagickFalse,
1372 ThrowAnimateException(OptionError,
1373 "UnrecognizedVirtualPixelMethod",argv[i]);
1376 if (LocaleCompare("visual",option+1) == 0)
1378 resource_info.visual_type=(char *) NULL;
1382 if (i == (ssize_t) argc)
1383 ThrowAnimateException(OptionError,"MissingArgument",option);
1384 resource_info.visual_type=argv[i];
1387 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1391 if (LocaleCompare("window",option+1) == 0)
1393 resource_info.window_id=(char *) NULL;
1397 if (i == (ssize_t) argc)
1398 ThrowAnimateException(OptionError,"MissingArgument",option);
1399 resource_info.window_id=argv[i];
1402 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1407 ThrowAnimateException(OptionError,"UnrecognizedOption",option);
1409 fire=(GetCommandOptionFlags(MagickCommandOptions,MagickFalse,option) &
1410 FireOptionFlag) == 0 ? MagickFalse : MagickTrue;
1411 if (fire != MagickFalse)
1412 FireImageStack(MagickFalse,MagickTrue,MagickTrue);
1416 ThrowAnimateException(OptionError,"UnbalancedParenthesis",argv[i]);
1417 if (image == (Image *) NULL)
1418 ThrowAnimateException(OptionError,"MissingAnImageFilename",argv[argc-1])
1419 FinalizeImageSettings(image_info,image,MagickTrue);
1420 if (image == (Image *) NULL)
1421 ThrowAnimateException(OptionError,"MissingAnImageFilename",argv[argc-1])
1422 if (resource_info.window_id != (char *) NULL)
1424 XAnimateBackgroundImage(display,&resource_info,image,exception);
1433 Animate image to X server.
1435 animate_image=XAnimateImages(display,&resource_info,argv,argc,image,
1437 while (animate_image != (Image *) NULL)
1439 image=animate_image;
1440 animate_image=XAnimateImages(display,&resource_info,argv,argc,image,
1442 if (animate_image != image)
1443 image=DestroyImageList(image);
1447 return(status != 0 ? MagickTrue : MagickFalse);
1449 wand_unreferenced(argc);
1450 wand_unreferenced(argv);
1451 wand_unreferenced(metadata);
1452 (void) ThrowMagickException(exception,GetMagickModule(),MissingDelegateError,
1453 "DelegateLibrarySupportNotBuiltIn","'%s' (X11)",image_info->filename);
1454 return(AnimateUsage());