Home | History | Annotate | Download | only in MagickWand
      1 /*
      2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      3 %                                                                             %
      4 %                                                                             %
      5 %                                                                             %
      6 %                AAA   N   N  IIIII  M   M   AAA   TTTTT  EEEEE               %
      7 %               A   A  NN  N    I    MM MM  A   A    T    E                   %
      8 %               AAAAA  N N N    I    M M M  AAAAA    T    EEE                 %
      9 %               A   A  N  NN    I    M   M  A   A    T    E                   %
     10 %               A   A  N   N  IIIII  M   M  A   A    T    EEEEE               %
     11 %                                                                             %
     12 %                                                                             %
     13 %              Methods to Interactively Animate an Image Sequence             %
     14 %                                                                             %
     15 %                             Software Design                                 %
     16 %                                  Cristy                                     %
     17 %                                July 1992                                    %
     18 %                                                                             %
     19 %                                                                             %
     20 %  Copyright 1999-2016 ImageMagick Studio LLC, a non-profit organization      %
     21 %  dedicated to making software imaging solutions freely available.           %
     22 %                                                                             %
     23 %  You may not use this file except in compliance with the License.  You may  %
     24 %  obtain a copy of the License at                                            %
     25 %                                                                             %
     26 %    http://www.imagemagick.org/script/license.php                            %
     27 %                                                                             %
     28 %  Unless required by applicable law or agreed to in writing, software        %
     29 %  distributed under the License is distributed on an "AS IS" BASIS,          %
     30 %  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   %
     31 %  See the License for the specific language governing permissions and        %
     32 %  limitations under the License.                                             %
     33 %                                                                             %
     34 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     35 %
     36 %  Use the animate program to animate an image sequence on any X server.
     37 %
     38 */
     39 
     40 /*
     42   Include declarations.
     43 */
     44 #include "MagickWand/studio.h"
     45 #include "MagickWand/MagickWand.h"
     46 #include "MagickWand/mogrify-private.h"
     47 #include "MagickCore/animate-private.h"
     48 #include "MagickCore/string-private.h"
     49 
     50 /*
     52 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     53 %                                                                             %
     54 %                                                                             %
     55 %                                                                             %
     56 +   A n i m a t e I m a g e C o m m a n d                                     %
     57 %                                                                             %
     58 %                                                                             %
     59 %                                                                             %
     60 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     61 %
     62 %  AnimateImageCommand() displays a sequence of images on any workstation
     63 %  display running an X server. Animate first determines the hardware
     64 %  capabilities of the workstation. If the number of unique colors in an image
     65 %  is less than or equal to the number the workstation can support, the image
     66 %  is displayed in an X window. Otherwise the number of colors in the image is
     67 %  first reduced to match the color resolution of the workstation before it is
     68 %  displayed.
     69 %
     70 %  This means that a continuous-tone 24 bits/pixel image can display on a 8
     71 %  bit pseudo-color device or monochrome device. In most instances the reduced
     72 %  color image closely resembles the original. Alternatively, a monochrome or
     73 %  pseudo-color image sequence can display on a continuous-tone 24 bits/pixels
     74 %  device.
     75 %
     76 %  The format of the AnimateImageCommand method is:
     77 %
     78 %      MagickBooleanType AnimateImageCommand(ImageInfo *image_info,int argc,
     79 %        char **argv,char **metadata,ExceptionInfo *exception)
     80 %
     81 %  A description of each parameter follows:
     82 %
     83 %    o image_info: the image info.
     84 %
     85 %    o argc: the number of elements in the argument vector.
     86 %
     87 %    o argv: A text array containing the command line arguments.
     88 %
     89 %    o metadata: any metadata is returned here.
     90 %
     91 %    o exception: return any errors or warnings in this structure.
     92 %
     93 */
     94 
     95 static MagickBooleanType AnimateUsage(void)
     96 {
     97   const char
     98     **p;
     99 
    100   static const char
    101     *buttons[]=
    102     {
    103       "Press any button to map or unmap the Command widget",
    104       (char *) NULL
    105     },
    106     *miscellaneous[]=
    107     {
    108       "-debug events        display copious debugging information",
    109       "-help                print program options",
    110       "-list type           print a list of supported option arguments",
    111       "-log format          format of debugging information",
    112       "-version             print version information",
    113       (char *) NULL
    114     },
    115     *operators[]=
    116     {
    117       "-channel mask        set the image channel mask",
    118       "-colors value        preferred number of colors in the image",
    119       "-crop geometry       preferred size and location of the cropped image",
    120       "-extract geometry    extract area from image",
    121       "-monochrome          transform image to black and white",
    122       "-repage geometry     size and location of an image canvas (operator)",
    123       "-resample geometry   change the resolution of an image",
    124       "-resize geometry     resize the image",
    125       "-rotate degrees      apply Paeth rotation to the image",
    126       "-strip               strip image of all profiles and comments",
    127       "-thumbnail geometry  create a thumbnail of the image",
    128       "-trim                trim image edges",
    129       (char *) NULL
    130     },
    131     *settings[]=
    132     {
    133       "-alpha option        on, activate, off, deactivate, set, opaque, copy",
    134       "                     transparent, extract, background, or shape",
    135       "-authenticate password",
    136       "                     decipher image with this password",
    137       "-backdrop            display image centered on a backdrop",
    138       "-colormap type       Shared or Private",
    139       "-colorspace type     alternate image colorspace",
    140       "-decipher filename   convert cipher pixels to plain pixels",
    141       "-define format:option",
    142       "                     define one or more image format options",
    143       "-delay value         display the next image after pausing",
    144       "-density geometry    horizontal and vertical density of the image",
    145       "-depth value         image depth",
    146       "-display server      display image to this X server",
    147       "-dispose method      layer disposal method",
    148       "-dither method       apply error diffusion to image",
    149       "-filter type         use this filter when resizing an image",
    150       "-format \"string\"     output formatted image characteristics",
    151       "-gamma value         level of gamma correction",
    152       "-geometry geometry   preferred size and location of the Image window",
    153       "-gravity type        horizontal and vertical backdrop placement",
    154       "-identify            identify the format and characteristics of the image",
    155       "-immutable           displayed image cannot be modified",
    156       "-interlace type      type of image interlacing scheme",
    157       "-interpolate method  pixel color interpolation method",
    158       "-limit type value    pixel cache resource limit",
    159       "-loop iterations     loop images then exit",
    160       "-matte               store matte channel if the image has one",
    161       "-map type            display image using this Standard Colormap",
    162       "-monitor             monitor progress",
    163       "-pause               seconds to pause before reanimating",
    164       "-page geometry       size and location of an image canvas (setting)",
    165       "-quantize colorspace reduce colors in this colorspace",
    166       "-quiet               suppress all warning messages",
    167       "-regard-warnings     pay attention to warning messages",
    168       "-remote command      execute a command in an remote display process",
    169       "-respect-parentheses settings remain in effect until parenthesis boundary",
    170       "-sampling-factor geometry",
    171       "                     horizontal and vertical sampling factor",
    172       "-scenes range        image scene range",
    173       "-seed value          seed a new sequence of pseudo-random numbers",
    174       "-set attribute value set an image attribute",
    175       "-size geometry       width and height of image",
    176       "-support factor      resize support: > 1.0 is blurry, < 1.0 is sharp",
    177       "-transparent-color color",
    178       "                     transparent color",
    179       "-treedepth value     color tree depth",
    180       "-verbose             print detailed information about the image",
    181       "-visual type         display image using this visual type",
    182       "-virtual-pixel method",
    183       "                     virtual pixel access method",
    184       "-window id           display image to background of this window",
    185       (char *) NULL
    186     },
    187     *sequence_operators[]=
    188     {
    189       "-coalesce            merge a sequence of images",
    190       "-flatten             flatten a sequence of images",
    191       (char *) NULL
    192     };
    193 
    194   ListMagickVersion(stdout);
    195   (void) printf("Usage: %s [options ...] file [ [options ...] file ...]\n",
    196     GetClientName());
    197   (void) printf("\nImage Settings:\n");
    198   for (p=settings; *p != (char *) NULL; p++)
    199     (void) printf("  %s\n",*p);
    200   (void) printf("\nImage Operators:\n");
    201   for (p=operators; *p != (char *) NULL; p++)
    202     (void) printf("  %s\n",*p);
    203   (void) printf("\nImage Sequence Operators:\n");
    204   for (p=sequence_operators; *p != (char *) NULL; p++)
    205     (void) printf("  %s\n",*p);
    206   (void) printf("\nMiscellaneous Options:\n");
    207   for (p=miscellaneous; *p != (char *) NULL; p++)
    208     (void) printf("  %s\n",*p);
    209   (void) printf(
    210     "\nIn addition to those listed above, you can specify these standard X\n");
    211   (void) printf(
    212     "resources as command line options:  -background, -bordercolor,\n");
    213   (void) printf(
    214     "-alpha-color, -borderwidth, -font, -foreground, -iconGeometry,\n");
    215   (void) printf("-iconic, -name, -shared-memory, or -title.\n");
    216   (void) printf(
    217     "\nBy default, the image format of 'file' is determined by its magic\n");
    218   (void) printf(
    219     "number.  To specify a particular image format, precede the filename\n");
    220   (void) printf(
    221     "with an image format name and a colon (i.e. ps:image) or specify the\n");
    222   (void) printf(
    223     "image type as the filename suffix (i.e. image.ps).  Specify 'file' as\n");
    224   (void) printf("'-' for standard input or output.\n");
    225   (void) printf("\nButtons: \n");
    226   for (p=buttons; *p != (char *) NULL; p++)
    227     (void) printf("  %s\n",*p);
    228   return(MagickFalse);
    229 }
    230 
    231 WandExport MagickBooleanType AnimateImageCommand(ImageInfo *image_info,
    232   int argc,char **argv,char **wand_unused(metadata),ExceptionInfo *exception)
    233 {
    234 #if defined(MAGICKCORE_X11_DELEGATE)
    235 #define DestroyAnimate() \
    236 { \
    237   XDestroyResourceInfo(&resource_info); \
    238   if (display != (Display *) NULL) \
    239     { \
    240       XCloseDisplay(display); \
    241       display=(Display *) NULL; \
    242     } \
    243   XDestroyResourceInfo(&resource_info); \
    244   DestroyImageStack(); \
    245   for (i=0; i < (ssize_t) argc; i++) \
    246     argv[i]=DestroyString(argv[i]); \
    247   argv=(char **) RelinquishMagickMemory(argv); \
    248 }
    249 #define ThrowAnimateException(asperity,tag,option) \
    250 { \
    251   (void) ThrowMagickException(exception,GetMagickModule(),asperity,tag,"`%s'", \
    252     option); \
    253   DestroyAnimate(); \
    254   return(MagickFalse); \
    255 }
    256 #define ThrowAnimateInvalidArgumentException(option,argument) \
    257 { \
    258   (void) ThrowMagickException(exception,GetMagickModule(),OptionError, \
    259     "InvalidArgument","'%s': %s",option,argument); \
    260   DestroyAnimate(); \
    261   return(MagickFalse); \
    262 }
    263 
    264   char
    265     *resource_value,
    266     *server_name;
    267 
    268   const char
    269     *option;
    270 
    271   Display
    272     *display;
    273 
    274   Image
    275     *image;
    276 
    277   ImageStack
    278     image_stack[MaxImageStackDepth+1];
    279 
    280   MagickBooleanType
    281     fire,
    282     pend,
    283     respect_parenthesis;
    284 
    285   MagickStatusType
    286     status;
    287 
    288   QuantizeInfo
    289     *quantize_info;
    290 
    291   register ssize_t
    292     i;
    293 
    294   ssize_t
    295     j,
    296     k;
    297 
    298   XResourceInfo
    299     resource_info;
    300 
    301   XrmDatabase
    302     resource_database;
    303 
    304   /*
    305     Set defaults.
    306   */
    307   assert(image_info != (ImageInfo *) NULL);
    308   assert(image_info->signature == MagickCoreSignature);
    309   if (image_info->debug != MagickFalse)
    310     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
    311   assert(exception != (ExceptionInfo *) NULL);
    312   if (argc == 2)
    313     {
    314       option=argv[1];
    315       if ((LocaleCompare("version",option+1) == 0) ||
    316           (LocaleCompare("-version",option+1) == 0))
    317         {
    318           ListMagickVersion(stdout);
    319           return(MagickTrue);
    320         }
    321     }
    322   status=MagickTrue;
    323   SetNotifyHandlers;
    324   display=(Display *) NULL;
    325   j=1;
    326   k=0;
    327   NewImageStack();
    328   option=(char *) NULL;
    329   pend=MagickFalse;
    330   respect_parenthesis=MagickFalse;
    331   resource_database=(XrmDatabase) NULL;
    332   (void) ResetMagickMemory(&resource_info,0,sizeof(XResourceInfo));
    333   server_name=(char *) NULL;
    334   status=MagickTrue;
    335   /*
    336     Check for server name specified on the command line.
    337   */
    338   ReadCommandlLine(argc,&argv);
    339   status=ExpandFilenames(&argc,&argv);
    340   if (status == MagickFalse)
    341     ThrowAnimateException(ResourceLimitError,"MemoryAllocationFailed",
    342       image_info->filename);
    343   for (i=1; i < (ssize_t) argc; i++)
    344   {
    345     /*
    346       Check command line for server name.
    347     */
    348     option=argv[i];
    349     if (LocaleCompare("display",option+1) == 0)
    350       {
    351         /*
    352           User specified server name.
    353         */
    354         i++;
    355         if (i == (ssize_t) argc)
    356           ThrowAnimateException(OptionError,"MissingArgument",option);
    357         server_name=argv[i];
    358       }
    359     if ((LocaleCompare("help",option+1) == 0) ||
    360         (LocaleCompare("-help",option+1) == 0))
    361       return(AnimateUsage());
    362   }
    363   /*
    364     Get user defaults from X resource database.
    365   */
    366   display=XOpenDisplay(server_name);
    367   if (display == (Display *) NULL)
    368     ThrowAnimateException(XServerError,"UnableToOpenXServer",
    369       XDisplayName(server_name));
    370   (void) XSetErrorHandler(XError);
    371   resource_database=XGetResourceDatabase(display,GetClientName());
    372   XGetResourceInfo(image_info,resource_database,GetClientName(),
    373     &resource_info);
    374   quantize_info=resource_info.quantize_info;
    375   image_info->density=XGetResourceInstance(resource_database,GetClientName(),
    376     "density",(char *) NULL);
    377   if (image_info->density == (char *) NULL)
    378     image_info->density=XGetScreenDensity(display);
    379   resource_value=XGetResourceInstance(resource_database,GetClientName(),
    380     "interlace","none");
    381   image_info->interlace=(InterlaceType)
    382     ParseCommandOption(MagickInterlaceOptions,MagickFalse,resource_value);
    383   resource_value=XGetResourceInstance(resource_database,GetClientName(),
    384     "verbose","False");
    385   image_info->verbose=IsStringTrue(resource_value);
    386   resource_value=XGetResourceInstance(resource_database,GetClientName(),
    387     "dither","True");
    388   quantize_info->dither_method=IsStringTrue(resource_value) != MagickFalse ?
    389     RiemersmaDitherMethod : NoDitherMethod;
    390   /*
    391     Parse command line.
    392   */
    393   for (i=1; i <= (ssize_t) argc; i++)
    394   {
    395     if (i < (ssize_t) argc)
    396       option=argv[i];
    397     else
    398       if (image != (Image *) NULL)
    399         break;
    400       else
    401         if (isatty(STDIN_FILENO) != MagickFalse)
    402           option="logo:";
    403         else
    404           option="-";
    405     if (LocaleCompare(option,"(") == 0)
    406       {
    407         FireImageStack(MagickFalse,MagickTrue,pend);
    408         if (k == MaxImageStackDepth)
    409           ThrowAnimateException(OptionError,"ParenthesisNestedTooDeeply",
    410             option);
    411         PushImageStack();
    412         continue;
    413       }
    414     if (LocaleCompare(option,")") == 0)
    415       {
    416         FireImageStack(MagickFalse,MagickTrue,MagickTrue);
    417         if (k == 0)
    418           ThrowAnimateException(OptionError,"UnableToParseExpression",option);
    419         PopImageStack();
    420         continue;
    421       }
    422     if (IsCommandOption(option) == MagickFalse)
    423       {
    424         const char
    425           *filename;
    426 
    427         Image
    428           *images;
    429 
    430         /*
    431           Read input image.
    432         */
    433         FireImageStack(MagickFalse,MagickFalse,pend);
    434         filename=option;
    435         if ((LocaleCompare(filename,"--") == 0) && (i < (ssize_t) (argc-1)))
    436           {
    437             option=argv[++i];
    438             filename=option;
    439           }
    440         if (image_info->ping != MagickFalse)
    441           images=PingImages(image_info,filename,exception);
    442         else
    443           images=ReadImages(image_info,filename,exception);
    444         status&=(images != (Image *) NULL) &&
    445           (exception->severity < ErrorException);
    446         if (images == (Image *) NULL)
    447           continue;
    448         AppendImageStack(images);
    449         continue;
    450       }
    451     pend=image != (Image *) NULL ? MagickTrue : MagickFalse;
    452     switch (*(option+1))
    453     {
    454       case 'a':
    455       {
    456         if (LocaleCompare("alpha",option+1) == 0)
    457           {
    458             ssize_t
    459               type;
    460 
    461             if (*option == '+')
    462               break;
    463             i++;
    464             if (i == (ssize_t) argc)
    465               ThrowAnimateException(OptionError,"MissingArgument",option);
    466             type=ParseCommandOption(MagickAlphaChannelOptions,MagickFalse,argv[i]);
    467             if (type < 0)
    468               ThrowAnimateException(OptionError,"UnrecognizedAlphaChannelOption",
    469                 argv[i]);
    470             break;
    471           }
    472         if (LocaleCompare("alpha-color",option+1) == 0)
    473           {
    474             if (*option == '+')
    475               break;
    476             i++;
    477             if (i == (ssize_t) argc)
    478               ThrowAnimateException(OptionError,"MissingArgument",option);
    479             resource_info.alpha_color=argv[i];
    480             break;
    481           }
    482         if (LocaleCompare("authenticate",option+1) == 0)
    483           {
    484             if (*option == '+')
    485               break;
    486             i++;
    487             if (i == (ssize_t) argc)
    488               ThrowAnimateException(OptionError,"MissingArgument",option);
    489             break;
    490           }
    491         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
    492       }
    493       case 'b':
    494       {
    495         if (LocaleCompare("backdrop",option+1) == 0)
    496           {
    497             resource_info.backdrop=(*option == '-') ? MagickTrue : MagickFalse;
    498             break;
    499           }
    500         if (LocaleCompare("background",option+1) == 0)
    501           {
    502             if (*option == '+')
    503               break;
    504             i++;
    505             if (i == (ssize_t) argc)
    506               ThrowAnimateException(OptionError,"MissingArgument",option);
    507             resource_info.background_color=argv[i];
    508             break;
    509           }
    510         if (LocaleCompare("bordercolor",option+1) == 0)
    511           {
    512             if (*option == '+')
    513               break;
    514             i++;
    515             if (i == (ssize_t) argc)
    516               ThrowAnimateException(OptionError,"MissingArgument",option);
    517             resource_info.border_color=argv[i];
    518             break;
    519           }
    520         if (LocaleCompare("borderwidth",option+1) == 0)
    521           {
    522             resource_info.border_width=0;
    523             if (*option == '+')
    524               break;
    525             i++;
    526             if ((i == (ssize_t) argc) || (IsGeometry(argv[i]) == MagickFalse))
    527               ThrowAnimateException(OptionError,"MissingArgument",option);
    528             resource_info.border_width=(unsigned int)
    529               StringToUnsignedLong(argv[i]);
    530             break;
    531           }
    532         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
    533       }
    534       case 'c':
    535       {
    536         if (LocaleCompare("cache",option+1) == 0)
    537           {
    538             if (*option == '+')
    539               break;
    540             i++;
    541             if (i == (ssize_t) argc)
    542               ThrowAnimateException(OptionError,"MissingArgument",option);
    543             if (IsGeometry(argv[i]) == MagickFalse)
    544               ThrowAnimateInvalidArgumentException(option,argv[i]);
    545             break;
    546           }
    547         if (LocaleCompare("channel",option+1) == 0)
    548           {
    549             ssize_t
    550               channel;
    551 
    552             if (*option == '+')
    553               break;
    554             i++;
    555             if (i == (ssize_t) argc)
    556               ThrowAnimateException(OptionError,"MissingArgument",option);
    557             channel=ParseChannelOption(argv[i]);
    558             if (channel < 0)
    559               ThrowAnimateException(OptionError,"UnrecognizedChannelType",
    560                 argv[i]);
    561             break;
    562           }
    563         if (LocaleCompare("clone",option+1) == 0)
    564           {
    565             Image
    566               *clone_images;
    567 
    568             clone_images=image;
    569             if (k != 0)
    570               clone_images=image_stack[k-1].image;
    571             if (clone_images == (Image *) NULL)
    572               ThrowAnimateException(ImageError,"UnableToCloneImage",option);
    573             FireImageStack(MagickFalse,MagickTrue,MagickTrue);
    574             if (*option == '+')
    575               clone_images=CloneImages(clone_images,"-1",exception);
    576             else
    577               {
    578                 i++;
    579                 if (i == (ssize_t) argc)
    580                   ThrowAnimateException(OptionError,"MissingArgument",option);
    581                 if (IsSceneGeometry(argv[i],MagickFalse) == MagickFalse)
    582                   ThrowAnimateInvalidArgumentException(option,argv[i]);
    583                 clone_images=CloneImages(clone_images,argv[i],exception);
    584               }
    585             if (clone_images == (Image *) NULL)
    586               ThrowAnimateException(OptionError,"NoSuchImage",option);
    587             AppendImageStack(clone_images);
    588             break;
    589           }
    590         if (LocaleCompare("coalesce",option+1) == 0)
    591           break;
    592         if (LocaleCompare("colormap",option+1) == 0)
    593           {
    594             resource_info.colormap=PrivateColormap;
    595             if (*option == '+')
    596               break;
    597             i++;
    598             if (i == (ssize_t) argc)
    599               ThrowAnimateException(OptionError,"MissingArgument",option);
    600             resource_info.colormap=UndefinedColormap;
    601             if (LocaleCompare("private",argv[i]) == 0)
    602               resource_info.colormap=PrivateColormap;
    603             if (LocaleCompare("shared",argv[i]) == 0)
    604               resource_info.colormap=SharedColormap;
    605             if (resource_info.colormap == UndefinedColormap)
    606               ThrowAnimateException(OptionError,"UnrecognizedColormapType",
    607                 argv[i]);
    608             break;
    609           }
    610         if (LocaleCompare("colors",option+1) == 0)
    611           {
    612             quantize_info->number_colors=0;
    613             if (*option == '+')
    614               break;
    615             i++;
    616             if (i == (ssize_t) argc)
    617               ThrowAnimateException(OptionError,"MissingArgument",option);
    618             if (IsGeometry(argv[i]) == MagickFalse)
    619               ThrowAnimateInvalidArgumentException(option,argv[i]);
    620             quantize_info->number_colors=StringToUnsignedLong(argv[i]);
    621             break;
    622           }
    623         if (LocaleCompare("colorspace",option+1) == 0)
    624           {
    625             ssize_t
    626               colorspace;
    627 
    628             if (*option == '+')
    629               break;
    630             i++;
    631             if (i == (ssize_t) argc)
    632               ThrowAnimateException(OptionError,"MissingArgument",option);
    633             colorspace=ParseCommandOption(MagickColorspaceOptions,
    634               MagickFalse,argv[i]);
    635             if (colorspace < 0)
    636               ThrowAnimateException(OptionError,"UnrecognizedColorspace",
    637                 argv[i]);
    638             break;
    639           }
    640         if (LocaleCompare("concurrent",option+1) == 0)
    641           break;
    642         if (LocaleCompare("crop",option+1) == 0)
    643           {
    644             if (*option == '+')
    645               break;
    646             i++;
    647             if (i == (ssize_t) argc)
    648               ThrowAnimateException(OptionError,"MissingArgument",option);
    649             if (IsGeometry(argv[i]) == MagickFalse)
    650               ThrowAnimateInvalidArgumentException(option,argv[i]);
    651             break;
    652           }
    653         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
    654       }
    655       case 'd':
    656       {
    657         if (LocaleCompare("debug",option+1) == 0)
    658           {
    659             ssize_t
    660               event;
    661 
    662             if (*option == '+')
    663               break;
    664             i++;
    665             if (i == (ssize_t) argc)
    666               ThrowAnimateException(OptionError,"MissingArgument",option);
    667             event=ParseCommandOption(MagickLogEventOptions,MagickFalse,argv[i]);
    668             if (event < 0)
    669               ThrowAnimateException(OptionError,"UnrecognizedEventType",
    670                 argv[i]);
    671             (void) SetLogEventMask(argv[i]);
    672             break;
    673           }
    674         if (LocaleCompare("decipher",option+1) == 0)
    675           {
    676             if (*option == '+')
    677               break;
    678             i++;
    679             if (i == (ssize_t) argc)
    680               ThrowAnimateException(OptionError,"MissingArgument",option);
    681             break;
    682           }
    683         if (LocaleCompare("define",option+1) == 0)
    684           {
    685             i++;
    686             if (i == (ssize_t) argc)
    687               ThrowAnimateException(OptionError,"MissingArgument",option);
    688             if (*option == '+')
    689               {
    690                 const char
    691                   *define;
    692 
    693                 define=GetImageOption(image_info,argv[i]);
    694                 if (define == (const char *) NULL)
    695                   ThrowAnimateException(OptionError,"NoSuchOption",argv[i]);
    696                 break;
    697               }
    698             break;
    699           }
    700         if (LocaleCompare("delay",option+1) == 0)
    701           {
    702             if (*option == '+')
    703               break;
    704             i++;
    705             if (i == (ssize_t) argc)
    706               ThrowAnimateException(OptionError,"MissingArgument",option);
    707             if (IsGeometry(argv[i]) == MagickFalse)
    708               ThrowAnimateInvalidArgumentException(option,argv[i]);
    709             break;
    710           }
    711         if (LocaleCompare("density",option+1) == 0)
    712           {
    713             if (*option == '+')
    714               break;
    715             i++;
    716             if (i == (ssize_t) argc)
    717               ThrowAnimateException(OptionError,"MissingArgument",option);
    718             if (IsGeometry(argv[i]) == MagickFalse)
    719               ThrowAnimateInvalidArgumentException(option,argv[i]);
    720             break;
    721           }
    722         if (LocaleCompare("depth",option+1) == 0)
    723           {
    724             if (*option == '+')
    725               break;
    726             i++;
    727             if (i == (ssize_t) argc)
    728               ThrowAnimateException(OptionError,"MissingArgument",option);
    729             if (IsGeometry(argv[i]) == MagickFalse)
    730               ThrowAnimateInvalidArgumentException(option,argv[i]);
    731             break;
    732           }
    733         if (LocaleCompare("display",option+1) == 0)
    734           {
    735             if (*option == '+')
    736               break;
    737             i++;
    738             if (i == (ssize_t) argc)
    739               ThrowAnimateException(OptionError,"MissingArgument",option);
    740             break;
    741           }
    742         if (LocaleCompare("dispose",option+1) == 0)
    743           {
    744             ssize_t
    745               dispose;
    746 
    747             if (*option == '+')
    748               break;
    749             i++;
    750             if (i == (ssize_t) argc)
    751               ThrowAnimateException(OptionError,"MissingArgument",option);
    752             dispose=ParseCommandOption(MagickDisposeOptions,MagickFalse,argv[i]);
    753             if (dispose < 0)
    754               ThrowAnimateException(OptionError,"UnrecognizedDisposeMethod",
    755                 argv[i]);
    756             break;
    757           }
    758         if (LocaleCompare("dither",option+1) == 0)
    759           {
    760             ssize_t
    761               method;
    762 
    763             quantize_info->dither_method=NoDitherMethod;
    764             if (*option == '+')
    765               break;
    766             i++;
    767             if (i == (ssize_t) argc)
    768               ThrowAnimateException(OptionError,"MissingArgument",option);
    769             method=ParseCommandOption(MagickDitherOptions,MagickFalse,argv[i]);
    770             if (method < 0)
    771               ThrowAnimateException(OptionError,"UnrecognizedDitherMethod",
    772                 argv[i]);
    773             quantize_info->dither_method=(DitherMethod) method;
    774             break;
    775           }
    776         if (LocaleCompare("duration",option+1) == 0)
    777           {
    778             if (*option == '+')
    779               break;
    780             i++;
    781             if (i == (ssize_t) argc)
    782               ThrowAnimateException(OptionError,"MissingArgument",option);
    783             if (IsGeometry(argv[i]) == MagickFalse)
    784               ThrowAnimateInvalidArgumentException(option,argv[i]);
    785             break;
    786           }
    787         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
    788       }
    789       case 'e':
    790       {
    791         if (LocaleCompare("extract",option+1) == 0)
    792           {
    793             if (*option == '+')
    794               break;
    795             i++;
    796             if (i == (ssize_t) argc)
    797               ThrowAnimateException(OptionError,"MissingArgument",option);
    798             if (IsGeometry(argv[i]) == MagickFalse)
    799               ThrowAnimateInvalidArgumentException(option,argv[i]);
    800             break;
    801           }
    802         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
    803       }
    804       case 'f':
    805       {
    806         if (LocaleCompare("filter",option+1) == 0)
    807           {
    808             ssize_t
    809               filter;
    810 
    811             if (*option == '+')
    812               break;
    813             i++;
    814             if (i == (ssize_t) argc)
    815               ThrowAnimateException(OptionError,"MissingArgument",option);
    816             filter=ParseCommandOption(MagickFilterOptions,MagickFalse,argv[i]);
    817             if (filter < 0)
    818               ThrowAnimateException(OptionError,"UnrecognizedImageFilter",
    819                 argv[i]);
    820             break;
    821           }
    822         if (LocaleCompare("flatten",option+1) == 0)
    823           break;
    824         if (LocaleCompare("font",option+1) == 0)
    825           {
    826             if (*option == '+')
    827               break;
    828             i++;
    829             if (i == (ssize_t) argc)
    830               ThrowAnimateException(OptionError,"MissingArgument",option);
    831             resource_info.font=XGetResourceClass(resource_database,
    832               GetClientName(),"font",argv[i]);
    833             break;
    834           }
    835         if (LocaleCompare("foreground",option+1) == 0)
    836           {
    837             if (*option == '+')
    838               break;
    839             i++;
    840             if (i == (ssize_t) argc)
    841               ThrowAnimateException(OptionError,"MissingArgument",option);
    842             resource_info.foreground_color=argv[i];
    843             break;
    844           }
    845         if (LocaleCompare("format",option+1) == 0)
    846           {
    847             if (*option == '+')
    848               break;
    849             i++;
    850             if (i == (ssize_t) argc)
    851               ThrowAnimateException(OptionError,"MissingArgument",option);
    852             break;
    853           }
    854         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
    855       }
    856       case 'g':
    857       {
    858         if (LocaleCompare("gamma",option+1) == 0)
    859           {
    860             i++;
    861             if (i == (ssize_t) argc)
    862               ThrowAnimateException(OptionError,"MissingArgument",option);
    863             if (IsGeometry(argv[i]) == MagickFalse)
    864               ThrowAnimateInvalidArgumentException(option,argv[i]);
    865             break;
    866           }
    867         if (LocaleCompare("geometry",option+1) == 0)
    868           {
    869             resource_info.image_geometry=(char *) NULL;
    870             if (*option == '+')
    871               break;
    872             i++;
    873             if (i == (ssize_t) argc)
    874               ThrowAnimateException(OptionError,"MissingArgument",option);
    875             if (IsGeometry(argv[i]) == MagickFalse)
    876               ThrowAnimateInvalidArgumentException(option,argv[i]);
    877             resource_info.image_geometry=ConstantString(argv[i]);
    878             break;
    879           }
    880         if (LocaleCompare("gravity",option+1) == 0)
    881           {
    882             ssize_t
    883               gravity;
    884 
    885             if (*option == '+')
    886               break;
    887             i++;
    888             if (i == (ssize_t) argc)
    889               ThrowAnimateException(OptionError,"MissingArgument",option);
    890             gravity=ParseCommandOption(MagickGravityOptions,MagickFalse,
    891               argv[i]);
    892             if (gravity < 0)
    893               ThrowAnimateException(OptionError,"UnrecognizedGravityType",
    894                 argv[i]);
    895             break;
    896           }
    897         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
    898       }
    899       case 'h':
    900       {
    901         if ((LocaleCompare("help",option+1) == 0) ||
    902             (LocaleCompare("-help",option+1) == 0))
    903           break;
    904         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
    905       }
    906       case 'i':
    907       {
    908         if (LocaleCompare("iconGeometry",option+1) == 0)
    909           {
    910             resource_info.icon_geometry=(char *) NULL;
    911             if (*option == '+')
    912               break;
    913             i++;
    914             if (i == (ssize_t) argc)
    915               ThrowAnimateException(OptionError,"MissingArgument",option);
    916             if (IsGeometry(argv[i]) == MagickFalse)
    917               ThrowAnimateInvalidArgumentException(option,argv[i]);
    918             resource_info.icon_geometry=argv[i];
    919             break;
    920           }
    921         if (LocaleCompare("iconic",option+1) == 0)
    922           {
    923             resource_info.iconic=(*option == '-') ? MagickTrue : MagickFalse;
    924             break;
    925           }
    926         if (LocaleCompare("identify",option+1) == 0)
    927           break;
    928         if (LocaleCompare("immutable",option+1) == 0)
    929           {
    930             resource_info.immutable=(*option == '-') ? MagickTrue : MagickFalse;
    931             break;
    932           }
    933         if (LocaleCompare("interlace",option+1) == 0)
    934           {
    935             ssize_t
    936               interlace;
    937 
    938             if (*option == '+')
    939               break;
    940             i++;
    941             if (i == (ssize_t) argc)
    942               ThrowAnimateException(OptionError,"MissingArgument",option);
    943             interlace=ParseCommandOption(MagickInterlaceOptions,MagickFalse,
    944               argv[i]);
    945             if (interlace < 0)
    946               ThrowAnimateException(OptionError,"UnrecognizedInterlaceType",
    947                 argv[i]);
    948             break;
    949           }
    950         if (LocaleCompare("interpolate",option+1) == 0)
    951           {
    952             ssize_t
    953               interpolate;
    954 
    955             if (*option == '+')
    956               break;
    957             i++;
    958             if (i == (ssize_t) argc)
    959               ThrowAnimateException(OptionError,"MissingArgument",option);
    960             interpolate=ParseCommandOption(MagickInterpolateOptions,MagickFalse,
    961               argv[i]);
    962             if (interpolate < 0)
    963               ThrowAnimateException(OptionError,"UnrecognizedInterpolateMethod",
    964                 argv[i]);
    965             break;
    966           }
    967         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
    968       }
    969       case 'l':
    970       {
    971         if (LocaleCompare("label",option+1) == 0)
    972           {
    973             if (*option == '+')
    974               break;
    975             i++;
    976             if (i == (ssize_t) argc)
    977               ThrowAnimateException(OptionError,"MissingArgument",option);
    978             break;
    979           }
    980         if (LocaleCompare("limit",option+1) == 0)
    981           {
    982             char
    983               *p;
    984 
    985             double
    986               value;
    987 
    988             ssize_t
    989               resource;
    990 
    991             if (*option == '+')
    992               break;
    993             i++;
    994             if (i == (ssize_t) argc)
    995               ThrowAnimateException(OptionError,"MissingArgument",option);
    996             resource=ParseCommandOption(MagickResourceOptions,MagickFalse,
    997               argv[i]);
    998             if (resource < 0)
    999               ThrowAnimateException(OptionError,"UnrecognizedResourceType",
   1000                 argv[i]);
   1001             i++;
   1002             if (i == (ssize_t) argc)
   1003               ThrowAnimateException(OptionError,"MissingArgument",option);
   1004             value=StringToDouble(argv[i],&p);
   1005             (void) value;
   1006             if ((p == argv[i]) && (LocaleCompare("unlimited",argv[i]) != 0))
   1007               ThrowAnimateInvalidArgumentException(option,argv[i]);
   1008             break;
   1009           }
   1010         if (LocaleCompare("list",option+1) == 0)
   1011           {
   1012             ssize_t
   1013               list;
   1014 
   1015             if (*option == '+')
   1016               break;
   1017             i++;
   1018             if (i == (ssize_t) argc)
   1019               ThrowAnimateException(OptionError,"MissingArgument",option);
   1020             list=ParseCommandOption(MagickListOptions,MagickFalse,argv[i]);
   1021             if (list < 0)
   1022               ThrowAnimateException(OptionError,"UnrecognizedListType",argv[i]);
   1023             status=MogrifyImageInfo(image_info,(int) (i-j+1),(const char **)
   1024               argv+j,exception);
   1025             DestroyAnimate();
   1026             return(status == 0 ? MagickTrue : MagickFalse);
   1027           }
   1028         if (LocaleCompare("log",option+1) == 0)
   1029           {
   1030             if (*option == '+')
   1031               break;
   1032             i++;
   1033             if ((i == (ssize_t) argc) ||
   1034                 (strchr(argv[i],'%') == (char *) NULL))
   1035               ThrowAnimateException(OptionError,"MissingArgument",option);
   1036             break;
   1037           }
   1038         if (LocaleCompare("loop",option+1) == 0)
   1039           {
   1040             if (*option == '+')
   1041               break;
   1042             i++;
   1043             if (i == (ssize_t) argc)
   1044               ThrowAnimateException(OptionError,"MissingArgument",option);
   1045             if (IsGeometry(argv[i]) == MagickFalse)
   1046               ThrowAnimateInvalidArgumentException(option,argv[i]);
   1047             break;
   1048           }
   1049         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
   1050       }
   1051       case 'm':
   1052       {
   1053         if (LocaleCompare("map",option+1) == 0)
   1054           {
   1055             resource_info.map_type=(char *) NULL;
   1056             if (*option == '+')
   1057               break;
   1058             (void) CopyMagickString(argv[i]+1,"san",MagickPathExtent);
   1059             i++;
   1060             if (i == (ssize_t) argc)
   1061               ThrowAnimateException(OptionError,"MissingArgument",option);
   1062             resource_info.map_type=argv[i];
   1063             break;
   1064           }
   1065         if (LocaleCompare("matte",option+1) == 0)
   1066           break;
   1067         if (LocaleCompare("monitor",option+1) == 0)
   1068           break;
   1069         if (LocaleCompare("monochrome",option+1) == 0)
   1070           {
   1071             if (*option == '+')
   1072               break;
   1073             quantize_info->number_colors=2;
   1074             quantize_info->colorspace=GRAYColorspace;
   1075             break;
   1076           }
   1077         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
   1078       }
   1079       case 'n':
   1080       {
   1081         if (LocaleCompare("name",option+1) == 0)
   1082           {
   1083             resource_info.name=(char *) NULL;
   1084             if (*option == '+')
   1085               break;
   1086             i++;
   1087             if (i == (ssize_t) argc)
   1088               ThrowAnimateException(OptionError,"MissingArgument",option);
   1089             resource_info.name=ConstantString(argv[i]);
   1090             break;
   1091           }
   1092         if (LocaleCompare("noop",option+1) == 0)
   1093           break;
   1094         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
   1095       }
   1096       case 'p':
   1097       {
   1098         if (LocaleCompare("pause",option+1) == 0)
   1099           {
   1100             resource_info.pause=0;
   1101             if (*option == '+')
   1102               break;
   1103             i++;
   1104             if (i == (ssize_t) argc)
   1105               ThrowAnimateException(OptionError,"MissingArgument",option);
   1106             if (IsGeometry(argv[i]) == MagickFalse)
   1107               ThrowAnimateInvalidArgumentException(option,argv[i]);
   1108             resource_info.pause=(unsigned int) StringToUnsignedLong(argv[i]);
   1109             break;
   1110           }
   1111         if (LocaleCompare("page",option+1) == 0)
   1112           {
   1113             if (*option == '+')
   1114               break;
   1115             i++;
   1116             if (i == (ssize_t) argc)
   1117               ThrowAnimateException(OptionError,"MissingArgument",option);
   1118             break;
   1119           }
   1120         if (LocaleCompare("profile",option+1) == 0)
   1121           {
   1122             i++;
   1123             if (i == (ssize_t) argc)
   1124               ThrowAnimateException(OptionError,"MissingArgument",option);
   1125             break;
   1126           }
   1127         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
   1128       }
   1129       case 'q':
   1130       {
   1131         if (LocaleCompare("quantize",option+1) == 0)
   1132           {
   1133             ssize_t
   1134               colorspace;
   1135 
   1136             if (*option == '+')
   1137               break;
   1138             i++;
   1139             if (i == (ssize_t) argc)
   1140               ThrowAnimateException(OptionError,"MissingArgument",option);
   1141             colorspace=ParseCommandOption(MagickColorspaceOptions,
   1142               MagickFalse,argv[i]);
   1143             if (colorspace < 0)
   1144               ThrowAnimateException(OptionError,"UnrecognizedColorspace",
   1145                 argv[i]);
   1146             break;
   1147           }
   1148         if (LocaleCompare("quiet",option+1) == 0)
   1149           break;
   1150         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
   1151       }
   1152       case 'r':
   1153       {
   1154         if (LocaleCompare("regard-warnings",option+1) == 0)
   1155           break;
   1156         if (LocaleCompare("remote",option+1) == 0)
   1157           {
   1158             i++;
   1159             if (i == (ssize_t) argc)
   1160               ThrowAnimateException(OptionError,"MissingArgument",option);
   1161             if (XRemoteCommand(display,resource_info.window_id,argv[i]) != 0)
   1162               return(MagickFalse);
   1163             i--;
   1164             break;
   1165           }
   1166         if (LocaleCompare("repage",option+1) == 0)
   1167           {
   1168             if (*option == '+')
   1169               break;
   1170             i++;
   1171             if (i == (ssize_t) argc)
   1172               ThrowAnimateException(OptionError,"MissingArgument",option);
   1173             if (IsGeometry(argv[i]) == MagickFalse)
   1174               ThrowAnimateInvalidArgumentException(option,argv[i]);
   1175             break;
   1176           }
   1177         if (LocaleCompare("resample",option+1) == 0)
   1178           {
   1179             if (*option == '+')
   1180               break;
   1181             i++;
   1182             if (i == (ssize_t) argc)
   1183               ThrowAnimateException(OptionError,"MissingArgument",option);
   1184             if (IsGeometry(argv[i]) == MagickFalse)
   1185               ThrowAnimateInvalidArgumentException(option,argv[i]);
   1186             break;
   1187           }
   1188         if (LocaleCompare("resize",option+1) == 0)
   1189           {
   1190             if (*option == '+')
   1191               break;
   1192             i++;
   1193             if (i == (ssize_t) argc)
   1194               ThrowAnimateException(OptionError,"MissingArgument",option);
   1195             if (IsGeometry(argv[i]) == MagickFalse)
   1196               ThrowAnimateInvalidArgumentException(option,argv[i]);
   1197             break;
   1198           }
   1199         if (LocaleNCompare("respect-parentheses",option+1,17) == 0)
   1200           {
   1201             respect_parenthesis=(*option == '-') ? MagickTrue : MagickFalse;
   1202             break;
   1203           }
   1204         if (LocaleCompare("rotate",option+1) == 0)
   1205           {
   1206             i++;
   1207             if (i == (ssize_t) argc)
   1208               ThrowAnimateException(OptionError,"MissingArgument",option);
   1209             if (IsGeometry(argv[i]) == MagickFalse)
   1210               ThrowAnimateInvalidArgumentException(option,argv[i]);
   1211             break;
   1212           }
   1213         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
   1214       }
   1215       case 's':
   1216       {
   1217         if (LocaleCompare("sampling-factor",option+1) == 0)
   1218           {
   1219             if (*option == '+')
   1220               break;
   1221             i++;
   1222             if (i == (ssize_t) argc)
   1223               ThrowAnimateException(OptionError,"MissingArgument",option);
   1224             if (IsGeometry(argv[i]) == MagickFalse)
   1225               ThrowAnimateInvalidArgumentException(option,argv[i]);
   1226             break;
   1227           }
   1228         if (LocaleCompare("seed",option+1) == 0)
   1229           {
   1230             if (*option == '+')
   1231               break;
   1232             i++;
   1233             if (i == (ssize_t) argc)
   1234               ThrowAnimateException(OptionError,"MissingArgument",option);
   1235             if (IsGeometry(argv[i]) == MagickFalse)
   1236               ThrowAnimateInvalidArgumentException(option,argv[i]);
   1237             break;
   1238           }
   1239         if (LocaleCompare("scenes",option+1) == 0)  /* deprecated */
   1240           {
   1241             if (*option == '+')
   1242               break;
   1243             i++;
   1244             if (i == (ssize_t) argc)
   1245               ThrowAnimateException(OptionError,"MissingArgument",option);
   1246             if (IsSceneGeometry(argv[i],MagickFalse) == MagickFalse)
   1247               ThrowAnimateInvalidArgumentException(option,argv[i]);
   1248             break;
   1249           }
   1250         if (LocaleCompare("set",option+1) == 0)
   1251           {
   1252             i++;
   1253             if (i == (ssize_t) argc)
   1254               ThrowAnimateException(OptionError,"MissingArgument",option);
   1255             if (*option == '+')
   1256               break;
   1257             i++;
   1258             if (i == (ssize_t) argc)
   1259               ThrowAnimateException(OptionError,"MissingArgument",option);
   1260             break;
   1261           }
   1262         if (LocaleCompare("shared-memory",option+1) == 0)
   1263           {
   1264             resource_info.use_shared_memory=(*option == '-') ? MagickTrue :
   1265               MagickFalse;
   1266             break;
   1267           }
   1268         if (LocaleCompare("size",option+1) == 0)
   1269           {
   1270             if (*option == '+')
   1271               break;
   1272             i++;
   1273             if (i == (ssize_t) argc)
   1274               ThrowAnimateException(OptionError,"MissingArgument",option);
   1275             if (IsGeometry(argv[i]) == MagickFalse)
   1276               ThrowAnimateInvalidArgumentException(option,argv[i]);
   1277             break;
   1278           }
   1279         if (LocaleCompare("strip",option+1) == 0)
   1280           break;
   1281         if (LocaleCompare("support",option+1) == 0)
   1282           {
   1283             i++;  /* deprecated */
   1284             break;
   1285           }
   1286         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
   1287       }
   1288       case 't':
   1289       {
   1290         if (LocaleCompare("text-font",option+1) == 0)
   1291           {
   1292             resource_info.text_font=(char *) NULL;
   1293             if (*option == '+')
   1294               break;
   1295             i++;
   1296             if (i == (ssize_t) argc)
   1297               ThrowAnimateException(OptionError,"MissingArgument",option);
   1298             resource_info.text_font=XGetResourceClass(resource_database,
   1299               GetClientName(),"font",argv[i]);
   1300             break;
   1301           }
   1302         if (LocaleCompare("thumbnail",option+1) == 0)
   1303           {
   1304             if (*option == '+')
   1305               break;
   1306             i++;
   1307             if (i == (ssize_t) argc)
   1308               ThrowAnimateException(OptionError,"MissingArgument",option);
   1309             if (IsGeometry(argv[i]) == MagickFalse)
   1310               ThrowAnimateInvalidArgumentException(option,argv[i]);
   1311             break;
   1312           }
   1313         if (LocaleCompare("title",option+1) == 0)
   1314           {
   1315             resource_info.title=(char *) NULL;
   1316             if (*option == '+')
   1317               break;
   1318             i++;
   1319             if (i == (ssize_t) argc)
   1320               ThrowAnimateException(OptionError,"MissingArgument",option);
   1321             resource_info.title=argv[i];
   1322             break;
   1323           }
   1324         if (LocaleCompare("transparent-color",option+1) == 0)
   1325           {
   1326             if (*option == '+')
   1327               break;
   1328             i++;
   1329             if (i == (ssize_t) argc)
   1330               ThrowAnimateException(OptionError,"MissingArgument",option);
   1331             break;
   1332           }
   1333         if (LocaleCompare("treedepth",option+1) == 0)
   1334           {
   1335             quantize_info->tree_depth=0;
   1336             if (*option == '+')
   1337               break;
   1338             i++;
   1339             if (i == (ssize_t) argc)
   1340               ThrowAnimateException(OptionError,"MissingArgument",option);
   1341             if (IsGeometry(argv[i]) == MagickFalse)
   1342               ThrowAnimateInvalidArgumentException(option,argv[i]);
   1343             quantize_info->tree_depth=StringToUnsignedLong(argv[i]);
   1344             break;
   1345           }
   1346         if (LocaleCompare("trim",option+1) == 0)
   1347           break;
   1348         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
   1349       }
   1350       case 'v':
   1351       {
   1352         if (LocaleCompare("verbose",option+1) == 0)
   1353           break;
   1354         if ((LocaleCompare("version",option+1) == 0) ||
   1355             (LocaleCompare("-version",option+1) == 0))
   1356           {
   1357             ListMagickVersion(stdout);
   1358             break;
   1359           }
   1360         if (LocaleCompare("virtual-pixel",option+1) == 0)
   1361           {
   1362             ssize_t
   1363               method;
   1364 
   1365             if (*option == '+')
   1366               break;
   1367             i++;
   1368             if (i == (ssize_t) argc)
   1369               ThrowAnimateException(OptionError,"MissingArgument",option);
   1370             method=ParseCommandOption(MagickVirtualPixelOptions,MagickFalse,
   1371               argv[i]);
   1372             if (method < 0)
   1373               ThrowAnimateException(OptionError,
   1374                 "UnrecognizedVirtualPixelMethod",argv[i]);
   1375             break;
   1376           }
   1377         if (LocaleCompare("visual",option+1) == 0)
   1378           {
   1379             resource_info.visual_type=(char *) NULL;
   1380             if (*option == '+')
   1381               break;
   1382             i++;
   1383             if (i == (ssize_t) argc)
   1384               ThrowAnimateException(OptionError,"MissingArgument",option);
   1385             resource_info.visual_type=argv[i];
   1386             break;
   1387           }
   1388         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
   1389       }
   1390       case 'w':
   1391       {
   1392         if (LocaleCompare("window",option+1) == 0)
   1393           {
   1394             resource_info.window_id=(char *) NULL;
   1395             if (*option == '+')
   1396               break;
   1397             i++;
   1398             if (i == (ssize_t) argc)
   1399               ThrowAnimateException(OptionError,"MissingArgument",option);
   1400             resource_info.window_id=argv[i];
   1401             break;
   1402           }
   1403         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
   1404       }
   1405       case '?':
   1406         break;
   1407       default:
   1408         ThrowAnimateException(OptionError,"UnrecognizedOption",option);
   1409     }
   1410     fire=(GetCommandOptionFlags(MagickCommandOptions,MagickFalse,option) &
   1411       FireOptionFlag) == 0 ?  MagickFalse : MagickTrue;
   1412     if (fire != MagickFalse)
   1413       FireImageStack(MagickFalse,MagickTrue,MagickTrue);
   1414   }
   1415   i--;
   1416   if (k != 0)
   1417     ThrowAnimateException(OptionError,"UnbalancedParenthesis",argv[i]);
   1418   if (image == (Image *) NULL)
   1419     ThrowAnimateException(OptionError,"MissingAnImageFilename",argv[argc-1])
   1420   FinalizeImageSettings(image_info,image,MagickTrue);
   1421   if (image == (Image *) NULL)
   1422     ThrowAnimateException(OptionError,"MissingAnImageFilename",argv[argc-1])
   1423   if (resource_info.window_id != (char *) NULL)
   1424     {
   1425       XAnimateBackgroundImage(display,&resource_info,image,exception);
   1426       status&=MagickTrue;
   1427     }
   1428   else
   1429     {
   1430       Image
   1431         *animate_image;
   1432 
   1433       /*
   1434         Animate image to X server.
   1435       */
   1436       animate_image=XAnimateImages(display,&resource_info,argv,argc,image,
   1437         exception);
   1438       while (animate_image != (Image *) NULL)
   1439       {
   1440         image=animate_image;
   1441         animate_image=XAnimateImages(display,&resource_info,argv,argc,image,
   1442           exception);
   1443         if (animate_image != image)
   1444           image=DestroyImageList(image);
   1445       }
   1446     }
   1447   DestroyAnimate();
   1448   return(status != 0 ? MagickTrue : MagickFalse);
   1449 #else
   1450   (void) argc;
   1451   (void) argv;
   1452   (void) ThrowMagickException(exception,GetMagickModule(),MissingDelegateError,
   1453     "DelegateLibrarySupportNotBuiltIn","'%s' (X11)",image_info->filename);
   1454   return(AnimateUsage());
   1455 #endif
   1456 }
   1457