PageRenderTime 786ms CodeModel.GetById 122ms app.highlight 505ms RepoModel.GetById 138ms app.codeStats 8ms

/plugins/ImageMagick-6.3.2/wand/composite.c

https://bitbucket.org/sisko/operation-caribou
C | 1431 lines | 1282 code | 48 blank | 101 comment | 560 complexity | 248682652419e179636736a321ac46ba MD5 | raw file

Large files files are truncated, but you can click here to view the full file

   1/*
   2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3%                                                                             %
   4%                                                                             %
   5%                                                                             %
   6%        CCCC   OOO  M   M  PPPP    OOO   SSSSS  IIIII  TTTTT  EEEEE          %
   7%       C      O   O MM MM  P   P  O   O  SS       I      T    E              %
   8%       C      O   O M M M  PPPP   O   O   SSS     I      T    EEE            %
   9%       C      O   O M   M  P      O   O     SS    I      T    E              %
  10%        CCCC   OOO  M   M  P       OOO   SSSSS  IIIII    T    EEEEE          %
  11%                                                                             %
  12%                                                                             %
  13%                    ImageMagick Image Composite Methods                      %
  14%                                                                             %
  15%                              Software Design                                %
  16%                                John Cristy                                  %
  17%                                 July 1992                                   %
  18%                                                                             %
  19%                                                                             %
  20%  Copyright 1999-2006 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%
  37%
  38*/
  39
  40/*
  41  Include declarations.
  42*/
  43#include "wand/studio.h"
  44#include "wand/MagickWand.h"
  45#include "wand/mogrify-private.h"
  46
  47/*
  48  Typedef declarations.
  49*/
  50typedef struct _CompositeOptions
  51{
  52  ChannelType
  53    channel;
  54
  55  char
  56    *blend_geometry,
  57    *displace_geometry,
  58    *dissolve_geometry,
  59    *geometry,
  60    *unsharp_geometry,
  61    *watermark_geometry;
  62
  63  CompositeOperator
  64    compose;
  65
  66  GravityType
  67    gravity;
  68
  69  long
  70    stegano;
  71
  72  MagickBooleanType
  73    stereo,
  74    tile;
  75} CompositeOptions;
  76
  77/*
  78%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  79%                                                                             %
  80%                                                                             %
  81%                                                                             %
  82%  C o m p o s i t e I m a g e C o m m a n d                                  %
  83%                                                                             %
  84%                                                                             %
  85%                                                                             %
  86%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  87%
  88%  CompositeImageCommand() reads one or more images and an optional mask and
  89%  composites them into a new image.
  90%
  91%  The format of the CompositeImageCommand method is:
  92%
  93%      MagickBooleanType CompositeImageCommand(ImageInfo *image_info,int argc,
  94%        char **argv,char **metadata,ExceptionInfo *exception)
  95%
  96%  A description of each parameter follows:
  97%
  98%    o image_info: The image info.
  99%
 100%    o argc: The number of elements in the argument vector.
 101%
 102%    o argv: A text array containing the command line arguments.
 103%
 104%    o metadata: any metadata is returned here.
 105%
 106%    o exception: Return any errors or warnings in this structure.
 107%
 108%
 109*/
 110
 111static MagickBooleanType CompositeImageList(ImageInfo *image_info,Image **image,
 112  Image *composite_image,CompositeOptions *option_info,ExceptionInfo *exception)
 113{
 114  MagickStatusType
 115    status;
 116
 117  assert(image_info != (ImageInfo *) NULL);
 118  assert(image_info->signature == MagickSignature);
 119  assert(image != (Image **) NULL);
 120  assert((*image)->signature == MagickSignature);
 121  if ((*image)->debug != MagickFalse)
 122    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",(*image)->filename);
 123  assert(exception != (ExceptionInfo *) NULL);
 124  status=MagickTrue;
 125  if (composite_image != (Image *) NULL)
 126    {
 127      assert(composite_image->signature == MagickSignature);
 128      if (option_info->compose == BlendCompositeOp)
 129        (void) CloneString(&composite_image->geometry,
 130          option_info->blend_geometry);
 131      if (option_info->compose == DisplaceCompositeOp)
 132        (void) CloneString(&composite_image->geometry,
 133          option_info->displace_geometry);
 134      if (option_info->compose == DissolveCompositeOp)
 135        (void) CloneString(&composite_image->geometry,
 136          option_info->dissolve_geometry);
 137      if (option_info->compose == ModulateCompositeOp)
 138        (void) CloneString(&composite_image->geometry,
 139          option_info->watermark_geometry);
 140      if (option_info->compose == ThresholdCompositeOp)
 141        (void) CloneString(&composite_image->geometry,
 142          option_info->unsharp_geometry);
 143      /*
 144        Composite image.
 145      */
 146      if (option_info->stegano != 0)
 147        {
 148          Image
 149            *stegano_image;
 150
 151          (*image)->offset=option_info->stegano-1;
 152          stegano_image=SteganoImage(*image,composite_image,exception);
 153          if (stegano_image != (Image *) NULL)
 154            {
 155              *image=DestroyImageList(*image);
 156              *image=stegano_image;
 157            }
 158        }
 159      else
 160        if (option_info->stereo != MagickFalse)
 161          {
 162            Image
 163              *stereo_image;
 164
 165            stereo_image=StereoImage(*image,composite_image,exception);
 166            if (stereo_image != (Image *) NULL)
 167              {
 168                *image=DestroyImageList(*image);
 169                *image=stereo_image;
 170              }
 171          }
 172        else
 173          if (option_info->tile != MagickFalse)
 174            {
 175              long
 176                x,
 177                y;
 178
 179              unsigned long
 180                columns;
 181
 182              /*
 183                Tile the composite image.
 184              */
 185              (void) SetImageProperty(composite_image,
 186                "[modify-outside-overlay]","false");
 187              columns=composite_image->columns;
 188              for (y=0; y < (long) (*image)->rows; y+=composite_image->rows)
 189                for (x=0; x < (long) (*image)->columns; x+=columns)
 190                  status&=CompositeImageChannel(*image,option_info->channel,
 191                    option_info->compose,composite_image,x,y);
 192              GetImageException(*image,exception);
 193            }
 194          else
 195            {
 196              char
 197                composite_geometry[MaxTextExtent];
 198
 199              RectangleInfo
 200                geometry;
 201
 202              /*
 203                Digitally composite image.
 204              */
 205              SetGeometry(*image,&geometry);
 206              (void) ParseAbsoluteGeometry(option_info->geometry,&geometry);
 207              (void) FormatMagickString(composite_geometry,MaxTextExtent,
 208                "%lux%lu%+ld%+ld",composite_image->columns,
 209                composite_image->rows,geometry.x,geometry.y);
 210              (*image)->gravity=(GravityType) option_info->gravity;
 211              (void) ParseGravityGeometry(*image,composite_geometry,&geometry);
 212              status&=CompositeImageChannel(*image,option_info->channel,
 213                option_info->compose,composite_image,geometry.x,geometry.y);
 214              GetImageException(*image,exception);
 215            }
 216    }
 217  return(status != 0 ? MagickTrue : MagickFalse);
 218}
 219
 220static void CompositeUsage(void)
 221{
 222  const char
 223    **p;
 224
 225  static const char
 226    *operators[]=
 227    {
 228      "-blend geometry      blend images",
 229      "-colors value        preferred number of colors in the image",
 230      "-displace geometry   shift image pixels defined by a displacement map",
 231      "-dissolve value      dissolve the two images a given percent",
 232      "-extract geometry    extract area from image",
 233      "-geometry geometry   location of the composite image",
 234      "-help                print program options",
 235      "-identify            identify the format and characteristics of the image",
 236      "-monochrome          transform image to black and white",
 237      "-negate              replace every pixel with its complementary color ",
 238      "-profile filename    add ICM or IPTC information profile to image",
 239      "-quantize colorspace reduce colors in this colorspace",
 240      "-repage geometry     size and location of an image canvas (operator)",
 241      "-rotate degrees      apply Paeth rotation to the image",
 242      "-resize geometry     resize the image",
 243      "-sharpen geometry    sharpen the image",
 244      "-stegano offset      hide watermark within an image",
 245      "-stereo              combine two image to create a stereo anaglyph",
 246      "-strip               strip image of all profiles and comments",
 247      "-thumbnail geometry  create a thumbnail of the image",
 248      "-transform           affine transform image",
 249      "-type type           image type",
 250      "-unsharp geometry    sharpen the image",
 251      "-version             print version information",
 252      "-watermark geometry  percent brightness and saturation of a watermark",
 253      "-write filename      write images to this file",
 254      (char *) NULL
 255    },
 256    *settings[]=
 257    {
 258      "-affine matrix       affine transform matrix",
 259      "-authenticate value  decrypt image with this password",
 260      "-blue-primary point  chromaticity blue primary point",
 261      "-channel type        apply option to select image channels",
 262      "-colorspace type     alternate image colorspace",
 263      "-comment string      annotate image with comment",
 264      "-compose operator    composite operator",
 265      "-compress type       type of pixel compression when writing the image",
 266      "-debug events        display copious debugging information",
 267      "-define format:option",
 268      "                     define one or more image format options",
 269      "-depth value         image depth",
 270      "-density geometry    horizontal and vertical density of the image",
 271      "-display server      get image or font from this X server",
 272      "-dispose method      GIF disposal method",
 273      "-dither              apply Floyd/Steinberg error diffusion to image",
 274      "-encoding type       text encoding type",
 275      "-endian type         endianness (MSB or LSB) of the image",
 276      "-filter type         use this filter when resizing an image",
 277      "-font name           render text with this font",
 278      "-format \"string\"     output formatted image characteristics",
 279      "-gravity type        which direction to gravitate towards",
 280      "-green-primary point chromaticity green primary point",
 281      "-interlace type      type of image interlacing scheme",
 282      "-interpolate method  pixel color interpolation method",
 283      "-label string        assign a label to an image",
 284      "-limit type value    pixel cache resource limit",
 285      "-log format          format of debugging information",
 286      "-matte               store matte channel if the image has one",
 287      "-monitor             monitor progress",
 288      "-page geometry       size and location of an image canvas (setting)",
 289      "-quality value       JPEG/MIFF/PNG compression level",
 290      "-quiet               suppress all error or warning messages",
 291      "-red-primary point   chromaticity red primary point",
 292      "-regard-warnings     pay attention to warning messages",
 293      "-sampling-factor geometry",
 294      "                     horizontal and vertical sampling factor",
 295      "-scene value         image scene number",
 296      "-size geometry       width and height of image",
 297      "-support factor      resize support: > 1.0 is blurry, < 1.0 is sharp",
 298      "-transparent-color color",
 299      "                     transparent color",
 300      "-treedepth value     color tree depth",
 301      "-tile                repeat composite operation across and down image",
 302      "-units type          the units of image resolution",
 303      "-verbose             print detailed information about the image",
 304      "-virtual-pixel method",
 305      "                     virtual pixel access method",
 306      "-white-point point   chromaticity white point",
 307      (char *) NULL
 308    };
 309
 310  (void) printf("Version: %s\n",GetMagickVersion((unsigned long *) NULL));
 311  (void) printf("Copyright: %s\n\n",GetMagickCopyright());
 312  (void) printf("Usage: %s [options ...] image [options ...] composite\n"
 313    "  [ [options ...] mask ] [options ...] composite\n",
 314    GetClientName());
 315  (void) printf("\nImage Settings:\n");
 316  for (p=settings; *p != (char *) NULL; p++)
 317    (void) printf("  %s\n",*p);
 318  (void) printf("\nImage Operators:\n");
 319  for (p=operators; *p != (char *) NULL; p++)
 320    (void) printf("  %s\n",*p);
 321  (void) printf(
 322    "\nBy default, the image format of `file' is determined by its magic\n");
 323  (void) printf(
 324    "number.  To specify a particular image format, precede the filename\n");
 325  (void) printf(
 326    "with an image format name and a colon (i.e. ps:image) or specify the\n");
 327  (void) printf(
 328    "image type as the filename suffix (i.e. image.ps).  Specify 'file' as\n");
 329  (void) printf("'-' for standard input or output.\n");
 330  exit(0);
 331}
 332
 333static void RelinquishCompositeOptions(CompositeOptions *option_info)
 334{
 335  if (option_info->blend_geometry != (char *) NULL)
 336    option_info->blend_geometry=(char *)
 337      RelinquishMagickMemory(option_info->blend_geometry);
 338  if (option_info->displace_geometry != (char *) NULL)
 339    option_info->displace_geometry=(char *)
 340      RelinquishMagickMemory(option_info->displace_geometry);
 341  if (option_info->dissolve_geometry != (char *) NULL)
 342    option_info->dissolve_geometry=(char *)
 343      RelinquishMagickMemory(option_info->dissolve_geometry);
 344  if (option_info->geometry != (char *) NULL)
 345    option_info->geometry=(char *)
 346      RelinquishMagickMemory(option_info->geometry);
 347  if (option_info->unsharp_geometry != (char *) NULL)
 348    option_info->unsharp_geometry=(char *)
 349      RelinquishMagickMemory(option_info->unsharp_geometry);
 350  if (option_info->watermark_geometry != (char *) NULL)
 351    option_info->watermark_geometry=(char *)
 352      RelinquishMagickMemory(option_info->watermark_geometry);
 353}
 354
 355WandExport MagickBooleanType CompositeImageCommand(ImageInfo *image_info,
 356  int argc,char **argv,char **metadata,ExceptionInfo *exception)
 357{
 358#define NotInitialized  (unsigned int) (~0)
 359#define DestroyComposite() \
 360{ \
 361  RelinquishCompositeOptions(&option_info); \
 362  for ( ; k >= 0; k--) \
 363    image_stack[k]=DestroyImageList(image_stack[k]); \
 364  for (i=0; i < (long) argc; i++) \
 365    argv[i]=(char *) RelinquishMagickMemory(argv[i]); \
 366  argv=(char **) RelinquishMagickMemory(argv); \
 367}
 368#define ThrowCompositeException(asperity,tag,option) \
 369{ \
 370  (void) ThrowMagickException(exception,GetMagickModule(),asperity,tag,"`%s'", \
 371    option); \
 372  DestroyComposite(); \
 373  return(MagickFalse); \
 374}
 375#define ThrowCompositeInvalidArgumentException(option,argument) \
 376{ \
 377  (void) ThrowMagickException(exception,GetMagickModule(),OptionError, \
 378    "InvalidArgument","`%s': %s",argument,option); \
 379  DestroyComposite(); \
 380  return(MagickFalse); \
 381}
 382
 383  char
 384    *filename,
 385    *option;
 386
 387  CompositeOptions
 388    option_info;
 389
 390  const char
 391    *format;
 392
 393  Image
 394    *composite_image,
 395    *image,
 396    *image_stack[MaxImageStackDepth+1],
 397    *mask_image;
 398
 399  MagickBooleanType
 400    fire,
 401    pend;
 402
 403  MagickStatusType
 404    status;
 405
 406  long
 407    j,
 408    k;
 409
 410  register long
 411    i;
 412
 413  /*
 414    Set default.
 415  */
 416  assert(image_info != (ImageInfo *) NULL);
 417  assert(image_info->signature == MagickSignature);
 418  if (image_info->debug != MagickFalse)
 419    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
 420  assert(exception != (ExceptionInfo *) NULL);
 421  if (argc < 4)
 422    CompositeUsage();
 423  (void) ResetMagickMemory(&option_info,0,sizeof(CompositeOptions));
 424  option_info.compose=OverCompositeOp;
 425  filename=(char *) NULL;
 426  format="%w,%h,%m";
 427  j=1;
 428  k=0;
 429  image_stack[k]=NewImageList();
 430  option=(char *) NULL;
 431  pend=MagickFalse;
 432  status=MagickTrue;
 433  /*
 434    Check command syntax.
 435  */
 436  composite_image=NewImageList();
 437  image=NewImageList();
 438  mask_image=NewImageList();
 439  ReadCommandlLine(argc,&argv);
 440  status=ExpandFilenames(&argc,&argv);
 441  if (status == MagickFalse)
 442    {
 443      char
 444        *message;
 445
 446      message=GetExceptionMessage(errno);
 447      ThrowCompositeException(ResourceLimitError,"MemoryAllocationFailed",
 448        message);
 449      message=(char *) RelinquishMagickMemory(message);
 450    }
 451  for (i=1; i < (long) (argc-1); i++)
 452  {
 453    option=argv[i];
 454    if (LocaleCompare(option,"(") == 0)
 455      {
 456        if (k == MaxImageStackDepth)
 457          ThrowCompositeException(OptionError,"ParenthesisNestedTooDeeply",
 458            option);
 459        MogrifyImageStack(image_stack[k],MagickTrue,pend);
 460        k++;
 461        image_stack[k]=NewImageList();
 462        continue;
 463      }
 464    if (LocaleCompare(option,")") == 0)
 465      {
 466        if (k == 0)
 467          ThrowCompositeException(OptionError,"UnableToParseExpression",option);
 468        if (image_stack[k] != (Image *) NULL)
 469          {
 470            MogrifyImageStack(image_stack[k],MagickTrue,MagickTrue);
 471            AppendImageToList(&image_stack[k-1],image_stack[k]);
 472          }
 473        k--;
 474        continue;
 475      }
 476    if (IsMagickOption(option) == MagickFalse)
 477      {
 478        Image
 479          *image;
 480
 481        /*
 482          Read input image.
 483        */
 484        MogrifyImageStack(image_stack[k],MagickTrue,pend);
 485        filename=argv[i];
 486        if ((LocaleCompare(filename,"--") == 0) && (i < (argc-1)))
 487          filename=argv[++i];
 488        (void) CopyMagickString(image_info->filename,filename,MaxTextExtent);
 489        image=ReadImage(image_info,exception);
 490        status&=(image != (Image *) NULL) &&
 491          (exception->severity < ErrorException);
 492        if (image == (Image *) NULL)
 493          continue;
 494        AppendImageToList(&image_stack[k],image);
 495        continue;
 496      }
 497    pend=image_stack[k] != (Image *) NULL ? MagickTrue : MagickFalse;
 498    switch (*(option+1))
 499    {
 500      case 'a':
 501      {
 502        if (LocaleCompare("affine",option+1) == 0)
 503          {
 504            if (*option == '+')
 505              break;
 506            i++;
 507            if (i == (long) argc)
 508              ThrowCompositeException(OptionError,"MissingArgument",option);
 509            if (IsGeometry(argv[i]) == MagickFalse)
 510              ThrowCompositeInvalidArgumentException(option,argv[i]);
 511            break;
 512          }
 513        if (LocaleCompare("authenticate",option+1) == 0)
 514          {
 515            if (*option == '+')
 516              break;
 517            i++;
 518            if (i == (long) argc)
 519              ThrowCompositeException(OptionError,"MissingArgument",option);
 520            break;
 521          }
 522        ThrowCompositeException(OptionError,"UnrecognizedOption",option)
 523      }
 524      case 'b':
 525      {
 526        if (LocaleCompare("background",option+1) == 0)
 527          {
 528            if (*option == '+')
 529              break;
 530            i++;
 531            if (i == (long) argc)
 532              ThrowCompositeException(OptionError,"MissingArgument",option);
 533            break;
 534          }
 535        if (LocaleCompare("blend",option+1) == 0)
 536          {
 537            (void) CloneString(&option_info.blend_geometry,(char *) NULL);
 538            if (*option == '+')
 539              break;
 540            i++;
 541            if (i == (long) argc)
 542              ThrowCompositeException(OptionError,"MissingArgument",option);
 543            if (IsGeometry(argv[i]) == MagickFalse)
 544              ThrowCompositeInvalidArgumentException(option,argv[i]);
 545            (void) CloneString(&option_info.blend_geometry,argv[i]);
 546            option_info.compose=BlendCompositeOp;
 547            break;
 548          }
 549        if (LocaleCompare("blue-primary",option+1) == 0)
 550          {
 551            if (*option == '+')
 552              break;
 553            i++;
 554            if (i == (long) argc)
 555              ThrowCompositeException(OptionError,"MissingArgument",option);
 556            if (IsGeometry(argv[i]) == MagickFalse)
 557              ThrowCompositeInvalidArgumentException(option,argv[i]);
 558            break;
 559          }
 560        ThrowCompositeException(OptionError,"UnrecognizedOption",option)
 561      }
 562      case 'c':
 563      {
 564        if (LocaleCompare("cache",option+1) == 0)
 565          {
 566            if (*option == '+')
 567              break;
 568            i++;
 569            if (i == (long) argc)
 570              ThrowCompositeException(OptionError,"MissingArgument",option);
 571            if (IsGeometry(argv[i]) == MagickFalse)
 572              ThrowCompositeInvalidArgumentException(option,argv[i]);
 573            break;
 574          }
 575        if (LocaleCompare("channel",option+1) == 0)
 576          {
 577            long
 578              channel;
 579
 580            if (*option == '+')
 581              {
 582                option_info.channel=DefaultChannels;
 583                break;
 584              }
 585            i++;
 586            if (i == (long) (argc-1))
 587              ThrowCompositeException(OptionError,"MissingArgument",option);
 588            channel=ParseChannelOption(argv[i]);
 589            if (channel < 0)
 590              ThrowCompositeException(OptionError,"UnrecognizedChannelType",
 591                argv[i]);
 592            option_info.channel=(ChannelType) channel;
 593            break;
 594          }
 595        if (LocaleCompare("colors",option+1) == 0)
 596          {
 597            if (*option == '+')
 598              break;
 599            i++;
 600            if (i == (long) argc)
 601              ThrowCompositeException(OptionError,"MissingArgument",option);
 602            if (IsGeometry(argv[i]) == MagickFalse)
 603              ThrowCompositeInvalidArgumentException(option,argv[i]);
 604            break;
 605          }
 606        if (LocaleCompare("colorspace",option+1) == 0)
 607          {
 608            long
 609              colorspace;
 610
 611            if (*option == '+')
 612              break;
 613            i++;
 614            if (i == (long) argc)
 615              ThrowCompositeException(OptionError,"MissingArgument",option);
 616            colorspace=ParseMagickOption(MagickColorspaceOptions,
 617              MagickFalse,argv[i]);
 618            if (colorspace < 0)
 619              ThrowCompositeException(OptionError,"UnrecognizedColorspace",
 620                argv[i]);
 621            break;
 622          }
 623        if (LocaleCompare("comment",option+1) == 0)
 624          {
 625            if (*option == '+')
 626              break;
 627            i++;
 628            if (i == (long) argc)
 629              ThrowCompositeException(OptionError,"MissingArgument",option);
 630            break;
 631          }
 632        if (LocaleCompare("compose",option+1) == 0)
 633          {
 634            long
 635              compose;
 636
 637            option_info.compose=UndefinedCompositeOp;
 638            if (*option == '+')
 639              break;
 640            i++;
 641            if (i == (long) argc)
 642              ThrowCompositeException(OptionError,"MissingArgument",option);
 643            compose=ParseMagickOption(MagickCompositeOptions,MagickFalse,
 644              argv[i]);
 645            if (compose < 0)
 646              ThrowCompositeException(OptionError,
 647                "UnrecognizedComposeOperator",argv[i]);
 648            option_info.compose=(CompositeOperator) compose;
 649            break;
 650          }
 651        if (LocaleCompare("compress",option+1) == 0)
 652          {
 653            long
 654              compression;
 655
 656            if (*option == '+')
 657              break;
 658            i++;
 659            if (i == (long) argc)
 660              ThrowCompositeException(OptionError,"MissingArgument",option);
 661            compression=ParseMagickOption(MagickCompressionOptions,
 662              MagickFalse,argv[i]);
 663            if (compression < 0)
 664              ThrowCompositeException(OptionError,
 665                "UnrecognizedImageCompression",argv[i]);
 666            break;
 667          }
 668        ThrowCompositeException(OptionError,"UnrecognizedOption",option)
 669      }
 670      case 'd':
 671      {
 672        if (LocaleCompare("debug",option+1) == 0)
 673          {
 674            long
 675              event;
 676
 677            if (*option == '+')
 678              break;
 679            i++;
 680            if (i == (long) argc)
 681              ThrowCompositeException(OptionError,"MissingArgument",option);
 682            event=ParseMagickOption(MagickLogEventOptions,MagickFalse,argv[i]);
 683            if (event < 0)
 684              ThrowCompositeException(OptionError,"UnrecognizedEventType",
 685                argv[i]);
 686            (void) SetLogEventMask(argv[i]);
 687            break;
 688          }
 689        if (LocaleCompare("define",option+1) == 0)
 690          {
 691            i++;
 692            if (i == (long) argc)
 693              ThrowCompositeException(OptionError,"MissingArgument",option);
 694            if (*option == '+')
 695              {
 696                const char
 697                  *define;
 698
 699                define=GetImageOption(image_info,argv[i]);
 700                if (define == (const char *) NULL)
 701                  ThrowCompositeException(OptionError,"NoSuchOption",argv[i]);
 702                break;
 703              }
 704            break;
 705          }
 706        if (LocaleCompare("density",option+1) == 0)
 707          {
 708            if (*option == '+')
 709              break;
 710            i++;
 711            if (i == (long) argc)
 712              ThrowCompositeException(OptionError,"MissingArgument",option);
 713            if (IsGeometry(argv[i]) == MagickFalse)
 714              ThrowCompositeInvalidArgumentException(option,argv[i]);
 715            break;
 716          }
 717        if (LocaleCompare("depth",option+1) == 0)
 718          {
 719            if (*option == '+')
 720              break;
 721            i++;
 722            if (i == (long) argc)
 723              ThrowCompositeException(OptionError,"MissingArgument",option);
 724            if (IsGeometry(argv[i]) == MagickFalse)
 725              ThrowCompositeInvalidArgumentException(option,argv[i]);
 726            break;
 727          }
 728        if (LocaleCompare("displace",option+1) == 0)
 729          {
 730            (void) CloneString(&option_info.displace_geometry,(char *) NULL);
 731            if (*option == '+')
 732              break;
 733            i++;
 734            if (i == (long) argc)
 735              ThrowCompositeException(OptionError,"MissingArgument",option);
 736            if (IsGeometry(argv[i]) == MagickFalse)
 737              ThrowCompositeInvalidArgumentException(option,argv[i]);
 738            (void) CloneString(&option_info.displace_geometry,argv[i]);
 739            option_info.compose=DisplaceCompositeOp;
 740            break;
 741          }
 742        if (LocaleCompare("display",option+1) == 0)
 743          {
 744            if (*option == '+')
 745              break;
 746            i++;
 747            if (i == (long) argc)
 748              ThrowCompositeException(OptionError,"MissingArgument",option);
 749            break;
 750          }
 751        if (LocaleCompare("dispose",option+1) == 0)
 752          {
 753            long
 754              dispose;
 755
 756            if (*option == '+')
 757              break;
 758            i++;
 759            if (i == (long) argc)
 760              ThrowCompositeException(OptionError,"MissingArgument",option);
 761            dispose=ParseMagickOption(MagickDisposeOptions,MagickFalse,argv[i]);
 762            if (dispose < 0)
 763              ThrowCompositeException(OptionError,"UnrecognizedDisposeMethod",
 764                argv[i]);
 765            break;
 766          }
 767        if (LocaleCompare("dissolve",option+1) == 0)
 768          {
 769            (void) CloneString(&option_info.dissolve_geometry,(char *) NULL);
 770            if (*option == '+')
 771              break;
 772            i++;
 773            if (i == (long) argc)
 774              ThrowCompositeException(OptionError,"MissingArgument",option);
 775            if (IsGeometry(argv[i]) == MagickFalse)
 776              ThrowCompositeInvalidArgumentException(option,argv[i]);
 777            (void) CloneString(&option_info.dissolve_geometry,argv[i]);
 778            option_info.compose=DissolveCompositeOp;
 779            break;
 780          }
 781        if (LocaleCompare("dither",option+1) == 0)
 782          break;
 783        ThrowCompositeException(OptionError,"UnrecognizedOption",option)
 784      }
 785      case 'e':
 786      {
 787        if (LocaleCompare("encoding",option+1) == 0)
 788          {
 789            if (*option == '+')
 790              break;
 791            i++;
 792            if (i == (long) argc)
 793              ThrowCompositeException(OptionError,"MissingArgument",option);
 794            break;
 795          }
 796        if (LocaleCompare("endian",option+1) == 0)
 797          {
 798            long
 799              endian;
 800
 801            if (*option == '+')
 802              break;
 803            i++;
 804            if (i == (long) argc)
 805              ThrowCompositeException(OptionError,"MissingArgument",option);
 806            endian=ParseMagickOption(MagickEndianOptions,MagickFalse,
 807              argv[i]);
 808            if (endian < 0)
 809              ThrowCompositeException(OptionError,"UnrecognizedEndianType",
 810                argv[i]);
 811            break;
 812          }
 813        if (LocaleCompare("extract",option+1) == 0)
 814          {
 815            if (*option == '+')
 816              break;
 817            i++;
 818            if (i == (long) argc)
 819              ThrowCompositeException(OptionError,"MissingArgument",option);
 820            if (IsGeometry(argv[i]) == MagickFalse)
 821              ThrowCompositeInvalidArgumentException(option,argv[i]);
 822            break;
 823          }
 824        ThrowCompositeException(OptionError,"UnrecognizedOption",option)
 825      }
 826      case 'f':
 827      {
 828        if (LocaleCompare("filter",option+1) == 0)
 829          {
 830            long
 831              filter;
 832
 833            if (*option == '+')
 834              break;
 835            i++;
 836            if (i == (long) argc)
 837              ThrowCompositeException(OptionError,"MissingArgument",option);
 838            filter=ParseMagickOption(MagickFilterOptions,MagickFalse,
 839              argv[i]);
 840            if (filter < 0)
 841              ThrowCompositeException(OptionError,"UnrecognizedImageFilter",
 842                argv[i]);
 843            break;
 844          }
 845        if (LocaleCompare("font",option+1) == 0)
 846          {
 847            if (*option == '+')
 848              break;
 849            i++;
 850            if (i == (long) argc)
 851              ThrowCompositeException(OptionError,"MissingArgument",option);
 852            break;
 853          }
 854        if (LocaleCompare("format",option+1) == 0)
 855          {
 856            if (*option == '+')
 857              break;
 858            i++;
 859            if (i == (long) argc)
 860              ThrowCompositeException(OptionError,"MissingArgument",option);
 861            format=argv[i];
 862            break;
 863          }
 864        ThrowCompositeException(OptionError,"UnrecognizedOption",option)
 865      }
 866      case 'g':
 867      {
 868        if (LocaleCompare("geometry",option+1) == 0)
 869          {
 870            (void) CloneString(&option_info.geometry,(char *) NULL);
 871            if (*option == '+')
 872              break;
 873            i++;
 874            if (i == (long) argc)
 875              ThrowCompositeException(OptionError,"MissingArgument",option);
 876            if (IsGeometry(argv[i]) == MagickFalse)
 877              ThrowCompositeInvalidArgumentException(option,argv[i]);
 878            (void) CloneString(&option_info.geometry,argv[i]);
 879            break;
 880          }
 881        if (LocaleCompare("gravity",option+1) == 0)
 882          {
 883            long
 884              gravity;
 885
 886            option_info.gravity=UndefinedGravity;
 887            if (*option == '+')
 888              break;
 889            i++;
 890            if (i == (long) argc)
 891              ThrowCompositeException(OptionError,"MissingArgument",option);
 892            gravity=ParseMagickOption(MagickGravityOptions,MagickFalse,
 893              argv[i]);
 894            if (gravity < 0)
 895              ThrowCompositeException(OptionError,"UnrecognizedGravityType",
 896                argv[i]);
 897            option_info.gravity=(GravityType) gravity;
 898            break;
 899          }
 900        if (LocaleCompare("green-primary",option+1) == 0)
 901          {
 902            if (*option == '+')
 903              break;
 904            i++;
 905            if (i == (long) argc)
 906              ThrowCompositeException(OptionError,"MissingArgument",option);
 907            if (IsGeometry(argv[i]) == MagickFalse)
 908              ThrowCompositeInvalidArgumentException(option,argv[i]);
 909            break;
 910          }
 911        ThrowCompositeException(OptionError,"UnrecognizedOption",option)
 912      }
 913      case 'h':
 914      {
 915        if ((LocaleCompare("help",option+1) == 0) ||
 916            (LocaleCompare("-help",option+1) == 0))
 917          CompositeUsage();
 918        ThrowCompositeException(OptionError,"UnrecognizedOption",option)
 919      }
 920      case 'i':
 921      {
 922        if (LocaleCompare("identify",option+1) == 0)
 923          break;
 924        if (LocaleCompare("interlace",option+1) == 0)
 925          {
 926            long
 927              interlace;
 928
 929            if (*option == '+')
 930              break;
 931            i++;
 932            if (i == (long) argc)
 933              ThrowCompositeException(OptionError,"MissingArgument",option);
 934            interlace=ParseMagickOption(MagickInterlaceOptions,MagickFalse,
 935              argv[i]);
 936            if (interlace < 0)
 937              ThrowCompositeException(OptionError,
 938                "UnrecognizedInterlaceType",argv[i]);
 939            break;
 940          }
 941        if (LocaleCompare("interpolate",option+1) == 0)
 942          {
 943            long
 944              interpolate;
 945
 946            if (*option == '+')
 947              break;
 948            i++;
 949            if (i == (long) argc)
 950              ThrowCompositeException(OptionError,"MissingArgument",option);
 951            interpolate=ParseMagickOption(MagickInterpolateOptions,MagickFalse,
 952              argv[i]);
 953            if (interpolate < 0)
 954              ThrowCompositeException(OptionError,
 955                "UnrecognizedInterpolateMethod",argv[i]);
 956            break;
 957          }
 958        ThrowCompositeException(OptionError,"UnrecognizedOption",option)
 959      }
 960      case 'l':
 961      {
 962        if (LocaleCompare("label",option+1) == 0)
 963          {
 964            if (*option == '+')
 965              break;
 966            i++;
 967            if (i == (long) argc)
 968              ThrowCompositeException(OptionError,"MissingArgument",option);
 969            break;
 970          }
 971        if (LocaleCompare("limit",option+1) == 0)
 972          {
 973            long
 974              resource;
 975
 976            if (*option == '+')
 977              break;
 978            i++;
 979            if (i == (long) argc)
 980              ThrowCompositeException(OptionError,"MissingArgument",option);
 981            resource=ParseMagickOption(MagickResourceOptions,MagickFalse,
 982              argv[i]);
 983            if (resource < 0)
 984              ThrowCompositeException(OptionError,"UnrecognizedResourceType",
 985                argv[i]);
 986            i++;
 987            if (i == (long) argc)
 988              ThrowCompositeException(OptionError,"MissingArgument",option);
 989            if ((LocaleCompare("unlimited",argv[i]) != 0) &&
 990                (IsGeometry(argv[i]) == MagickFalse))
 991              ThrowCompositeInvalidArgumentException(option,argv[i]);
 992            break;
 993          }
 994        if (LocaleCompare("log",option+1) == 0)
 995          {
 996            if (*option == '+')
 997              break;
 998            i++;
 999            if ((i == (long) argc) || (strchr(argv[i],'%') == (char *) NULL))
1000              ThrowCompositeException(OptionError,"MissingArgument",option);
1001            break;
1002          }
1003        ThrowCompositeException(OptionError,"UnrecognizedOption",option)
1004      }
1005      case 'm':
1006      {
1007        if (LocaleCompare("matte",option+1) == 0)
1008          break;
1009        if (LocaleCompare("monitor",option+1) == 0)
1010          break;
1011        if (LocaleCompare("monochrome",option+1) == 0)
1012          break;
1013        ThrowCompositeException(OptionError,"UnrecognizedOption",option)
1014      }
1015      case 'n':
1016      {
1017        if (LocaleCompare("negate",option+1) == 0)
1018          break;
1019        if (LocaleCompare("noop",option+1) == 0)
1020          break;
1021        ThrowCompositeException(OptionError,"UnrecognizedOption",option)
1022      }
1023      case 'p':
1024      {
1025        if (LocaleCompare("page",option+1) == 0)
1026          {
1027            if (*option == '+')
1028              break;
1029            i++;
1030            if (i == (long) argc)
1031              ThrowCompositeException(OptionError,"MissingArgument",option);
1032            break;
1033          }
1034        if (LocaleCompare("process",option+1) == 0)
1035          {
1036            if (*option == '+')
1037              break;
1038            i++;
1039            if (i == (long) argc)
1040              ThrowCompositeException(OptionError,"MissingArgument",option);
1041            break;
1042          }
1043        if (LocaleCompare("profile",option+1) == 0)
1044          {
1045            i++;
1046            if (i == (long) argc)
1047              ThrowCompositeException(OptionError,"MissingArgument",option);
1048            break;
1049          }
1050        ThrowCompositeException(OptionError,"UnrecognizedOption",option)
1051      }
1052      case 'q':
1053      {
1054        if (LocaleCompare("quality",option+1) == 0)
1055          {
1056            if (*option == '+')
1057              break;
1058            i++;
1059            if (i == (long) argc)
1060              ThrowCompositeException(OptionError,"MissingArgument",option);
1061            if (IsGeometry(argv[i]) == MagickFalse)
1062              ThrowCompositeInvalidArgumentException(option,argv[i]);
1063            break;
1064          }
1065        if (LocaleCompare("quantize",option+1) == 0)
1066          {
1067            long
1068              colorspace;
1069
1070            if (*option == '+')
1071              break;
1072            i++;
1073            if (i == (long) (argc-1))
1074              ThrowCompositeException(OptionError,"MissingArgument",option);
1075            colorspace=ParseMagickOption(MagickColorspaceOptions,
1076              MagickFalse,argv[i]);
1077            if (colorspace < 0)
1078              ThrowCompositeException(OptionError,"UnrecognizedColorspace",
1079                argv[i]);
1080            break;
1081          }
1082        if (LocaleCompare("quiet",option+1) == 0)
1083          break;
1084        ThrowCompositeException(OptionError,"UnrecognizedOption",option)
1085      }
1086      case 'r':
1087      {
1088        if (LocaleCompare("red-primary",option+1) == 0)
1089          {
1090            if (*option == '+')
1091              break;
1092            i++;
1093            if (i == (long) argc)
1094              ThrowCompositeException(OptionError,"MissingArgument",option);
1095            if (IsGeometry(argv[i]) == MagickFalse)
1096              ThrowCompositeInvalidArgumentException(option,argv[i]);
1097            break;
1098          }
1099        if (LocaleCompare("regard-warnings",option+1) == 0)
1100          break;
1101        if (LocaleCompare("render",option+1) == 0)
1102          break;
1103        if (LocaleCompare("repage",option+1) == 0)
1104          {
1105            if (*option == '+')
1106              break;
1107            i++;
1108            if (i == (long) argc)
1109              ThrowCompositeException(OptionError,"MissingArgument",option);
1110            if (IsGeometry(argv[i]) == MagickFalse)
1111              ThrowCompositeInvalidArgumentException(option,argv[i]);
1112            break;
1113          }
1114        if (LocaleCompare("resize",option+1) == 0)
1115          {
1116            if (*option == '+')
1117              break;
1118            i++;
1119            if (i == (long) argc)
1120              ThrowCompositeException(OptionError,"MissingArgument",option);
1121            if (IsGeometry(argv[i]) == MagickFalse)
1122              ThrowCompositeInvalidArgumentException(option,argv[i]);
1123            break;
1124          }
1125        if (LocaleCompare("rotate",option+1) == 0)
1126          {
1127            i++;
1128            if (i == (long) argc)
1129              ThrowCompositeException(OptionError,"MissingArgument",option);
1130            if (IsGeometry(argv[i]) == MagickFalse)
1131              ThrowCompositeInvalidArgumentException(option,argv[i]);
1132            break;
1133          }
1134        ThrowCompositeException(OptionError,"UnrecognizedOption",option)
1135      }
1136      case 's':
1137      {
1138        if (LocaleCompare("sampling-factor",option+1) == 0)
1139          {
1140            if (*option == '+')
1141              break;
1142            i++;
1143            if (i == (long) argc)
1144              ThrowCompositeException(OptionError,"MissingArgument",option);
1145            if (IsGeometry(argv[i]) == MagickFalse)
1146              ThrowCompositeInvalidArgumentException(option,argv[i]);
1147            break;
1148          }
1149        if (LocaleCompare("scene",option+1) == 0)
1150          {
1151            if (*option == '+')
1152              break;
1153            i++;
1154            if (i == (long) argc)
1155              ThrowCompositeException(OptionError,"MissingArgument",option);
1156            if (IsGeometry(argv[i]) == MagickFalse)
1157              ThrowCompositeInvalidArgumentException(option,argv[i]);
1158            break;
1159          }
1160        if (LocaleCompare("sharpen",option+1) == 0)
1161          {
1162            i++;
1163            if (i == (long) argc)
1164              ThrowCompositeException(OptionError,"MissingArgument",option);
1165            if (IsGeometry(argv[i]) == MagickFalse)
1166              ThrowCompositeInvalidArgumentException(option,argv[i]);
1167            break;
1168          }
1169        if (LocaleCompare("size",option+1) == 0)
1170          {
1171            if (*option == '+')
1172              break;
1173            i++;
1174            if (i == (long) argc)
1175              ThrowCompositeException(OptionError,"MissingArgument",option);
1176            if (IsGeometry(argv[i]) == MagickFalse)
1177              ThrowCompositeInvalidArgumentException(option,argv[i]);
1178            break;
1179          }
1180        if (LocaleCompare("stegano",option+1) == 0)
1181          {
1182            option_info.stegano=0;
1183            if (*option == '+')
1184              break;
1185            i++;
1186            if (i == (long) argc)
1187              ThrowCompositeException(OptionError,"MissingArgument",option);
1188            if (IsGeometry(argv[i]) == MagickFalse)
1189              ThrowCompositeInvalidArgumentException(option,argv[i]);
1190            option_info.stegano=atol(argv[i])+1;
1191            break;
1192          }
1193        if (LocaleCompare("stereo",option+1) == 0)
1194          {
1195            option_info.stereo=(*option == '-') ? MagickTrue : MagickFalse;
1196            break;
1197          }
1198        if (LocaleCompare("strip",option+1) == 0)
1199          break;
1200        if (LocaleCompare("support",option+1) == 0)
1201          {
1202            if (*option == '+')
1203              break;
1204            i++;
1205            if (i == (long) argc)
1206              ThrowCompositeException(OptionError,"MissingArgument",option);
1207            if (IsGeometry(argv[i]) == MagickFalse)
1208              ThrowCompositeInvalidArgumentException(option,argv[i]);
1209            break;
1210          }
1211        ThrowCompositeException(OptionError,"UnrecognizedOption",option)
1212      }
1213      case 't':
1214      {
1215        if (LocaleCompare("thumbnail",option+1) == 0)
1216          {
1217            if (*option == '+')
1218              break;
1219            i++;
1220            if (i == (long) argc)
1221              ThrowCompositeException(OptionError,"MissingArgument",option);
1222            if (IsGeometry(argv[i]) == MagickFalse)
1223              ThrowCompositeInvalidArgumentException(option,argv[i]);
1224            break;
1225          }
1226        if (LocaleCompare("tile",option+1) == 0)
1227          {
1228            option_info.tile=(*option == '-') ? MagickTrue : MagickFalse;
1229            (void) CopyMagickString(argv[i]+1,"sans0",MaxTextExtent);
1230            break;
1231          }
1232        if (LocaleCompare("transform",option+1) == 0)
1233          break;
1234        if (LocaleCompare("transparent-color",option+1) == 0)
1235          {
1236            if (*option == '+')
1237              break;
1238            i++;
1239            if (i == (long) (argc-1))
1240              ThrowCompositeException(OptionError,"MissingArgument",option);
1241            break;
1242          }
1243        if (LocaleCompare("treedepth",option+1) == 0)
1244          {
1245            if (*option == '+')
1246              break;
1247            i++;
1248            if (i == (long) argc)
1249              ThrowCompositeException(OptionError,"MissingArgument",option);
1250            if (IsGeometry(argv[i]) == MagickFalse)
1251              ThrowCompositeInvalidArgumentException(option,argv[i]);
1252            break;
1253          }
1254        if (LocaleCompare("type",option+1) == 0)
1255          {
1256            long
1257              type;
1258
1259            if (*option == '+')
1260              break;
1261            i++;
1262            if (i == (long) argc)
1263              ThrowCompositeException(OptionError,"MissingArgument",option);
1264            type=ParseMagickOption(MagickImageOptions,MagickFalse,argv[i]);
1265            if (type < 0)
1266              ThrowCompositeException(OptionError,"UnrecognizedImageType",
1267                argv[i]);
1268            break;
1269          }
1270        ThrowCompositeException(OptionError,"UnrecognizedOption",option)
1271      }
1272      case 'u':
1273      {
1274        if (LocaleCompare("units",option+1) == 0)
1275          {
1276            long
1277              units;
1278
1279            if (*option == '+')
1280              break;
1281            i++;
1282            if (i == (long) argc)
1283              ThrowCompositeException(OptionError,"MissingArgument",option);
1284            units=ParseMagickOption(MagickResolutionOptions,MagickFalse,
1285              argv[i]);
1286            if (units < 0)
1287              ThrowCompositeException(OptionError,"UnrecognizedUnitsType",
1288                argv[i]);
1289            break;
1290          }
1291        if (LocaleCompare("unsharp",option+1) == 0)
1292          {
1293            (void) CloneString(&option_info.unsharp_geometry,(char *) NULL);
1294            if (*option == '+')
1295              break;
1296            i++;
1297            if (i == (long) argc)
1298              ThrowCompositeException(OptionError,"MissingArgument",option);
1299            if (IsGeometry(argv[i]) == MagickFalse)
1300              ThrowCompositeInvalidArgumentException(option,argv[i]);
1301            (void) CloneString(&option_info.unsharp_geometry,argv[i]);
1302            option_info.compose=ThresholdCompositeOp;
1303            break;
1304          }
1305        ThrowCompositeException(OptionError,"UnrecognizedOption",option)
1306      }
1307      case 'v':
1308      {
1309        if (LocaleCompare("verbose",option+1) == 0)
1310          break;
1311        if ((LocaleCompare("version",option+1) == 0) ||
1312            (LocaleCompare("-version",option+1) == 0))
1313          break;
1314        if (LocaleCompare("virtual-pixel",option+1) == 0)
1315          {
1316            long
1317              method;
1318
1319            if (*option == '+')
1320              break;
1321            i++;
1322            if (i == (long) argc)
1323              ThrowCompositeException(OptionError,"MissingArgument",option);
1324            method=ParseMagickOption(MagickVirtualPixelOptions,MagickFalse,
1325              argv[i]);
1326            if (method < 0)
1327              ThrowCompositeException(OptionError,
1328                "UnrecognizedVirtualPixelMethod",argv[i]);
1329            break;
1330          }
1331        ThrowCompositeException(OptionError,"UnrecognizedOption",option)
1332      }
1333      case 'w':
1334      {
1335        if (LocaleCompare("watermark",option+1) == 0)
1336          {
1337            (void) CloneString(&option_info.watermark_geometry,(char *) NULL);
1338            if (*option == '+')
1339              break;
1340            i++;
1341            if (i == (long) argc)
1342              ThrowCompositeException(OptionError,"MissingArgument",option);
1343            if (IsGeometry(argv[i]) == MagickFalse)
1344              ThrowCompositeInvalidArgumentException(option,argv[i]);
1345            (void) CloneString(&option_info.watermark_geometry,argv[i]);
1346            option_info.compose=ModulateCompositeOp;
1347            break;
1348          }
1349        if (LocaleCompare("white-point",option+1) == 0)
1350          {
1351            if (*option == '+')
1352              break;
1353            i++;
1354            if (i == (long) argc)
1355              ThrowCompositeException(OptionError,"MissingArgument",option);
1356            if (IsGeometry(argv[i]) == MagickFalse)
1357              ThrowCompositeInvalidArgumentException(option,argv[i]);
1358            break;
1359          }
1360        if (LocaleCompare("write",option+1) == 0)
1361          {
1362            i++;
1363            if (i == (long) argc)
1364              ThrowCompositeException(OptionError,"MissingArgument",option);
1365            break;
1366          }
1367        ThrowCompositeException(OptionError,"UnrecognizedOption",option)
1368      }
1369      case '?':
1370        break;
1371      default:
1372        ThrowCompositeException(OptionError,"UnrecognizedOption",option)
1373    }
1374    fire=(MagickBooleanType) ParseMagickOption(MagickMogrifyOptions,
1375      MagickFalse,option+1);
1376    if (fire == MagickTrue)
1377      MogrifyImageStack(image_stack[k],MagickTrue,MagickTrue);
1378  }
1379  if (k != 0)
1380    ThrowCompositeException(OptionError,"UnbalancedParenthesis",argv[i]);
1381  if (i-- != (long) (argc-1))
1382    ThrowCompositeException(OptionError,"MissingAnImageFilename",argv[i]);
1383  if ((image_stack[k] == (Image *) NULL) ||
1384      (GetImageListLength(image_stack[k]) < 2))
1385    ThrowCompositeException(OptionError,"MissingAnImageFilename",argv[argc-1]);
1386  MogrifyImageStack(image_stack[k],MagickTrue,MagickTrue);
1387  /*
1388    Composite images.
1389  */
1390  composite_image=RemoveFirstImageFromList(image_stack+k);
1391  image=RemoveFirstImageFromList(image_stack+k);
1392  (void) TransformImage(&composite_image,(char *) NULL,
1393    composite_image->geometry);
1394  mask_image=RemoveFirstImageFromList(image_stack+k);
1395  if (mask_image != (Image *) NULL)
1396    {
1397      image->mask=mask_image;
1398      (void) NegateImage(image->mask,MagickFalse);
1399    }
1400  sta

Large files files are truncated, but you can click here to view the full file