MagickWand  6.7.5
animate.c
Go to the documentation of this file.
00001 /*
00002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00003 %                                                                             %
00004 %                                                                             %
00005 %                                                                             %
00006 %                AAA   N   N  IIIII  M   M   AAA   TTTTT  EEEEE               %
00007 %               A   A  NN  N    I    MM MM  A   A    T    E                   %
00008 %               AAAAA  N N N    I    M M M  AAAAA    T    EEE                 %
00009 %               A   A  N  NN    I    M   M  A   A    T    E                   %
00010 %               A   A  N   N  IIIII  M   M  A   A    T    EEEEE               %
00011 %                                                                             %
00012 %                                                                             %
00013 %              Methods to Interactively Animate an Image Sequence             %
00014 %                                                                             %
00015 %                             Software Design                                 %
00016 %                               John Cristy                                   %
00017 %                                July 1992                                    %
00018 %                                                                             %
00019 %                                                                             %
00020 %  Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization      %
00021 %  dedicated to making software imaging solutions freely available.           %
00022 %                                                                             %
00023 %  You may not use this file except in compliance with the License.  You may  %
00024 %  obtain a copy of the License at                                            %
00025 %                                                                             %
00026 %    http://www.imagemagick.org/script/license.php                            %
00027 %                                                                             %
00028 %  Unless required by applicable law or agreed to in writing, software        %
00029 %  distributed under the License is distributed on an "AS IS" BASIS,          %
00030 %  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   %
00031 %  See the License for the specific language governing permissions and        %
00032 %  limitations under the License.                                             %
00033 %                                                                             %
00034 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00035 %
00036 %  Use the animate program to animate an image sequence on any X server.
00037 %
00038 */
00039 
00040 /*
00041   Include declarations.
00042 */
00043 #include "MagickWand/studio.h"
00044 #include "MagickWand/MagickWand.h"
00045 #include "MagickWand/mogrify-private.h"
00046 #include "MagickCore/animate-private.h"
00047 #include "MagickCore/nt-base-private.h"
00048 #include "MagickCore/string-private.h"
00049 #include "MagickCore/xwindow-private.h"
00050 
00051 /*
00052 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00053 %                                                                             %
00054 %                                                                             %
00055 %                                                                             %
00056 +   A n i m a t e I m a g e C o m m a n d                                     %
00057 %                                                                             %
00058 %                                                                             %
00059 %                                                                             %
00060 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
00061 %
00062 %  AnimateImageCommand() displays a sequence of images on any workstation
00063 %  display running an X server. Animate first determines the hardware
00064 %  capabilities of the workstation. If the number of unique colors in an image
00065 %  is less than or equal to the number the workstation can support, the image
00066 %  is displayed in an X window. Otherwise the number of colors in the image is
00067 %  first reduced to match the color resolution of the workstation before it is
00068 %  displayed.
00069 %
00070 %  This means that a continuous-tone 24 bits/pixel image can display on a 8
00071 %  bit pseudo-color device or monochrome device. In most instances the reduced
00072 %  color image closely resembles the original. Alternatively, a monochrome or
00073 %  pseudo-color image sequence can display on a continuous-tone 24 bits/pixels
00074 %  device.
00075 %
00076 %  The format of the AnimateImageCommand method is:
00077 %
00078 %      MagickBooleanType AnimateImageCommand(ImageInfo *image_info,int argc,
00079 %        char **argv,char **metadata,ExceptionInfo *exception)
00080 %
00081 %  A description of each parameter follows:
00082 %
00083 %    o image_info: the image info.
00084 %
00085 %    o argc: the number of elements in the argument vector.
00086 %
00087 %    o argv: A text array containing the command line arguments.
00088 %
00089 %    o metadata: any metadata is returned here.
00090 %
00091 %    o exception: return any errors or warnings in this structure.
00092 %
00093 */
00094 
00095 static MagickBooleanType AnimateUsage(void)
00096 {
00097   const char
00098     **p;
00099 
00100   static const char
00101     *buttons[]=
00102     {
00103       "Press any button to map or unmap the Command widget",
00104       (char *) NULL
00105     },
00106     *miscellaneous[]=
00107     {
00108       "-debug events        display copious debugging information",
00109       "-help                print program options",
00110       "-list type           print a list of supported option arguments",
00111       "-log format          format of debugging information",
00112       "-version             print version information",
00113       (char *) NULL
00114     },
00115     *operators[]=
00116     {
00117       "-colors value        preferred number of colors in the image",
00118       "-crop geometry       preferred size and location of the cropped image",
00119       "-extract geometry    extract area from image",
00120       "-monochrome          transform image to black and white",
00121       "-repage geometry     size and location of an image canvas (operator)",
00122       "-resample geometry   change the resolution of an image",
00123       "-resize geometry     resize the image",
00124       "-rotate degrees      apply Paeth rotation to the image",
00125       "-strip               strip image of all profiles and comments",
00126       "-thumbnail geometry  create a thumbnail of the image",
00127       "-trim                trim image edges",
00128       (char *) NULL
00129     },
00130     *settings[]=
00131     {
00132       "-alpha option        on, activate, off, deactivate, set, opaque, copy",
00133       "                     transparent, extract, background, or shape",
00134       "-authenticate password",
00135       "                     decipher image with this password",
00136       "-backdrop            display image centered on a backdrop",
00137       "-channel type        apply option to select image channels",
00138       "-colormap type       Shared or Private",
00139       "-colorspace type     alternate image colorspace",
00140       "-decipher filename   convert cipher pixels to plain pixels",
00141       "-define format:option",
00142       "                     define one or more image format options",
00143       "-delay value         display the next image after pausing",
00144       "-density geometry    horizontal and vertical density of the image",
00145       "-depth value         image depth",
00146       "-display server      display image to this X server",
00147       "-dispose method      layer disposal method",
00148       "-dither method       apply error diffusion to image",
00149       "-filter type         use this filter when resizing an image",
00150       "-format \"string\"     output formatted image characteristics",
00151       "-gamma value         level of gamma correction",
00152       "-geometry geometry   preferred size and location of the Image window",
00153       "-gravity type        horizontal and vertical backdrop placement",
00154       "-identify            identify the format and characteristics of the image",
00155       "-immutable           displayed image cannot be modified",
00156       "-interlace type      type of image interlacing scheme",
00157       "-interpolate method  pixel color interpolation method",
00158       "-limit type value    pixel cache resource limit",
00159       "-loop iterations     loop images then exit",
00160       "-map type            display image using this Standard Colormap",
00161       "-monitor             monitor progress",
00162       "-pause               seconds to pause before reanimating",
00163       "-page geometry       size and location of an image canvas (setting)",
00164       "-quantize colorspace reduce colors in this colorspace",
00165       "-quiet               suppress all warning messages",
00166       "-regard-warnings     pay attention to warning messages",
00167       "-remote command      execute a command in an remote display process",
00168       "-respect-parentheses settings remain in effect until parenthesis boundary",
00169       "-sampling-factor geometry",
00170       "                     horizontal and vertical sampling factor",
00171       "-seed value          seed a new sequence of pseudo-random numbers",
00172       "-set attribute value set an image attribute",
00173       "-size geometry       width and height of image",
00174       "-transparent-color color",
00175       "                     transparent color",
00176       "-treedepth value     color tree depth",
00177       "-verbose             print detailed information about the image",
00178       "-visual type         display image using this visual type",
00179       "-virtual-pixel method",
00180       "                     virtual pixel access method",
00181       "-window id           display image to background of this window",
00182       (char *) NULL
00183     },
00184     *sequence_operators[]=
00185     {
00186       "-coalesce            merge a sequence of images",
00187       "-flatten             flatten a sequence of images",
00188       (char *) NULL
00189     };
00190 
00191   (void) printf("Version: %s\n",GetMagickVersion((size_t *) NULL));
00192   (void) printf("Copyright: %s\n",GetMagickCopyright());
00193   (void) printf("Features: %s\n\n",GetMagickFeatures());
00194   (void) printf("Usage: %s [options ...] file [ [options ...] file ...]\n",
00195     GetClientName());
00196   (void) printf("\nImage Settings:\n");
00197   for (p=settings; *p != (char *) NULL; p++)
00198     (void) printf("  %s\n",*p);
00199   (void) printf("\nImage Operators:\n");
00200   for (p=operators; *p != (char *) NULL; p++)
00201     (void) printf("  %s\n",*p);
00202   (void) printf("\nImage Sequence Operators:\n");
00203   for (p=sequence_operators; *p != (char *) NULL; p++)
00204     (void) printf("  %s\n",*p);
00205   (void) printf("\nMiscellaneous Options:\n");
00206   for (p=miscellaneous; *p != (char *) NULL; p++)
00207     (void) printf("  %s\n",*p);
00208   (void) printf(
00209     "\nIn addition to those listed above, you can specify these standard X\n");
00210   (void) printf(
00211     "resources as command line options:  -background, -bordercolor,\n");
00212   (void) printf(
00213     "-borderwidth, -font, -foreground, -iconGeometry, -iconic, -name,\n");
00214   (void) printf("-mattecolor, -shared-memory, or -title.\n");
00215   (void) printf(
00216     "\nBy default, the image format of `file' is determined by its magic\n");
00217   (void) printf(
00218     "number.  To specify a particular image format, precede the filename\n");
00219   (void) printf(
00220     "with an image format name and a colon (i.e. ps:image) or specify the\n");
00221   (void) printf(
00222     "image type as the filename suffix (i.e. image.ps).  Specify 'file' as\n");
00223   (void) printf("'-' for standard input or output.\n");
00224   (void) printf("\nButtons: \n");
00225   for (p=buttons; *p != (char *) NULL; p++)
00226     (void) printf("  %s\n",*p);
00227   return(MagickFalse);
00228 }
00229 
00230 WandExport MagickBooleanType AnimateImageCommand(ImageInfo *image_info,
00231   int argc,char **argv,char **wand_unused(metadata),ExceptionInfo *exception)
00232 {
00233 #if defined(MAGICKCORE_X11_DELEGATE)
00234 #define DestroyAnimate() \
00235 { \
00236   XDestroyResourceInfo(&resource_info); \
00237   if (display != (Display *) NULL) \
00238     { \
00239       XCloseDisplay(display); \
00240       display=(Display *) NULL; \
00241     } \
00242   XDestroyResourceInfo(&resource_info); \
00243   DestroyImageStack(); \
00244   for (i=0; i < (ssize_t) argc; i++) \
00245     argv[i]=DestroyString(argv[i]); \
00246   argv=(char **) RelinquishMagickMemory(argv); \
00247 }
00248 #define ThrowAnimateException(asperity,tag,option) \
00249 { \
00250   (void) ThrowMagickException(exception,GetMagickModule(),asperity,tag,"`%s'", \
00251     option); \
00252   DestroyAnimate(); \
00253   return(MagickFalse); \
00254 }
00255 #define ThrowAnimateInvalidArgumentException(option,argument) \
00256 { \
00257   (void) ThrowMagickException(exception,GetMagickModule(),OptionError, \
00258     "InvalidArgument","`%s': %s",option,argument); \
00259   DestroyAnimate(); \
00260   return(MagickFalse); \
00261 }
00262 
00263   char
00264     *resource_value,
00265     *server_name;
00266 
00267   const char
00268     *option;
00269 
00270   Display
00271     *display;
00272 
00273   Image
00274     *image;
00275 
00276   ImageStack
00277     image_stack[MaxImageStackDepth+1];
00278 
00279   MagickBooleanType
00280     fire,
00281     pend,
00282     respect_parenthesis;
00283 
00284   MagickStatusType
00285     status;
00286 
00287   QuantizeInfo
00288     *quantize_info;
00289 
00290   register ssize_t
00291     i;
00292 
00293   ssize_t
00294     j,
00295     k;
00296 
00297   XResourceInfo
00298     resource_info;
00299 
00300   XrmDatabase
00301     resource_database;
00302 
00303   /*
00304     Set defaults.
00305   */
00306   assert(image_info != (ImageInfo *) NULL);
00307   assert(image_info->signature == MagickSignature);
00308   if (image_info->debug != MagickFalse)
00309     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
00310   assert(exception != (ExceptionInfo *) NULL);
00311   if (argc == 2)
00312     {
00313       option=argv[1];
00314       if ((LocaleCompare("version",option+1) == 0) ||
00315           (LocaleCompare("-version",option+1) == 0))
00316         {
00317           (void) FormatLocaleFile(stdout,"Version: %s\n",
00318             GetMagickVersion((size_t *) NULL));
00319           (void) FormatLocaleFile(stdout,"Copyright: %s\n",
00320             GetMagickCopyright());
00321           (void) FormatLocaleFile(stdout,"Features: %s\n\n",
00322             GetMagickFeatures());
00323           return(MagickFalse);
00324         }
00325     }
00326   status=MagickTrue;
00327   SetNotifyHandlers;
00328   display=(Display *) NULL;
00329   j=1;
00330   k=0;
00331   NewImageStack();
00332   option=(char *) NULL;
00333   pend=MagickFalse;
00334   respect_parenthesis=MagickFalse;
00335   resource_database=(XrmDatabase) NULL;
00336   (void) ResetMagickMemory(&resource_info,0,sizeof(XResourceInfo));
00337   server_name=(char *) NULL;
00338   status=MagickTrue;
00339   /*
00340     Check for server name specified on the command line.
00341   */
00342   ReadCommandlLine(argc,&argv);
00343   status=ExpandFilenames(&argc,&argv);
00344   if (status == MagickFalse)
00345     ThrowAnimateException(ResourceLimitError,"MemoryAllocationFailed",
00346       image_info->filename);
00347   for (i=1; i < (ssize_t) argc; i++)
00348   {
00349     /*
00350       Check command line for server name.
00351     */
00352     option=argv[i];
00353     if (LocaleCompare("display",option+1) == 0)
00354       {
00355         /*
00356           User specified server name.
00357         */
00358         i++;
00359         if (i == (ssize_t) argc)
00360           ThrowAnimateException(OptionError,"MissingArgument",option);
00361         server_name=argv[i];
00362       }
00363     if ((LocaleCompare("help",option+1) == 0) ||
00364         (LocaleCompare("-help",option+1) == 0))
00365       return(AnimateUsage());
00366   }
00367   /*
00368     Get user defaults from X resource database.
00369   */
00370   display=XOpenDisplay(server_name);
00371   if (display == (Display *) NULL)
00372     ThrowAnimateException(XServerError,"UnableToOpenXServer",
00373       XDisplayName(server_name));
00374   (void) XSetErrorHandler(XError);
00375   resource_database=XGetResourceDatabase(display,GetClientName());
00376   XGetResourceInfo(image_info,resource_database,GetClientName(),
00377     &resource_info);
00378   quantize_info=resource_info.quantize_info;
00379   image_info->density=XGetResourceInstance(resource_database,GetClientName(),
00380     "density",(char *) NULL);
00381   if (image_info->density == (char *) NULL)
00382     image_info->density=XGetScreenDensity(display);
00383   resource_value=XGetResourceInstance(resource_database,GetClientName(),
00384     "interlace","none");
00385   image_info->interlace=(InterlaceType)
00386     ParseCommandOption(MagickInterlaceOptions,MagickFalse,resource_value);
00387   resource_value=XGetResourceInstance(resource_database,GetClientName(),
00388     "verbose","False");
00389   image_info->verbose=IsMagickTrue(resource_value);
00390   resource_value=XGetResourceInstance(resource_database,GetClientName(),
00391     "dither","True");
00392   quantize_info->dither=IsMagickTrue(resource_value);
00393   /*
00394     Parse command line.
00395   */
00396   for (i=1; i <= (ssize_t) argc; i++)
00397   {
00398     if (i < (ssize_t) argc)
00399       option=argv[i];
00400     else
00401       if (image != (Image *) NULL)
00402         break;
00403       else
00404         if (isatty(STDIN_FILENO) != MagickFalse)
00405           option="logo:";
00406         else
00407           {
00408             int
00409               c;
00410 
00411             c=getc(stdin);
00412             if (c == EOF)
00413               option="logo:";
00414             else
00415               {
00416                 c=ungetc(c,stdin);
00417                 option="-";
00418               }
00419           }
00420     if (LocaleCompare(option,"(") == 0)
00421       {
00422         FireImageStack(MagickFalse,MagickTrue,pend);
00423         if (k == MaxImageStackDepth)
00424           ThrowAnimateException(OptionError,"ParenthesisNestedTooDeeply",
00425             option);
00426         PushImageStack();
00427         continue;
00428       }
00429     if (LocaleCompare(option,")") == 0)
00430       {
00431         FireImageStack(MagickFalse,MagickTrue,MagickTrue);
00432         if (k == 0)
00433           ThrowAnimateException(OptionError,"UnableToParseExpression",option);
00434         PopImageStack();
00435         continue;
00436       }
00437     if (IsCommandOption(option) == MagickFalse)
00438       {
00439         const char
00440           *filename;
00441 
00442         Image
00443           *images;
00444 
00445         /*
00446           Read input image.
00447         */
00448         FireImageStack(MagickFalse,MagickFalse,pend);
00449         filename=option;
00450         if ((LocaleCompare(filename,"--") == 0) && (i < (ssize_t) (argc-1)))
00451           {
00452             option=argv[++i];
00453             filename=option;
00454           }
00455         (void) CopyMagickString(image_info->filename,filename,MaxTextExtent);
00456         if (image_info->ping != MagickFalse)
00457           images=PingImages(image_info,exception);
00458         else
00459           images=ReadImages(image_info,exception);
00460         status&=(images != (Image *) NULL) &&
00461           (exception->severity < ErrorException);
00462         if (images == (Image *) NULL)
00463           continue;
00464         AppendImageStack(images);
00465         continue;
00466       }
00467     pend=image != (Image *) NULL ? MagickTrue : MagickFalse;
00468     switch (*(option+1))
00469     {
00470       case 'a':
00471       {
00472         if (LocaleCompare("alpha",option+1) == 0)
00473           {
00474             ssize_t
00475               type;
00476 
00477             if (*option == '+')
00478               break;
00479             i++;
00480             if (i == (ssize_t) argc)
00481               ThrowAnimateException(OptionError,"MissingArgument",option);
00482             type=ParseCommandOption(MagickAlphaOptions,MagickFalse,argv[i]);
00483             if (type < 0)
00484               ThrowAnimateException(OptionError,"UnrecognizedAlphaChannelType",
00485                 argv[i]);
00486             break;
00487           }
00488         if (LocaleCompare("authenticate",option+1) == 0)
00489           {
00490             if (*option == '+')
00491               break;
00492             i++;
00493             if (i == (ssize_t) argc)
00494               ThrowAnimateException(OptionError,"MissingArgument",option);
00495             break;
00496           }
00497         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
00498       }
00499       case 'b':
00500       {
00501         if (LocaleCompare("backdrop",option+1) == 0)
00502           {
00503             resource_info.backdrop=(*option == '-') ? MagickTrue : MagickFalse;
00504             break;
00505           }
00506         if (LocaleCompare("background",option+1) == 0)
00507           {
00508             if (*option == '+')
00509               break;
00510             i++;
00511             if (i == (ssize_t) argc)
00512               ThrowAnimateException(OptionError,"MissingArgument",option);
00513             resource_info.background_color=argv[i];
00514             break;
00515           }
00516         if (LocaleCompare("bordercolor",option+1) == 0)
00517           {
00518             if (*option == '+')
00519               break;
00520             i++;
00521             if (i == (ssize_t) argc)
00522               ThrowAnimateException(OptionError,"MissingArgument",option);
00523             resource_info.border_color=argv[i];
00524             break;
00525           }
00526         if (LocaleCompare("borderwidth",option+1) == 0)
00527           {
00528             resource_info.border_width=0;
00529             if (*option == '+')
00530               break;
00531             i++;
00532             if ((i == (ssize_t) argc) || (IsGeometry(argv[i]) == MagickFalse))
00533               ThrowAnimateException(OptionError,"MissingArgument",option);
00534             resource_info.border_width=(unsigned int)
00535               StringToUnsignedLong(argv[i]);
00536             break;
00537           }
00538         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
00539       }
00540       case 'c':
00541       {
00542         if (LocaleCompare("cache",option+1) == 0)
00543           {
00544             if (*option == '+')
00545               break;
00546             i++;
00547             if (i == (ssize_t) argc)
00548               ThrowAnimateException(OptionError,"MissingArgument",option);
00549             if (IsGeometry(argv[i]) == MagickFalse)
00550               ThrowAnimateInvalidArgumentException(option,argv[i]);
00551             break;
00552           }
00553         if (LocaleCompare("channel",option+1) == 0)
00554           {
00555             ssize_t
00556               channel;
00557 
00558             if (*option == '+')
00559               break;
00560             i++;
00561             if (i == (ssize_t) (argc-1))
00562               ThrowAnimateException(OptionError,"MissingArgument",option);
00563             channel=ParseChannelOption(argv[i]);
00564             if (channel < 0)
00565               ThrowAnimateException(OptionError,"UnrecognizedChannelType",
00566                 argv[i]);
00567             break;
00568           }
00569         if (LocaleCompare("clone",option+1) == 0)
00570           {
00571             Image
00572               *clone_images;
00573 
00574             clone_images=image;
00575             if (k != 0)
00576               clone_images=image_stack[k-1].image;
00577             if (clone_images == (Image *) NULL)
00578               ThrowAnimateException(ImageError,"ImageSequenceRequired",option);
00579             FireImageStack(MagickFalse,MagickTrue,MagickTrue);
00580             if (*option == '+')
00581               clone_images=CloneImages(clone_images,"-1",exception);
00582             else
00583               {
00584                 i++;
00585                 if (i == (ssize_t) (argc-1))
00586                   ThrowAnimateException(OptionError,"MissingArgument",option);
00587                 if (IsSceneGeometry(argv[i],MagickFalse) == MagickFalse)
00588                   ThrowAnimateInvalidArgumentException(option,argv[i]);
00589                 clone_images=CloneImages(clone_images,argv[i],exception);
00590               }
00591             if (clone_images == (Image *) NULL)
00592               ThrowAnimateException(OptionError,"NoSuchImage",option);
00593             AppendImageStack(clone_images);
00594             break;
00595           }
00596         if (LocaleCompare("coalesce",option+1) == 0)
00597           break;
00598         if (LocaleCompare("colormap",option+1) == 0)
00599           {
00600             resource_info.colormap=PrivateColormap;
00601             if (*option == '+')
00602               break;
00603             i++;
00604             if (i == (ssize_t) argc)
00605               ThrowAnimateException(OptionError,"MissingArgument",option);
00606             resource_info.colormap=UndefinedColormap;
00607             if (LocaleCompare("private",argv[i]) == 0)
00608               resource_info.colormap=PrivateColormap;
00609             if (LocaleCompare("shared",argv[i]) == 0)
00610               resource_info.colormap=SharedColormap;
00611             if (resource_info.colormap == UndefinedColormap)
00612               ThrowAnimateException(OptionError,"UnrecognizedColormapType",
00613                 argv[i]);
00614             break;
00615           }
00616         if (LocaleCompare("colors",option+1) == 0)
00617           {
00618             quantize_info->number_colors=0;
00619             if (*option == '+')
00620               break;
00621             i++;
00622             if (i == (ssize_t) argc)
00623               ThrowAnimateException(OptionError,"MissingArgument",option);
00624             if (IsGeometry(argv[i]) == MagickFalse)
00625               ThrowAnimateInvalidArgumentException(option,argv[i]);
00626             quantize_info->number_colors=StringToUnsignedLong(argv[i]);
00627             break;
00628           }
00629         if (LocaleCompare("colorspace",option+1) == 0)
00630           {
00631             ssize_t
00632               colorspace;
00633 
00634             if (*option == '+')
00635               break;
00636             i++;
00637             if (i == (ssize_t) argc)
00638               ThrowAnimateException(OptionError,"MissingArgument",option);
00639             colorspace=ParseCommandOption(MagickColorspaceOptions,
00640               MagickFalse,argv[i]);
00641             if (colorspace < 0)
00642               ThrowAnimateException(OptionError,"UnrecognizedColorspace",
00643                 argv[i]);
00644             break;
00645           }
00646         if (LocaleCompare("concurrent",option+1) == 0)
00647           break;
00648         if (LocaleCompare("crop",option+1) == 0)
00649           {
00650             if (*option == '+')
00651               break;
00652             i++;
00653             if (i == (ssize_t) argc)
00654               ThrowAnimateException(OptionError,"MissingArgument",option);
00655             if (IsGeometry(argv[i]) == MagickFalse)
00656               ThrowAnimateInvalidArgumentException(option,argv[i]);
00657             break;
00658           }
00659         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
00660       }
00661       case 'd':
00662       {
00663         if (LocaleCompare("debug",option+1) == 0)
00664           {
00665             ssize_t
00666               event;
00667 
00668             if (*option == '+')
00669               break;
00670             i++;
00671             if (i == (ssize_t) argc)
00672               ThrowAnimateException(OptionError,"MissingArgument",option);
00673             event=ParseCommandOption(MagickLogEventOptions,MagickFalse,argv[i]);
00674             if (event < 0)
00675               ThrowAnimateException(OptionError,"UnrecognizedEventType",
00676                 argv[i]);
00677             (void) SetLogEventMask(argv[i]);
00678             break;
00679           }
00680         if (LocaleCompare("decipher",option+1) == 0)
00681           {
00682             if (*option == '+')
00683               break;
00684             i++;
00685             if (i == (ssize_t) (argc-1))
00686               ThrowAnimateException(OptionError,"MissingArgument",option);
00687             break;
00688           }
00689         if (LocaleCompare("define",option+1) == 0)
00690           {
00691             i++;
00692             if (i == (ssize_t) argc)
00693               ThrowAnimateException(OptionError,"MissingArgument",option);
00694             if (*option == '+')
00695               {
00696                 const char
00697                   *define;
00698 
00699                 define=GetImageOption(image_info,argv[i]);
00700                 if (define == (const char *) NULL)
00701                   ThrowAnimateException(OptionError,"NoSuchOption",argv[i]);
00702                 break;
00703               }
00704             break;
00705           }
00706         if (LocaleCompare("delay",option+1) == 0)
00707           {
00708             if (*option == '+')
00709               break;
00710             i++;
00711             if (i == (ssize_t) argc)
00712               ThrowAnimateException(OptionError,"MissingArgument",option);
00713             if (IsGeometry(argv[i]) == MagickFalse)
00714               ThrowAnimateInvalidArgumentException(option,argv[i]);
00715             break;
00716           }
00717         if (LocaleCompare("density",option+1) == 0)
00718           {
00719             if (*option == '+')
00720               break;
00721             i++;
00722             if (i == (ssize_t) argc)
00723               ThrowAnimateException(OptionError,"MissingArgument",option);
00724             if (IsGeometry(argv[i]) == MagickFalse)
00725               ThrowAnimateInvalidArgumentException(option,argv[i]);
00726             break;
00727           }
00728         if (LocaleCompare("depth",option+1) == 0)
00729           {
00730             if (*option == '+')
00731               break;
00732             i++;
00733             if (i == (ssize_t) argc)
00734               ThrowAnimateException(OptionError,"MissingArgument",option);
00735             if (IsGeometry(argv[i]) == MagickFalse)
00736               ThrowAnimateInvalidArgumentException(option,argv[i]);
00737             break;
00738           }
00739         if (LocaleCompare("display",option+1) == 0)
00740           {
00741             if (*option == '+')
00742               break;
00743             i++;
00744             if (i == (ssize_t) argc)
00745               ThrowAnimateException(OptionError,"MissingArgument",option);
00746             break;
00747           }
00748         if (LocaleCompare("dispose",option+1) == 0)
00749           {
00750             ssize_t
00751               dispose;
00752 
00753             if (*option == '+')
00754               break;
00755             i++;
00756             if (i == (ssize_t) argc)
00757               ThrowAnimateException(OptionError,"MissingArgument",option);
00758             dispose=ParseCommandOption(MagickDisposeOptions,MagickFalse,argv[i]);
00759             if (dispose < 0)
00760               ThrowAnimateException(OptionError,"UnrecognizedDisposeMethod",
00761                 argv[i]);
00762             break;
00763           }
00764         if (LocaleCompare("dither",option+1) == 0)
00765           {
00766             ssize_t
00767               method;
00768 
00769             quantize_info->dither=MagickFalse;
00770             if (*option == '+')
00771               break;
00772             i++;
00773             if (i == (ssize_t) argc)
00774               ThrowAnimateException(OptionError,"MissingArgument",option);
00775             method=ParseCommandOption(MagickDitherOptions,MagickFalse,argv[i]);
00776             if (method < 0)
00777               ThrowAnimateException(OptionError,"UnrecognizedDitherMethod",
00778                 argv[i]);
00779             quantize_info->dither=MagickTrue;
00780             quantize_info->dither_method=(DitherMethod) method;
00781             break;
00782           }
00783         if (LocaleCompare("duration",option+1) == 0)
00784           {
00785             if (*option == '+')
00786               break;
00787             i++;
00788             if (i == (ssize_t) (argc-1))
00789               ThrowAnimateException(OptionError,"MissingArgument",option);
00790             if (IsGeometry(argv[i]) == MagickFalse)
00791               ThrowAnimateInvalidArgumentException(option,argv[i]);
00792             break;
00793           }
00794         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
00795       }
00796       case 'e':
00797       {
00798         if (LocaleCompare("extract",option+1) == 0)
00799           {
00800             if (*option == '+')
00801               break;
00802             i++;
00803             if (i == (ssize_t) argc)
00804               ThrowAnimateException(OptionError,"MissingArgument",option);
00805             if (IsGeometry(argv[i]) == MagickFalse)
00806               ThrowAnimateInvalidArgumentException(option,argv[i]);
00807             break;
00808           }
00809         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
00810       }
00811       case 'f':
00812       {
00813         if (LocaleCompare("filter",option+1) == 0)
00814           {
00815             ssize_t
00816               filter;
00817 
00818             if (*option == '+')
00819               break;
00820             i++;
00821             if (i == (ssize_t) (argc-1))
00822               ThrowAnimateException(OptionError,"MissingArgument",option);
00823             filter=ParseCommandOption(MagickFilterOptions,MagickFalse,argv[i]);
00824             if (filter < 0)
00825               ThrowAnimateException(OptionError,"UnrecognizedImageFilter",
00826                 argv[i]);
00827             break;
00828           }
00829         if (LocaleCompare("flatten",option+1) == 0)
00830           break;
00831         if (LocaleCompare("font",option+1) == 0)
00832           {
00833             if (*option == '+')
00834               break;
00835             i++;
00836             if (i == (ssize_t) argc)
00837               ThrowAnimateException(OptionError,"MissingArgument",option);
00838             resource_info.font=XGetResourceClass(resource_database,
00839               GetClientName(),"font",argv[i]);
00840             break;
00841           }
00842         if (LocaleCompare("foreground",option+1) == 0)
00843           {
00844             if (*option == '+')
00845               break;
00846             i++;
00847             if (i == (ssize_t) argc)
00848               ThrowAnimateException(OptionError,"MissingArgument",option);
00849             resource_info.foreground_color=argv[i];
00850             break;
00851           }
00852         if (LocaleCompare("format",option+1) == 0)
00853           {
00854             if (*option == '+')
00855               break;
00856             i++;
00857             if (i == (ssize_t) (argc-1))
00858               ThrowAnimateException(OptionError,"MissingArgument",option);
00859             break;
00860           }
00861         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
00862       }
00863       case 'g':
00864       {
00865         if (LocaleCompare("gamma",option+1) == 0)
00866           {
00867             i++;
00868             if (i == (ssize_t) argc)
00869               ThrowAnimateException(OptionError,"MissingArgument",option);
00870             if (IsGeometry(argv[i]) == MagickFalse)
00871               ThrowAnimateInvalidArgumentException(option,argv[i]);
00872             break;
00873           }
00874         if (LocaleCompare("geometry",option+1) == 0)
00875           {
00876             resource_info.image_geometry=(char *) NULL;
00877             if (*option == '+')
00878               break;
00879             i++;
00880             if (i == (ssize_t) argc)
00881               ThrowAnimateException(OptionError,"MissingArgument",option);
00882             if (IsGeometry(argv[i]) == MagickFalse)
00883               ThrowAnimateInvalidArgumentException(option,argv[i]);
00884             resource_info.image_geometry=ConstantString(argv[i]);
00885             break;
00886           }
00887         if (LocaleCompare("gravity",option+1) == 0)
00888           {
00889             ssize_t
00890               gravity;
00891 
00892             if (*option == '+')
00893               break;
00894             i++;
00895             if (i == (ssize_t) (argc-1))
00896               ThrowAnimateException(OptionError,"MissingArgument",option);
00897             gravity=ParseCommandOption(MagickGravityOptions,MagickFalse,
00898               argv[i]);
00899             if (gravity < 0)
00900               ThrowAnimateException(OptionError,"UnrecognizedGravityType",
00901                 argv[i]);
00902             break;
00903           }
00904         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
00905       }
00906       case 'h':
00907       {
00908         if ((LocaleCompare("help",option+1) == 0) ||
00909             (LocaleCompare("-help",option+1) == 0))
00910           break;
00911         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
00912       }
00913       case 'i':
00914       {
00915         if (LocaleCompare("iconGeometry",option+1) == 0)
00916           {
00917             resource_info.icon_geometry=(char *) NULL;
00918             if (*option == '+')
00919               break;
00920             i++;
00921             if (i == (ssize_t) argc)
00922               ThrowAnimateException(OptionError,"MissingArgument",option);
00923             if (IsGeometry(argv[i]) == MagickFalse)
00924               ThrowAnimateInvalidArgumentException(option,argv[i]);
00925             resource_info.icon_geometry=argv[i];
00926             break;
00927           }
00928         if (LocaleCompare("iconic",option+1) == 0)
00929           {
00930             resource_info.iconic=(*option == '-') ? MagickTrue : MagickFalse;
00931             break;
00932           }
00933         if (LocaleCompare("identify",option+1) == 0)
00934           break;
00935         if (LocaleCompare("immutable",option+1) == 0)
00936           {
00937             resource_info.immutable=(*option == '-') ? MagickTrue : MagickFalse;
00938             break;
00939           }
00940         if (LocaleCompare("interlace",option+1) == 0)
00941           {
00942             ssize_t
00943               interlace;
00944 
00945             if (*option == '+')
00946               break;
00947             i++;
00948             if (i == (ssize_t) argc)
00949               ThrowAnimateException(OptionError,"MissingArgument",option);
00950             interlace=ParseCommandOption(MagickInterlaceOptions,MagickFalse,
00951               argv[i]);
00952             if (interlace < 0)
00953               ThrowAnimateException(OptionError,"UnrecognizedInterlaceType",
00954                 argv[i]);
00955             break;
00956           }
00957         if (LocaleCompare("interpolate",option+1) == 0)
00958           {
00959             ssize_t
00960               interpolate;
00961 
00962             if (*option == '+')
00963               break;
00964             i++;
00965             if (i == (ssize_t) argc)
00966               ThrowAnimateException(OptionError,"MissingArgument",option);
00967             interpolate=ParseCommandOption(MagickInterpolateOptions,MagickFalse,
00968               argv[i]);
00969             if (interpolate < 0)
00970               ThrowAnimateException(OptionError,"UnrecognizedInterpolateMethod",
00971                 argv[i]);
00972             break;
00973           }
00974         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
00975       }
00976       case 'l':
00977       {
00978         if (LocaleCompare("label",option+1) == 0)
00979           {
00980             if (*option == '+')
00981               break;
00982             i++;
00983             if (i == (ssize_t) argc)
00984               ThrowAnimateException(OptionError,"MissingArgument",option);
00985             break;
00986           }
00987         if (LocaleCompare("limit",option+1) == 0)
00988           {
00989             char
00990               *p;
00991 
00992             double
00993               value;
00994 
00995             ssize_t
00996               resource;
00997 
00998             if (*option == '+')
00999               break;
01000             i++;
01001             if (i == (ssize_t) argc)
01002               ThrowAnimateException(OptionError,"MissingArgument",option);
01003             resource=ParseCommandOption(MagickResourceOptions,MagickFalse,
01004               argv[i]);
01005             if (resource < 0)
01006               ThrowAnimateException(OptionError,"UnrecognizedResourceType",
01007                 argv[i]);
01008             i++;
01009             if (i == (ssize_t) argc)
01010               ThrowAnimateException(OptionError,"MissingArgument",option);
01011             value=StringToDouble(argv[i],&p);
01012             (void) value;
01013             if ((p == argv[i]) && (LocaleCompare("unlimited",argv[i]) != 0))
01014               ThrowAnimateInvalidArgumentException(option,argv[i]);
01015             break;
01016           }
01017         if (LocaleCompare("list",option+1) == 0)
01018           {
01019             ssize_t
01020               list;
01021 
01022             if (*option == '+')
01023               break;
01024             i++;
01025             if (i == (ssize_t) argc)
01026               ThrowAnimateException(OptionError,"MissingArgument",option);
01027             list=ParseCommandOption(MagickListOptions,MagickFalse,argv[i]);
01028             if (list < 0)
01029               ThrowAnimateException(OptionError,"UnrecognizedListType",argv[i]);
01030             status=MogrifyImageInfo(image_info,(int) (i-j+1),(const char **)
01031               argv+j,exception);
01032             DestroyAnimate();
01033             return(status != 0 ? MagickFalse : MagickTrue);
01034           }
01035         if (LocaleCompare("log",option+1) == 0)
01036           {
01037             if (*option == '+')
01038               break;
01039             i++;
01040             if ((i == (ssize_t) argc) ||
01041                 (strchr(argv[i],'%') == (char *) NULL))
01042               ThrowAnimateException(OptionError,"MissingArgument",option);
01043             break;
01044           }
01045         if (LocaleCompare("loop",option+1) == 0)
01046           {
01047             if (*option == '+')
01048               break;
01049             i++;
01050             if (i == (ssize_t) (argc-1))
01051               ThrowAnimateException(OptionError,"MissingArgument",option);
01052             if (IsGeometry(argv[i]) == MagickFalse)
01053               ThrowAnimateInvalidArgumentException(option,argv[i]);
01054             break;
01055           }
01056         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
01057       }
01058       case 'm':
01059       {
01060         if (LocaleCompare("map",option+1) == 0)
01061           {
01062             resource_info.map_type=(char *) NULL;
01063             if (*option == '+')
01064               break;
01065             (void) CopyMagickString(argv[i]+1,"san",MaxTextExtent);
01066             i++;
01067             if (i == (ssize_t) argc)
01068               ThrowAnimateException(OptionError,"MissingArgument",option);
01069             resource_info.map_type=argv[i];
01070             break;
01071           }
01072         if (LocaleCompare("matte",option+1) == 0)
01073           break;
01074         if (LocaleCompare("mattecolor",option+1) == 0)
01075           {
01076             if (*option == '+')
01077               break;
01078             i++;
01079             if (i == (ssize_t) argc)
01080               ThrowAnimateException(OptionError,"MissingArgument",option);
01081             resource_info.matte_color=argv[i];
01082             break;
01083           }
01084         if (LocaleCompare("monitor",option+1) == 0)
01085           break;
01086         if (LocaleCompare("monochrome",option+1) == 0)
01087           {
01088             if (*option == '+')
01089               break;
01090             quantize_info->number_colors=2;
01091             quantize_info->colorspace=GRAYColorspace;
01092             break;
01093           }
01094         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
01095       }
01096       case 'n':
01097       {
01098         if (LocaleCompare("name",option+1) == 0)
01099           {
01100             resource_info.name=(char *) NULL;
01101             if (*option == '+')
01102               break;
01103             i++;
01104             if (i == (ssize_t) argc)
01105               ThrowAnimateException(OptionError,"MissingArgument",option);
01106             resource_info.name=ConstantString(argv[i]);
01107             break;
01108           }
01109         if (LocaleCompare("noop",option+1) == 0)
01110           break;
01111         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
01112       }
01113       case 'p':
01114       {
01115         if (LocaleCompare("pause",option+1) == 0)
01116           {
01117             resource_info.pause=0;
01118             if (*option == '+')
01119               break;
01120             i++;
01121             if (i == (ssize_t) argc)
01122               ThrowAnimateException(OptionError,"MissingArgument",option);
01123             if (IsGeometry(argv[i]) == MagickFalse)
01124               ThrowAnimateInvalidArgumentException(option,argv[i]);
01125             resource_info.pause=(unsigned int) StringToUnsignedLong(argv[i]);
01126             break;
01127           }
01128         if (LocaleCompare("page",option+1) == 0)
01129           {
01130             if (*option == '+')
01131               break;
01132             i++;
01133             if (i == (ssize_t) argc)
01134               ThrowAnimateException(OptionError,"MissingArgument",option);
01135             break;
01136           }
01137         if (LocaleCompare("profile",option+1) == 0)
01138           {
01139             i++;
01140             if (i == (ssize_t) argc)
01141               ThrowAnimateException(OptionError,"MissingArgument",option);
01142             break;
01143           }
01144         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
01145       }
01146       case 'q':
01147       {
01148         if (LocaleCompare("quantize",option+1) == 0)
01149           {
01150             ssize_t
01151               colorspace;
01152 
01153             if (*option == '+')
01154               break;
01155             i++;
01156             if (i == (ssize_t) (argc-1))
01157               ThrowAnimateException(OptionError,"MissingArgument",option);
01158             colorspace=ParseCommandOption(MagickColorspaceOptions,
01159               MagickFalse,argv[i]);
01160             if (colorspace < 0)
01161               ThrowAnimateException(OptionError,"UnrecognizedColorspace",
01162                 argv[i]);
01163             break;
01164           }
01165         if (LocaleCompare("quiet",option+1) == 0)
01166           break;
01167         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
01168       }
01169       case 'r':
01170       {
01171         if (LocaleCompare("regard-warnings",option+1) == 0)
01172           break;
01173         if (LocaleCompare("remote",option+1) == 0)
01174           {
01175             i++;
01176             if (i == (ssize_t) argc)
01177               ThrowAnimateException(OptionError,"MissingArgument",option);
01178             if (XRemoteCommand(display,resource_info.window_id,argv[i]) != 0)
01179               return(MagickFalse);
01180             i--;
01181             break;
01182           }
01183         if (LocaleCompare("repage",option+1) == 0)
01184           {
01185             if (*option == '+')
01186               break;
01187             i++;
01188             if (i == (ssize_t) argc)
01189               ThrowAnimateException(OptionError,"MissingArgument",option);
01190             if (IsGeometry(argv[i]) == MagickFalse)
01191               ThrowAnimateInvalidArgumentException(option,argv[i]);
01192             break;
01193           }
01194         if (LocaleCompare("resample",option+1) == 0)
01195           {
01196             if (*option == '+')
01197               break;
01198             i++;
01199             if (i == (ssize_t) (argc-1))
01200               ThrowAnimateException(OptionError,"MissingArgument",option);
01201             if (IsGeometry(argv[i]) == MagickFalse)
01202               ThrowAnimateInvalidArgumentException(option,argv[i]);
01203             break;
01204           }
01205         if (LocaleCompare("resize",option+1) == 0)
01206           {
01207             if (*option == '+')
01208               break;
01209             i++;
01210             if (i == (ssize_t) argc)
01211               ThrowAnimateException(OptionError,"MissingArgument",option);
01212             if (IsGeometry(argv[i]) == MagickFalse)
01213               ThrowAnimateInvalidArgumentException(option,argv[i]);
01214             break;
01215           }
01216         if (LocaleNCompare("respect-parentheses",option+1,17) == 0)
01217           {
01218             respect_parenthesis=(*option == '-') ? MagickTrue : MagickFalse;
01219             break;
01220           }
01221         if (LocaleCompare("rotate",option+1) == 0)
01222           {
01223             i++;
01224             if (i == (ssize_t) argc)
01225               ThrowAnimateException(OptionError,"MissingArgument",option);
01226             if (IsGeometry(argv[i]) == MagickFalse)
01227               ThrowAnimateInvalidArgumentException(option,argv[i]);
01228             break;
01229           }
01230         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
01231       }
01232       case 's':
01233       {
01234         if (LocaleCompare("sampling-factor",option+1) == 0)
01235           {
01236             if (*option == '+')
01237               break;
01238             i++;
01239             if (i == (ssize_t) argc)
01240               ThrowAnimateException(OptionError,"MissingArgument",option);
01241             if (IsGeometry(argv[i]) == MagickFalse)
01242               ThrowAnimateInvalidArgumentException(option,argv[i]);
01243             break;
01244           }
01245         if (LocaleCompare("seed",option+1) == 0)
01246           {
01247             if (*option == '+')
01248               break;
01249             i++;
01250             if (i == (ssize_t) (argc-1))
01251               ThrowAnimateException(OptionError,"MissingArgument",option);
01252             if (IsGeometry(argv[i]) == MagickFalse)
01253               ThrowAnimateInvalidArgumentException(option,argv[i]);
01254             break;
01255           }
01256         if (LocaleCompare("scenes",option+1) == 0)  /* deprecated */
01257           {
01258             if (*option == '+')
01259               break;
01260             i++;
01261             if (i == (ssize_t) argc)
01262               ThrowAnimateException(OptionError,"MissingArgument",option);
01263             if (IsSceneGeometry(argv[i],MagickFalse) == MagickFalse)
01264               ThrowAnimateInvalidArgumentException(option,argv[i]);
01265             break;
01266           }
01267         if (LocaleCompare("set",option+1) == 0)
01268           {
01269             i++;
01270             if (i == (ssize_t) argc)
01271               ThrowAnimateException(OptionError,"MissingArgument",option);
01272             if (*option == '+')
01273               break;
01274             i++;
01275             if (i == (ssize_t) argc)
01276               ThrowAnimateException(OptionError,"MissingArgument",option);
01277             break;
01278           }
01279         if (LocaleCompare("shared-memory",option+1) == 0)
01280           {
01281             resource_info.use_shared_memory=(*option == '-') ? MagickTrue :
01282               MagickFalse;
01283             break;
01284           }
01285         if (LocaleCompare("size",option+1) == 0)
01286           {
01287             if (*option == '+')
01288               break;
01289             i++;
01290             if (i == (ssize_t) argc)
01291               ThrowAnimateException(OptionError,"MissingArgument",option);
01292             if (IsGeometry(argv[i]) == MagickFalse)
01293               ThrowAnimateInvalidArgumentException(option,argv[i]);
01294             break;
01295           }
01296         if (LocaleCompare("strip",option+1) == 0)
01297           break;
01298         if (LocaleCompare("support",option+1) == 0)
01299           {
01300             i++;  /* deprecated */
01301             break;
01302           }
01303         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
01304       }
01305       case 't':
01306       {
01307         if (LocaleCompare("text-font",option+1) == 0)
01308           {
01309             resource_info.text_font=(char *) NULL;
01310             if (*option == '+')
01311               break;
01312             i++;
01313             if (i == (ssize_t) argc)
01314               ThrowAnimateException(OptionError,"MissingArgument",option);
01315             resource_info.text_font=XGetResourceClass(resource_database,
01316               GetClientName(),"font",argv[i]);
01317             break;
01318           }
01319         if (LocaleCompare("thumbnail",option+1) == 0)
01320           {
01321             if (*option == '+')
01322               break;
01323             i++;
01324             if (i == (ssize_t) argc)
01325               ThrowAnimateException(OptionError,"MissingArgument",option);
01326             if (IsGeometry(argv[i]) == MagickFalse)
01327               ThrowAnimateInvalidArgumentException(option,argv[i]);
01328             break;
01329           }
01330         if (LocaleCompare("title",option+1) == 0)
01331           {
01332             resource_info.title=(char *) NULL;
01333             if (*option == '+')
01334               break;
01335             i++;
01336             if (i == (ssize_t) argc)
01337               ThrowAnimateException(OptionError,"MissingArgument",option);
01338             resource_info.title=argv[i];
01339             break;
01340           }
01341         if (LocaleCompare("transparent-color",option+1) == 0)
01342           {
01343             if (*option == '+')
01344               break;
01345             i++;
01346             if (i == (ssize_t) (argc-1))
01347               ThrowAnimateException(OptionError,"MissingArgument",option);
01348             break;
01349           }
01350         if (LocaleCompare("treedepth",option+1) == 0)
01351           {
01352             quantize_info->tree_depth=0;
01353             if (*option == '+')
01354               break;
01355             i++;
01356             if (i == (ssize_t) argc)
01357               ThrowAnimateException(OptionError,"MissingArgument",option);
01358             if (IsGeometry(argv[i]) == MagickFalse)
01359               ThrowAnimateInvalidArgumentException(option,argv[i]);
01360             quantize_info->tree_depth=StringToUnsignedLong(argv[i]);
01361             break;
01362           }
01363         if (LocaleCompare("trim",option+1) == 0)
01364           break;
01365         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
01366       }
01367       case 'v':
01368       {
01369         if (LocaleCompare("verbose",option+1) == 0)
01370           break;
01371         if ((LocaleCompare("version",option+1) == 0) ||
01372             (LocaleCompare("-version",option+1) == 0))
01373           {
01374             (void) FormatLocaleFile(stdout,"Version: %s\n",
01375               GetMagickVersion((size_t *) NULL));
01376             (void) FormatLocaleFile(stdout,"Copyright: %s\n",
01377               GetMagickCopyright());
01378             (void) FormatLocaleFile(stdout,"Features: %s\n\n",
01379               GetMagickFeatures());
01380             break;
01381           }
01382         if (LocaleCompare("virtual-pixel",option+1) == 0)
01383           {
01384             ssize_t
01385               method;
01386 
01387             if (*option == '+')
01388               break;
01389             i++;
01390             if (i == (ssize_t) argc)
01391               ThrowAnimateException(OptionError,"MissingArgument",option);
01392             method=ParseCommandOption(MagickVirtualPixelOptions,MagickFalse,
01393               argv[i]);
01394             if (method < 0)
01395               ThrowAnimateException(OptionError,
01396                 "UnrecognizedVirtualPixelMethod",argv[i]);
01397             break;
01398           }
01399         if (LocaleCompare("visual",option+1) == 0)
01400           {
01401             resource_info.visual_type=(char *) NULL;
01402             if (*option == '+')
01403               break;
01404             i++;
01405             if (i == (ssize_t) argc)
01406               ThrowAnimateException(OptionError,"MissingArgument",option);
01407             resource_info.visual_type=argv[i];
01408             break;
01409           }
01410         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
01411       }
01412       case 'w':
01413       {
01414         if (LocaleCompare("window",option+1) == 0)
01415           {
01416             resource_info.window_id=(char *) NULL;
01417             if (*option == '+')
01418               break;
01419             i++;
01420             if (i == (ssize_t) argc)
01421               ThrowAnimateException(OptionError,"MissingArgument",option);
01422             resource_info.window_id=argv[i];
01423             break;
01424           }
01425         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
01426       }
01427       case '?':
01428         break;
01429       default:
01430         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
01431     }
01432     fire=(GetCommandOptionFlags(MagickCommandOptions,MagickFalse,option) &
01433       FireOptionFlag) == 0 ?  MagickFalse : MagickTrue;
01434     if (fire != MagickFalse)
01435       FireImageStack(MagickFalse,MagickTrue,MagickTrue);
01436   }
01437   i--;
01438   if (k != 0)
01439     ThrowAnimateException(OptionError,"UnbalancedParenthesis",argv[i]);
01440   if (image == (Image *) NULL)
01441     ThrowAnimateException(OptionError,"MissingAnImageFilename",argv[argc-1])
01442   FinalizeImageSettings(image_info,image,MagickTrue);
01443   if (image == (Image *) NULL)
01444     ThrowAnimateException(OptionError,"MissingAnImageFilename",argv[argc-1])
01445   if (resource_info.window_id != (char *) NULL)
01446     {
01447       XAnimateBackgroundImage(display,&resource_info,image,exception);
01448       status&=MagickTrue;
01449     }
01450   else
01451     {
01452       Image
01453         *animate_image;
01454 
01455       /*
01456         Animate image to X server.
01457       */
01458       animate_image=XAnimateImages(display,&resource_info,argv,argc,image,
01459         exception);
01460       status&=animate_image != (Image *) NULL;
01461       while (animate_image != (Image *) NULL)
01462       {
01463         image=animate_image;
01464         animate_image=XAnimateImages(display,&resource_info,argv,argc,image,
01465           exception);
01466         if (animate_image != image)
01467           image=DestroyImageList(image);
01468       }
01469     }
01470   DestroyAnimate();
01471   return(status != 0 ? MagickTrue : MagickFalse);
01472 #else
01473   (void) argc;
01474   (void) argv;
01475   (void) ThrowMagickException(exception,GetMagickModule(),MissingDelegateError,
01476     "DelegateLibrarySupportNotBuiltIn","`%s' (X11)",image_info->filename);
01477   return(AnimateUsage());
01478 #endif
01479 }