PageRenderTime 574ms CodeModel.GetById 182ms app.highlight 307ms RepoModel.GetById 35ms app.codeStats 3ms

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

https://bitbucket.org/sisko/operation-caribou
C | 6683 lines | 5890 code | 235 blank | 558 comment | 2356 complexity | 86a449ee3127915f3d6a0808fc5a0ece MD5 | raw file

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

   1/*
   2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   3%                                                                             %
   4%                                                                             %
   5%                                                                             %
   6%              M   M   OOO   GGGGG  RRRR   IIIII  FFFFF  Y   Y                %
   7%              MM MM  O   O  G      R   R    I    F       Y Y                 %
   8%              M M M  O   O  G GGG  RRRR     I    FFF      Y                  %
   9%              M   M  O   O  G   G  R R      I    F        Y                  %
  10%              M   M   OOO   GGGG   R  R   IIIII  F        Y                  %
  11%                                                                             %
  12%                                                                             %
  13%                        ImageMagick Module Methods                           %
  14%                                                                             %
  15%                              Software Design                                %
  16%                                John Cristy                                  %
  17%                                March 2000                                   %
  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  Define declarations.
  49*/
  50#define ThrowWandFatalException(severity,tag,context) \
  51{ \
  52  ExceptionInfo \
  53    exception; \
  54 \
  55  GetExceptionInfo(&exception); \
  56  (void) ThrowMagickException(&exception,GetMagickModule(),severity,tag, \
  57    "`%s'",context); \
  58  CatchException(&exception); \
  59  (void) DestroyExceptionInfo(&exception); \
  60}
  61#define UndefinedCompressionQuality  0UL
  62
  63/*
  64  Constant declaration.
  65*/
  66static const char
  67  *BackgroundColor = "#fff",  /* white */
  68  *BorderColor = "#dfdfdf",  /* gray */
  69  *MatteColor = "#bdbdbd";  /* gray */
  70
  71/*
  72%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  73%                                                                             %
  74%                                                                             %
  75%                                                                             %
  76+     M o g r i f y I m a g e                                                 %
  77%                                                                             %
  78%                                                                             %
  79%                                                                             %
  80%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  81%
  82%  MogrifyImage() applies image processing options to an image as prescribed
  83%  by command line options.
  84%
  85%  The format of the MogrifyImage method is:
  86%
  87%      MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
  88%        const char **argv,Image **image)
  89%
  90%  A description of each parameter follows:
  91%
  92%    o image_info: The image info..
  93%
  94%    o argc: Specifies a pointer to an integer describing the number of
  95%      elements in the argument vector.
  96%
  97%    o argv: Specifies a pointer to a text array containing the command line
  98%      arguments.
  99%
 100%    o image: The image.
 101%
 102%    o exception: Return any errors or warnings in this structure.
 103%
 104*/
 105
 106static inline long MagickMax(const long x,const long y)
 107{
 108  if (x > y)
 109    return(x);
 110  return(y);
 111}
 112
 113static MagickBooleanType MonitorProgress(const char *tag,
 114  const MagickOffsetType quantum,const MagickSizeType span,
 115  void *wand_unused(client_data))
 116{
 117  char
 118    message[MaxTextExtent];
 119
 120  const char
 121    *locale_message;
 122
 123  if (span < 2)
 124    return(MagickTrue);
 125  (void) FormatMagickString(message,MaxTextExtent,"Monitor/%s",tag);
 126  locale_message=GetLocaleMessage(message);
 127  if (locale_message == message)
 128    locale_message=tag;
 129  (void) fprintf(stdout,"%s: %02ld%%\r",locale_message,(long)
 130    (100L*quantum/(span-1)));
 131  if ((MagickSizeType) quantum == (span-1))
 132    (void) fprintf(stdout,"\n");
 133  (void) fflush(stdout);
 134  return(MagickTrue);
 135}
 136
 137WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
 138  const char **argv,Image **image,ExceptionInfo *exception)
 139{
 140  ChannelType
 141    channel;
 142
 143  const char
 144    *format,
 145    *option;
 146
 147  DrawInfo
 148    *draw_info;
 149
 150  GeometryInfo
 151    geometry_info;
 152
 153  Image
 154    *region_image;
 155
 156  long
 157    count;
 158
 159  MagickBooleanType
 160    status;
 161
 162  MagickPixelPacket
 163    fill;
 164
 165  MagickStatusType
 166    flags;
 167
 168  QuantizeInfo
 169    *quantize_info;
 170
 171  RectangleInfo
 172    geometry,
 173    region_geometry;
 174
 175  register long
 176    i;
 177
 178  /*
 179    Initialize method variables.
 180  */
 181  assert(image_info != (const ImageInfo *) NULL);
 182  assert(image_info->signature == MagickSignature);
 183  assert(image != (Image **) NULL);
 184  assert((*image)->signature == MagickSignature);
 185  if ((*image)->debug != MagickFalse)
 186    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",(*image)->filename);
 187  if (argc < 0)
 188    return(MagickTrue);
 189  for (i=0; i < (long) argc; i++)
 190    if (strlen(argv[i]) > (MaxTextExtent/2-1))
 191      ThrowWandFatalException(OptionFatalError,"OptionLengthExceedsLimit",
 192        argv[i]);
 193  draw_info=CloneDrawInfo(image_info,(DrawInfo *) NULL);
 194  quantize_info=AcquireQuantizeInfo(image_info);
 195  SetGeometryInfo(&geometry_info);
 196  channel=image_info->channel;
 197  GetMagickPixelPacket(*image,&fill);
 198  SetMagickPixelPacket(&(*image)->background_color,(IndexPacket *) NULL,&fill);
 199  format=GetImageOption(image_info,"format");
 200  SetGeometry(*image,&region_geometry);
 201  region_image=NewImageList();
 202  /*
 203    Transmogrify the image.
 204  */
 205  for (i=0; i < (long) argc; i++)
 206  {
 207    option=argv[i];
 208    if (IsMagickOption(option) == MagickFalse)
 209      continue;
 210    count=MagickMax(ParseMagickOption(MagickCommandOptions,MagickFalse,option),
 211      0L);
 212    if ((i+count) >= argc)
 213      break;
 214    status=MogrifyImageInfo(image_info,count+1,argv+i,exception);
 215    switch (*(option+1))
 216    {
 217      case 'a':
 218      {
 219        if (LocaleCompare("adaptive-blur",option+1) == 0)
 220          {
 221            Image
 222              *blur_image;
 223
 224            /*
 225              Blur image.
 226            */
 227            flags=ParseGeometry(argv[i+1],&geometry_info);
 228            if ((flags & SigmaValue) == 0)
 229              geometry_info.sigma=1.0;
 230            blur_image=AdaptiveBlurImageChannel(*image,channel,
 231              geometry_info.rho,geometry_info.sigma,exception);
 232            if (blur_image == (Image *) NULL)
 233              break;
 234            InheritException(&blur_image->exception,exception);
 235            *image=DestroyImage(*image);
 236            *image=blur_image;
 237            break;
 238          }
 239        if (LocaleCompare("adaptive-resize",option+1) == 0)
 240          {
 241            Image
 242              *resize_image;
 243
 244            /*
 245              Resize image.
 246            */
 247            (void) ParseSizeGeometry(*image,argv[i+1],&geometry);
 248            resize_image=AdaptiveResizeImage(*image,geometry.width,
 249              geometry.height,exception);
 250            if (resize_image == (Image *) NULL)
 251              break;
 252            InheritException(&resize_image->exception,exception);
 253            *image=DestroyImage(*image);
 254            *image=resize_image;
 255            break;
 256          }
 257        if (LocaleCompare("adaptive-sharpen",option+1) == 0)
 258          {
 259            Image
 260              *sharp_image;
 261
 262            /*
 263              Sharpen image.
 264            */
 265            flags=ParseGeometry(argv[i+1],&geometry_info);
 266            if ((flags & SigmaValue) == 0)
 267              geometry_info.sigma=1.0;
 268            sharp_image=AdaptiveSharpenImageChannel(*image,channel,
 269              geometry_info.rho,geometry_info.sigma,exception);
 270            if (sharp_image == (Image *) NULL)
 271              break;
 272            InheritException(&sharp_image->exception,exception);
 273            *image=DestroyImage(*image);
 274            *image=sharp_image;
 275            break;
 276          }
 277        if (LocaleCompare("affine",option+1) == 0)
 278          {
 279            /*
 280              Affine matrix.
 281            */
 282            if (*option == '+')
 283              {
 284                GetAffineMatrix(&draw_info->affine);
 285                break;
 286              }
 287            (void) ParseAffineGeometry(argv[i+1],&draw_info->affine);
 288            break;
 289          }
 290        if (LocaleCompare("annotate",option+1) == 0)
 291          {
 292            char
 293              geometry[MaxTextExtent];
 294
 295            /*
 296              Annotate image.
 297            */
 298            SetGeometryInfo(&geometry_info);
 299            flags=ParseGeometry(argv[i+1],&geometry_info);
 300            if ((flags & SigmaValue) == 0)
 301              geometry_info.sigma=geometry_info.rho;
 302            (void) CloneString(&draw_info->text,InterpretImageProperties(
 303              image_info,*image,argv[i+2]));
 304            (void) FormatMagickString(geometry,MaxTextExtent,"%+f%+f",
 305              geometry_info.xi,geometry_info.psi);
 306            (void) CloneString(&draw_info->geometry,geometry);
 307            draw_info->affine.sx=cos(DegreesToRadians(
 308              fmod(geometry_info.rho,360.0)));
 309            draw_info->affine.rx=sin(DegreesToRadians(
 310              fmod(geometry_info.rho,360.0)));
 311            draw_info->affine.ry=(-sin(DegreesToRadians(
 312              fmod(geometry_info.sigma,360.0))));
 313            draw_info->affine.sy=cos(DegreesToRadians(
 314              fmod(geometry_info.sigma,360.0)));
 315            (void) AnnotateImage(*image,draw_info);
 316            break;
 317          }
 318        if (LocaleCompare("antialias",option+1) == 0)
 319          {
 320            draw_info->stroke_antialias=(*option == '-') ? MagickTrue :
 321              MagickFalse;
 322            draw_info->text_antialias=(*option == '-') ? MagickTrue :
 323              MagickFalse;
 324            break;
 325          }
 326        if (LocaleCompare("auto-orient",option+1) == 0)
 327          {
 328            Image
 329              *orient_image;
 330
 331            orient_image=NewImageList();
 332            switch ((*image)->orientation)
 333            {
 334              case TopRightOrientation:
 335              {
 336                orient_image=FlopImage(*image,exception);
 337                break;
 338              }
 339              case BottomRightOrientation:
 340              {
 341                orient_image=RotateImage(*image,180.0,exception);
 342                break;
 343              }
 344              case BottomLeftOrientation:
 345              {
 346                orient_image=FlipImage(*image,exception);
 347                break;
 348              }
 349              case LeftTopOrientation:
 350              {
 351                orient_image=TransposeImage(*image,exception);
 352                break;
 353              }
 354              case RightTopOrientation:
 355              {
 356                orient_image=RotateImage(*image,90.0,exception);
 357                break;
 358              }
 359              case RightBottomOrientation:
 360              {
 361                orient_image=TransverseImage(*image,exception);
 362                break;
 363              }
 364              case LeftBottomOrientation:
 365              {
 366                orient_image=RotateImage(*image,270.0,exception);
 367                break;
 368              }
 369              default:
 370                break;
 371            }
 372            if (orient_image == (Image *) NULL)
 373              break;
 374            InheritException(&orient_image->exception,exception);
 375            *image=DestroyImage(*image);
 376            *image=orient_image;
 377            break;
 378          }
 379        break;
 380      }
 381      case 'b':
 382      {
 383        if (LocaleCompare("background",option+1) == 0)
 384          {
 385            if (*option == '+')
 386              {
 387                (void) QueryColorDatabase(BackgroundColor,
 388                  &(*image)->background_color,exception);
 389                break;
 390              }
 391            (void) QueryColorDatabase(argv[i+1],&(*image)->background_color,
 392              exception);
 393            break;
 394          }
 395        if (LocaleCompare("bias",option+1) == 0)
 396          {
 397            (*image)->bias=StringToDouble(argv[i+1],QuantumRange);
 398            break;
 399          }
 400        if (LocaleCompare("black-threshold",option+1) == 0)
 401          {
 402            /*
 403              Threshold black image.
 404            */
 405            (void) BlackThresholdImage(*image,argv[i+1]);
 406            break;
 407          }
 408        if (LocaleCompare("black-point-compensation",option+1) == 0)
 409          {
 410            (*image)->black_point_compensation=(*option == '-') ? MagickTrue :
 411              MagickFalse;
 412            break;
 413          }
 414        if (LocaleCompare("blue-primary",option+1) == 0)
 415          {
 416            /*
 417              Blue chromaticity primary point.
 418            */
 419            if (*option == '+')
 420              {
 421                (*image)->chromaticity.blue_primary.x=0.0;
 422                (*image)->chromaticity.blue_primary.y=0.0;
 423                break;
 424              }
 425            flags=ParseGeometry(argv[i+1],&geometry_info);
 426            (*image)->chromaticity.blue_primary.x=geometry_info.rho;
 427            (*image)->chromaticity.blue_primary.y=geometry_info.sigma;
 428            if ((flags & SigmaValue) == 0)
 429              (*image)->chromaticity.blue_primary.y=
 430                (*image)->chromaticity.blue_primary.x;
 431            break;
 432          }
 433        if (LocaleCompare("blur",option+1) == 0)
 434          {
 435            Image
 436              *blur_image;
 437
 438            /*
 439              Gaussian blur image.
 440            */
 441            flags=ParseGeometry(argv[i+1],&geometry_info);
 442            if ((flags & SigmaValue) == 0)
 443              geometry_info.sigma=1.0;
 444            blur_image=BlurImageChannel(*image,channel,
 445              geometry_info.rho,geometry_info.sigma,exception);
 446            if (blur_image == (Image *) NULL)
 447              break;
 448            InheritException(&blur_image->exception,exception);
 449            *image=DestroyImage(*image);
 450            *image=blur_image;
 451            break;
 452          }
 453        if (LocaleCompare("border",option+1) == 0)
 454          {
 455            Image
 456              *border_image;
 457
 458            /*
 459              Surround image with a border of solid color.
 460            */
 461            flags=ParsePageGeometry(*image,argv[i+1],&geometry);
 462            if ((flags & SigmaValue) == 0)
 463              geometry.height=geometry.width;
 464            border_image=BorderImage(*image,&geometry,exception);
 465            if (border_image == (Image *) NULL)
 466              break;
 467            InheritException(&border_image->exception,exception);
 468            *image=DestroyImage(*image);
 469            *image=border_image;
 470            break;
 471          }
 472        if (LocaleCompare("bordercolor",option+1) == 0)
 473          {
 474            if (*option == '+')
 475              {
 476                (void) QueryColorDatabase(BorderColor,&(*image)->border_color,
 477                  exception);
 478                draw_info->border_color=(*image)->border_color;
 479                break;
 480              }
 481            (void) QueryColorDatabase(argv[i+1],&(*image)->border_color,
 482              exception);
 483            draw_info->border_color=(*image)->border_color;
 484            break;
 485          }
 486        if (LocaleCompare("box",option+1) == 0)
 487          {
 488            (void) QueryColorDatabase(argv[i+1],&draw_info->undercolor,
 489              exception);
 490            break;
 491          }
 492        break;
 493      }
 494      case 'c':
 495      {
 496        if (LocaleCompare("cache",option+1) == 0)
 497          {
 498            unsigned long
 499              limit;
 500
 501            limit=(~0UL);
 502            if (LocaleCompare("unlimited",argv[i+1]) != 0)
 503              limit=(unsigned long) atol(argv[i+1]);
 504            (void) SetMagickResourceLimit(MemoryResource,limit);
 505            (void) SetMagickResourceLimit(MapResource,2*limit);
 506            break;
 507          }
 508        if (LocaleCompare("channel",option+1) == 0)
 509          {
 510            if (*option == '+')
 511              {
 512                channel=DefaultChannels;
 513                break;
 514              }
 515            channel=(ChannelType) ParseChannelOption(argv[i+1]);
 516            break;
 517          }
 518        if (LocaleCompare("charcoal",option+1) == 0)
 519          {
 520            Image
 521              *charcoal_image;
 522
 523            /*
 524              Charcoal image.
 525            */
 526            flags=ParseGeometry(argv[i+1],&geometry_info);
 527            if ((flags & SigmaValue) == 0)
 528              geometry_info.sigma=1.0;
 529            charcoal_image=CharcoalImage(*image,geometry_info.rho,
 530              geometry_info.sigma,exception);
 531            if (charcoal_image == (Image *) NULL)
 532              break;
 533            InheritException(&charcoal_image->exception,exception);
 534            *image=DestroyImage(*image);
 535            *image=charcoal_image;
 536            break;
 537          }
 538        if (LocaleCompare("chop",option+1) == 0)
 539          {
 540            Image
 541              *chop_image;
 542
 543            /*
 544              Chop the image.
 545            */
 546            (void) ParseGravityGeometry(*image,argv[i+1],&geometry);
 547            chop_image=ChopImage(*image,&geometry,exception);
 548            if (chop_image == (Image *) NULL)
 549              break;
 550            InheritException(&chop_image->exception,exception);
 551            *image=DestroyImage(*image);
 552            *image=chop_image;
 553            break;
 554          }
 555        if (LocaleCompare("clip",option+1) == 0)
 556          {
 557            if (*option == '+')
 558              {
 559                (void) SetImageClipMask(*image,(Image *) NULL);
 560                break;
 561              }
 562            (void) ClipImage(*image);
 563            break;
 564          }
 565        if (LocaleCompare("clip-mask",option+1) == 0)
 566          {
 567            Image
 568              *mask;
 569
 570            ImageInfo
 571              *mask_info;
 572
 573            long
 574              y;
 575
 576            register long
 577              x;
 578
 579            register PixelPacket
 580              *q;
 581
 582            if (*option == '+')
 583              {
 584                /*
 585                  Remove a mask.
 586                */
 587                (void) SetImageMask(*image,(Image *) NULL);
 588                break;
 589              }
 590            /*
 591              Set the image mask.
 592            */
 593            mask_info=CloneImageInfo(image_info);
 594            (void) CopyMagickString(mask_info->filename,argv[i+1],
 595              MaxTextExtent);
 596            mask=ReadImage(mask_info,exception);
 597            CatchException(exception);
 598            mask_info=DestroyImageInfo(mask_info);
 599            if (mask == (Image *) NULL)
 600              break;
 601            for (y=0; y < (long) mask->rows; y++)
 602            {
 603              q=GetImagePixels(mask,0,y,mask->columns,1);
 604              if (q == (PixelPacket *) NULL)
 605                break;
 606              for (x=0; x < (long) mask->columns; x++)
 607              {
 608                if (mask->matte == MagickFalse)
 609                  q->opacity=PixelIntensityToQuantum(q);
 610                q->red=q->opacity;
 611                q->green=q->opacity;
 612                q->blue=q->opacity;
 613                q++;
 614              }
 615              if (SyncImagePixels(mask) == MagickFalse)
 616                break;
 617            }
 618            if (SetImageStorageClass(mask,DirectClass) == MagickFalse)
 619              return(MagickFalse);
 620            mask->matte=MagickTrue;
 621            (void) SetImageClipMask(*image,mask);
 622            break;
 623          }
 624        if (LocaleCompare("clip-path",option+1) == 0)
 625          {
 626            (void) ClipPathImage(*image,argv[i+1],
 627              *option == '-' ? MagickTrue : MagickFalse);
 628            break;
 629          }
 630        if (LocaleCompare("colorize",option+1) == 0)
 631          {
 632            Image
 633              *colorize_image;
 634
 635            /*
 636              Colorize the image.
 637            */
 638            colorize_image=ColorizeImage(*image,argv[i+1],draw_info->fill,
 639              exception);
 640            if (colorize_image == (Image *) NULL)
 641              break;
 642            InheritException(&colorize_image->exception,exception);
 643            *image=DestroyImage(*image);
 644            *image=colorize_image;
 645            break;
 646          }
 647        if (LocaleCompare("colors",option+1) == 0)
 648          {
 649            /*
 650              Reduce the number of colors in the image.
 651            */
 652            quantize_info->number_colors=(unsigned long) atol(argv[i+1]);
 653            if (quantize_info->number_colors == 0)
 654              break;
 655            if (((*image)->storage_class == DirectClass) ||
 656                (*image)->colors > quantize_info->number_colors)
 657              (void) QuantizeImage(quantize_info,*image);
 658            else
 659              CompressImageColormap(*image);
 660            break;
 661          }
 662        if (LocaleCompare("colorspace",option+1) == 0)
 663          {
 664            ColorspaceType
 665              colorspace;
 666
 667            if (*option == '+')
 668              {
 669                (void) SetImageColorspace(*image,RGBColorspace);
 670                break;
 671              }
 672            colorspace=(ColorspaceType) ParseMagickOption(
 673              MagickColorspaceOptions,MagickFalse,argv[i+1]);
 674            (void) SetImageColorspace(*image,colorspace);
 675            break;
 676          }
 677        if (LocaleCompare("compose",option+1) == 0)
 678          {
 679            if (*option == '+')
 680              {
 681                (*image)->compose=OverCompositeOp;
 682                break;
 683              }
 684            (*image)->compose=(CompositeOperator) ParseMagickOption(
 685              MagickCompositeOptions,MagickFalse,argv[i+1]);
 686            break;
 687          }
 688        if (LocaleCompare("compress",option+1) == 0)
 689          {
 690            if (*option == '+')
 691              {
 692                (*image)->compression=UndefinedCompression;
 693                break;
 694              }
 695            (*image)->compression=(CompressionType) ParseMagickOption(
 696              MagickCompressionOptions,MagickFalse,argv[i+1]);
 697            break;
 698          }
 699        if (LocaleCompare("contrast",option+1) == 0)
 700          {
 701            (void) ContrastImage(*image,(*option == '-') ? MagickTrue :
 702              MagickFalse);
 703            break;
 704          }
 705        if (LocaleCompare("contrast-stretch",option+1) == 0)
 706          {
 707            GeometryInfo
 708              geometry_info;
 709
 710            MagickRealType
 711              black_point,
 712              white_point;
 713
 714            MagickStatusType
 715              flags;
 716
 717            /*
 718              Parse levels.
 719            */
 720            flags=ParseGeometry(argv[i+1],&geometry_info);
 721            black_point=geometry_info.rho;
 722            white_point=(MagickRealType) (*image)->columns*(*image)->rows;
 723            if ((flags & SigmaValue) != 0)
 724              white_point=geometry_info.sigma;
 725            if ((flags & PercentValue) != 0)
 726              {
 727                black_point*=(MagickRealType) (*image)->columns*
 728                  (*image)->rows/100.0f;
 729                white_point*=(MagickRealType) (*image)->columns*
 730                  (*image)->rows/100.0f;
 731              }
 732            if ((flags & SigmaValue) == 0)
 733              white_point=(MagickRealType) (*image)->columns*(*image)->rows-
 734                black_point;
 735            (void) ContrastStretchImageChannel(*image,channel,black_point,
 736              white_point);
 737            break;
 738          }
 739        if (LocaleCompare("convolve",option+1) == 0)
 740          {
 741            char
 742              *p,
 743              token[MaxTextExtent];
 744
 745            double
 746              *kernel;
 747
 748            Image
 749              *convolve_image;
 750
 751            register long
 752              x;
 753
 754            unsigned long
 755              order;
 756
 757            /*
 758              Convolve image.
 759            */
 760            p=(char *) argv[i+1];
 761            for (x=0; *p != '\0'; x++)
 762            {
 763              GetMagickToken(p,&p,token);
 764              if (*token == ',')
 765                GetMagickToken(p,&p,token);
 766            }
 767            order=(unsigned long) sqrt((double) x+1.0);
 768            kernel=(double *) AcquireMagickMemory(order*order*sizeof(*kernel));
 769            if (kernel == (double *) NULL)
 770              ThrowWandFatalException(ResourceLimitFatalError,
 771                "MemoryAllocationFailed",(*image)->filename);
 772            p=(char *) argv[i+1];
 773            for (x=0; *p != '\0'; x++)
 774            {
 775              GetMagickToken(p,&p,token);
 776              if (*token == ',')
 777                GetMagickToken(p,&p,token);
 778              kernel[x]=atof(token);
 779            }
 780            for ( ; x < (long) (order*order); x++)
 781              kernel[x]=0.0;
 782            convolve_image=ConvolveImageChannel(*image,channel,order,kernel,
 783              exception);
 784            kernel=(double *) RelinquishMagickMemory(kernel);
 785            if (convolve_image == (Image *) NULL)
 786              break;
 787            InheritException(&convolve_image->exception,exception);
 788            *image=DestroyImage(*image);
 789            *image=convolve_image;
 790            break;
 791          }
 792        if (LocaleCompare("crop",option+1) == 0)
 793          {
 794            if (*option == '+')
 795              break;
 796            break;
 797          }
 798        if (LocaleCompare("cycle",option+1) == 0)
 799          {
 800            /*
 801              Cycle an image colormap.
 802            */
 803            (void) CycleColormapImage(*image,atoi(argv[i+1]));
 804            break;
 805          }
 806        break;
 807      }
 808      case 'd':
 809      {
 810        if (LocaleCompare("debug",option+1) == 0)
 811          {
 812            if (*option == '+')
 813              {
 814                (void) SetLogEventMask("none");
 815                break;
 816              }
 817            (void) SetLogEventMask(argv[i+1]);
 818            break;
 819          }
 820        if (LocaleCompare("density",option+1) == 0)
 821          {
 822            GeometryInfo
 823              geometry_info;
 824
 825            /*
 826              Set image density.
 827            */
 828            (void) CloneString(&draw_info->density,argv[i+1]);
 829            flags=ParseGeometry(argv[i+1],&geometry_info);
 830            (*image)->x_resolution=geometry_info.rho;
 831            (*image)->y_resolution=geometry_info.sigma;
 832            if ((flags & SigmaValue) == 0)
 833              (*image)->y_resolution=(*image)->x_resolution;
 834            break;
 835          }
 836        if (LocaleCompare("despeckle",option+1) == 0)
 837          {
 838            Image
 839              *despeckle_image;
 840
 841            /*
 842              Reduce the speckles within an image.
 843            */
 844            despeckle_image=DespeckleImage(*image,exception);
 845            if (despeckle_image == (Image *) NULL)
 846              break;
 847            InheritException(&despeckle_image->exception,exception);
 848            *image=DestroyImage(*image);
 849            *image=despeckle_image;
 850            break;
 851          }
 852        if (LocaleCompare("display",option+1) == 0)
 853          {
 854            (void) CloneString(&draw_info->server_name,argv[i+1]);
 855            break;
 856          }
 857        if (LocaleCompare("dither",option+1) == 0)
 858          {
 859            quantize_info->dither=(*option == '-') ? MagickTrue : MagickFalse;
 860            break;
 861          }
 862        if (LocaleCompare("draw",option+1) == 0)
 863          {
 864            /*
 865              Draw image.
 866            */
 867            (void) CloneString(&draw_info->primitive,argv[i+1]);
 868            (void) DrawImage(*image,draw_info);
 869            break;
 870          }
 871        break;
 872      }
 873      case 'e':
 874      {
 875        if (LocaleCompare("edge",option+1) == 0)
 876          {
 877            Image
 878              *edge_image;
 879
 880            /*
 881              Enhance edges in the image.
 882            */
 883            flags=ParseGeometry(argv[i+1],&geometry_info);
 884            if ((flags & SigmaValue) == 0)
 885              geometry_info.sigma=1.0;
 886            edge_image=EdgeImage(*image,geometry_info.rho,exception);
 887            if (edge_image == (Image *) NULL)
 888              break;
 889            InheritException(&edge_image->exception,exception);
 890            *image=DestroyImage(*image);
 891            *image=edge_image;
 892            break;
 893          }
 894        if (LocaleCompare("emboss",option+1) == 0)
 895          {
 896            Image
 897              *emboss_image;
 898
 899            /*
 900              Gaussian embossen image.
 901            */
 902            flags=ParseGeometry(argv[i+1],&geometry_info);
 903            if ((flags & SigmaValue) == 0)
 904              geometry_info.sigma=1.0;
 905            emboss_image=EmbossImage(*image,geometry_info.rho,
 906              geometry_info.sigma,exception);
 907            if (emboss_image == (Image *) NULL)
 908              break;
 909            InheritException(&emboss_image->exception,exception);
 910            *image=DestroyImage(*image);
 911            *image=emboss_image;
 912            break;
 913          }
 914        if (LocaleCompare("encoding",option+1) == 0)
 915          {
 916            (void) CloneString(&draw_info->encoding,argv[i+1]);
 917            break;
 918          }
 919        if (LocaleCompare("endian",option+1) == 0)
 920          {
 921            if (*option == '+')
 922              {
 923                (*image)->endian=LSBEndian;
 924                break;
 925              }
 926            (*image)->endian=(EndianType) ParseMagickOption(MagickEndianOptions,
 927              MagickFalse,argv[i+1]);
 928            break;
 929          }
 930        if (LocaleCompare("enhance",option+1) == 0)
 931          {
 932            Image
 933              *enhance_image;
 934
 935            /*
 936              Enhance image.
 937            */
 938            enhance_image=EnhanceImage(*image,exception);
 939            if (enhance_image == (Image *) NULL)
 940              break;
 941            InheritException(&enhance_image->exception,exception);
 942            *image=DestroyImage(*image);
 943            *image=enhance_image;
 944            break;
 945          }
 946        if (LocaleCompare("equalize",option+1) == 0)
 947          {
 948            /*
 949              Equalize image.
 950            */
 951            (void) EqualizeImage(*image);
 952            break;
 953          }
 954        if (LocaleCompare("evaluate",option+1) == 0)
 955          {
 956            double
 957              constant;
 958
 959            MagickEvaluateOperator
 960              op;
 961
 962            op=(MagickEvaluateOperator) ParseMagickOption(MagickEvaluateOptions,
 963              MagickFalse,argv[i+1]);
 964            constant=StringToDouble(argv[i+2],QuantumRange);
 965            (void) EvaluateImageChannel(*image,channel,op,constant,
 966              exception);
 967            break;
 968          }
 969        if (LocaleCompare("extent",option+1) == 0)
 970          {
 971            Image
 972              *extent_image;
 973
 974            /*
 975              Set the image extent.
 976            */
 977            (void) ParseGravityGeometry(*image,argv[i+1],&geometry);
 978            extent_image=ExtentImage(*image,&geometry,exception);
 979            if (extent_image == (Image *) NULL)
 980              break;
 981            InheritException(&extent_image->exception,exception);
 982            *image=DestroyImage(*image);
 983            *image=extent_image;
 984            break;
 985          }
 986        break;
 987      }
 988      case 'f':
 989      {
 990        if (LocaleCompare("family",option+1) == 0)
 991          {
 992            if (*option == '+')
 993              draw_info->family=(char *) RelinquishMagickMemory(
 994                draw_info->family);
 995           else
 996              (void) CloneString(&draw_info->family,argv[i+1]);
 997            break;
 998          }
 999        if (LocaleCompare("fill",option+1) == 0)
1000          {
1001            ExceptionInfo
1002              *sans;
1003
1004            if (*option == '+')
1005              {
1006                (void) QueryMagickColor("none",&fill,exception);
1007                (void) QueryColorDatabase("none",&draw_info->fill,exception);
1008                break;
1009              }
1010            sans=AcquireExceptionInfo();
1011            (void) QueryMagickColor(argv[i+1],&fill,sans);
1012            status=QueryColorDatabase(argv[i+1],&draw_info->fill,sans);
1013            sans=DestroyExceptionInfo(sans);
1014            if (status == MagickFalse)
1015              draw_info->fill_pattern=ReadImage(image_info,exception);
1016            break;
1017          }
1018        if (LocaleCompare("filter",option+1) == 0)
1019          {
1020            if (*option == '+')
1021              {
1022                (*image)->filter=UndefinedFilter;
1023                break;
1024              }
1025            (*image)->filter=(FilterTypes) ParseMagickOption(
1026              MagickFilterOptions,MagickFalse,argv[i+1]);
1027            break;
1028          }
1029        if (LocaleCompare("flip",option+1) == 0)
1030          {
1031            Image
1032              *flip_image;
1033
1034            /*
1035              Flip image scanlines.
1036            */
1037            flip_image=FlipImage(*image,exception);
1038            if (flip_image == (Image *) NULL)
1039              break;
1040            InheritException(&flip_image->exception,exception);
1041            *image=DestroyImage(*image);
1042            *image=flip_image;
1043            break;
1044          }
1045        if (LocaleCompare("flop",option+1) == 0)
1046          {
1047            Image
1048              *flop_image;
1049
1050            /*
1051              Flop image scanlines.
1052            */
1053            flop_image=FlopImage(*image,exception);
1054            if (flop_image == (Image *) NULL)
1055              break;
1056            InheritException(&flop_image->exception,exception);
1057            *image=DestroyImage(*image);
1058            *image=flop_image;
1059            break;
1060          }
1061        if (LocaleCompare("floodfill",option+1) == 0)
1062          {
1063            PixelPacket
1064              target;
1065
1066            /*
1067              Floodfill image.
1068            */
1069            (void) ParsePageGeometry(*image,argv[i+1],&geometry);
1070            (void) QueryColorDatabase(argv[i+2],&target,exception);
1071            (void) ColorFloodfillImage(*image,draw_info,target,geometry.x,
1072              geometry.y,FloodfillMethod);
1073            break;
1074          }
1075        if (LocaleCompare("font",option+1) == 0)
1076          {
1077            if (*option == '+')
1078              {
1079                draw_info->font=(char *) RelinquishMagickMemory(
1080                  draw_info->font);
1081                break;
1082              }
1083            (void) CloneString(&draw_info->font,argv[i+1]);
1084            break;
1085          }
1086        if (LocaleCompare("format",option+1) == 0)
1087          {
1088            format=argv[i+1];
1089            break;
1090          }
1091        if (LocaleCompare("frame",option+1) == 0)
1092          {
1093            FrameInfo
1094              frame_info;
1095
1096            Image
1097              *frame_image;
1098
1099            /*
1100              Surround image with an ornamental border.
1101            */
1102            (void) ParsePageGeometry(*image,argv[i+1],&geometry);
1103            frame_info.width=geometry.width;
1104            frame_info.height=geometry.height;
1105            frame_info.outer_bevel=geometry.x;
1106            frame_info.inner_bevel=geometry.y;
1107            frame_info.x=(long) frame_info.width;
1108            frame_info.y=(long) frame_info.height;
1109            frame_info.width=(*image)->columns+2*frame_info.width;
1110            frame_info.height=(*image)->rows+2*frame_info.height;
1111            frame_image=FrameImage(*image,&frame_info,exception);
1112            if (frame_image == (Image *) NULL)
1113              break;
1114            InheritException(&frame_image->exception,exception);
1115            *image=DestroyImage(*image);
1116            *image=frame_image;
1117            break;
1118          }
1119        if (LocaleCompare("fuzz",option+1) == 0)
1120          {
1121            if (*option == '+')
1122              {
1123                (*image)->fuzz=0.0;
1124                break;
1125              }
1126            (*image)->fuzz=StringToDouble(argv[i+1],QuantumRange+1.0);
1127            break;
1128          }
1129        break;
1130      }
1131      case 'g':
1132      {
1133        if (LocaleCompare("gamma",option+1) == 0)
1134          {
1135            if (*option == '+')
1136              (*image)->gamma=atof(argv[i+1]);
1137            else
1138              {
1139                if (strchr(argv[i+1],',') != (char *) NULL)
1140                  (void) GammaImage(*image,argv[i+1]);
1141                else
1142                  (void) GammaImageChannel(*image,channel,
1143                    atof(argv[i+1]));
1144              }
1145            break;
1146          }
1147        if ((LocaleCompare("gaussian-blur",option+1) == 0) ||
1148            (LocaleCompare("gaussian",option+1) == 0))
1149          {
1150            Image
1151              *gaussian_image;
1152
1153            /*
1154              Gaussian blur image.
1155            */
1156            flags=ParseGeometry(argv[i+1],&geometry_info);
1157            if ((flags & SigmaValue) == 0)
1158              geometry_info.sigma=1.0;
1159            gaussian_image=GaussianBlurImageChannel(*image,channel,
1160              geometry_info.rho,geometry_info.sigma,exception);
1161            if (gaussian_image == (Image *) NULL)
1162              break;
1163            InheritException(&gaussian_image->exception,exception);
1164            *image=DestroyImage(*image);
1165            *image=gaussian_image;
1166            break;
1167          }
1168        if (LocaleCompare("geometry",option+1) == 0)
1169          {
1170            if (*option == '+')
1171              {
1172                if ((*image)->geometry != (char *) NULL)
1173                  (*image)->geometry=(char *) RelinquishMagickMemory(
1174                    (*image)->geometry);
1175                break;
1176              }
1177            (void) CloneString(&(*image)->geometry,argv[i+1]);
1178            flags=ParseSizeGeometry(*image,argv[i+1],&geometry);
1179            if (((flags & XValue) == 0) && ((flags & YValue) == 0))
1180              {
1181                Image
1182                  *zoom_image;
1183
1184                /*
1185                  Resize image.
1186                */
1187                zoom_image=ZoomImage(*image,geometry.width,geometry.height,
1188                  exception);
1189                if (zoom_image == (Image *) NULL)
1190                  break;
1191                InheritException(&zoom_image->exception,exception);
1192                *image=DestroyImage(*image);
1193                *image=zoom_image;
1194              }
1195            break;
1196          }
1197        if (LocaleCompare("gravity",option+1) == 0)
1198          {
1199            if (*option == '+')
1200              (*image)->gravity=UndefinedGravity;
1201            else
1202              (*image)->gravity=(GravityType) ParseMagickOption(
1203                MagickGravityOptions,MagickFalse,argv[i+1]);
1204            draw_info->gravity=(*image)->gravity;
1205            break;
1206          }
1207        if (LocaleCompare("green-primary",option+1) == 0)
1208          {
1209            /*
1210              Green chromaticity primary point.
1211            */
1212            if (*option == '+')
1213              {
1214                (*image)->chromaticity.green_primary.x=0.0;
1215                (*image)->chromaticity.green_primary.y=0.0;
1216                break;
1217              }
1218            flags=ParseGeometry(argv[i+1],&geometry_info);
1219            (*image)->chromaticity.green_primary.x=geometry_info.rho;
1220            (*image)->chromaticity.green_primary.y=geometry_info.sigma;
1221            if ((flags & SigmaValue) == 0)
1222              (*image)->chromaticity.green_primary.y=
1223                (*image)->chromaticity.green_primary.x;
1224            break;
1225          }
1226        break;
1227      }
1228      case 'i':
1229      {
1230        if (LocaleCompare("identify",option+1) == 0)
1231          {
1232            char
1233              *text;
1234
1235            if (format == (char *) NULL)
1236              {
1237                (void) IdentifyImage(*image,stdout,image_info->verbose);
1238                break;
1239              }
1240            text=InterpretImageProperties(image_info,*image,format);
1241            if (text == (char *) NULL)
1242              break;
1243            (void) fputs(text,stdout);
1244            (void) fputc('\n',stdout);
1245            text=(char *) RelinquishMagickMemory(text);
1246            break;
1247          }
1248        if (LocaleCompare("implode",option+1) == 0)
1249          {
1250            Image
1251              *implode_image;
1252
1253            /*
1254              Implode image.
1255            */
1256            (void) ParseGeometry(argv[i+1],&geometry_info);
1257            implode_image=ImplodeImage(*image,geometry_info.rho,exception);
1258            if (implode_image == (Image *) NULL)
1259              break;
1260            InheritException(&implode_image->exception,exception);
1261            *image=DestroyImage(*image);
1262            *image=implode_image;
1263            break;
1264          }
1265        if (LocaleCompare("intent",option+1) == 0)
1266          {
1267            if (*option == '+')
1268              {
1269                (*image)->rendering_intent=UndefinedIntent;
1270                break;
1271              }
1272            (*image)->rendering_intent=(RenderingIntent) ParseMagickOption(
1273              MagickIntentOptions,MagickFalse,argv[i+1]);
1274            break;
1275          }
1276        if (LocaleCompare("interlace",option+1) == 0)
1277          {
1278            /*
1279              Interlace method.
1280            */
1281            if (*option == '+')
1282              {
1283                (*image)->interlace=UndefinedInterlace;
1284                break;
1285              }
1286            (*image)->interlace=(InterlaceType) ParseMagickOption(
1287              MagickInterlaceOptions,MagickFalse,argv[i+1]);
1288            break;
1289          }
1290        if (LocaleCompare("interpolate",option+1) == 0)
1291          {
1292            /*
1293              Interpolate method.
1294            */
1295            if (*option == '+')
1296              {
1297                (*image)->interpolate=UndefinedInterpolatePixel;
1298                break;
1299              }
1300            (*image)->interpolate=(InterpolatePixelMethod) ParseMagickOption(
1301              MagickInterpolateOptions,MagickFalse,argv[i+1]);
1302            break;
1303          }
1304        break;
1305      }
1306      case 'l':
1307      {
1308        if (LocaleCompare("lat",option+1) == 0)
1309          {
1310            Image
1311              *threshold_image;
1312
1313            /*
1314              Local adaptive threshold image.
1315            */
1316            flags=ParseGeometry(argv[i+1],&geometry_info);
1317            if ((flags & PercentValue) != 0)
1318              geometry_info.xi=QuantumRange*geometry_info.xi/100.0;
1319            threshold_image=AdaptiveThresholdImage(*image,(unsigned long)
1320              geometry_info.rho,(unsigned long) geometry_info.sigma,
1321              (long) geometry_info.xi,exception);
1322            if (threshold_image == (Image *) NULL)
1323              break;
1324            InheritException(&threshold_image->exception,exception);
1325            *image=DestroyImage(*image);
1326            *image=threshold_image;
1327            break;
1328          }
1329        if (LocaleCompare("level",option+1) == 0)
1330          {
1331            GeometryInfo
1332              geometry_info;
1333
1334            MagickRealType
1335              black_point,
1336              gamma,
1337              white_point;
1338
1339            MagickStatusType
1340              flags;
1341
1342            /*
1343              Parse levels.
1344            */
1345            flags=ParseGeometry(argv[i+1],&geometry_info);
1346            black_point=geometry_info.rho;
1347            white_point=(MagickRealType) QuantumRange;
1348            if ((flags & SigmaValue) != 0)
1349              white_point=geometry_info.sigma;
1350            gamma=1.0;
1351            if ((flags & XiValue) != 0)
1352              gamma=geometry_info.xi;
1353            if ((white_point <= 10.0) && (gamma > 10.0))
1354              {
1355                MagickRealType
1356                  swap;
1357
1358                swap=gamma;
1359                gamma=white_point;
1360                white_point=swap;
1361              }
1362            if ((flags & PercentValue) != 0)
1363              {
1364                black_point*=(MagickRealType) (QuantumRange/100.0);
1365                white_point*=(MagickRealType) (QuantumRange/100.0);
1366              }
1367            if ((flags & SigmaValue) == 0)
1368              white_point=(MagickRealType) QuantumRange-black_point;
1369            (void) LevelImageChannel(*image,channel,black_point,white_point,
1370              gamma);
1371            break;
1372          }
1373        if (LocaleCompare("limit",option+1) == 0)
1374          {
1375            ResourceType
1376              type;
1377
1378            unsigned long
1379              limit;
1380
1381            if (*option == '+')
1382              break;
1383            type=(ResourceType) ParseMagickOption(MagickResourceOptions,
1384              MagickFalse,argv[i+1]);
1385            limit=(~0UL);
1386            if (LocaleCompare("unlimited",argv[i+2]) != 0)
1387              limit=(unsigned long) atol(argv[i+2]);
1388            (void) SetMagickResourceLimit(type,limit);
1389            break;
1390          }
1391        if (LocaleCompare("linear-stretch",option+1) == 0)
1392          {
1393            GeometryInfo
1394              geometry_info;
1395
1396            MagickRealType
1397              black_point,
1398              white_point;
1399
1400            MagickStatusType
1401              flags;
1402
1403            /*
1404              Parse levels.
1405            */
1406            flags=ParseGeometry(argv[i+1],&geometry_info);
1407            black_point=geometry_info.rho;
1408            white_point=(MagickRealType) (*image)->columns*(*image)->rows;
1409            if ((flags & SigmaValue) != 0)
1410              white_point=geometry_info.sigma;
1411            if ((flags & PercentValue) != 0)
1412              {
1413                black_point*=(MagickRealType) (*image)->columns*
1414                  (*image)->rows/100.0f;
1415                white_point*=(MagickRealType) (*image)->columns*
1416                  (*image)->rows/100.0f;
1417              }
1418            if ((flags & SigmaValue) == 0)
1419              white_point=(MagickRealType) (*image)->columns*(*image)->rows-
1420                black_point;
1421            (void) LinearStretchImage(*image,black_point,white_point);
1422            break;
1423          }
1424        if (LocaleCompare("linewidth",option+1) == 0)
1425          {
1426            draw_info->stroke_width=atof(argv[i+1]);
1427            break;
1428          }
1429        if (LocaleCompare("loop",option+1) == 0)
1430          {
1431            /*
1432              Set image iterations.
1433            */
1434            (*image)->iterations=(unsigned long) atol(argv[i+1]);
1435            break;
1436          }
1437        break;
1438      }
1439      case 'm':
1440      {
1441        if (LocaleCompare("map",option+1) == 0)
1442          {
1443            Image
1444              *map_image;
1445
1446            ImageInfo
1447              *map_info;
1448
1449            /*
1450              Transform image colors to match this set of colors.
1451            */
1452            if (*option == '+')
1453              break;
1454            map_info=CloneImageInfo(image_info);
1455            (void) CopyMagickString(map_info->filename,argv[i+1],
1456              MaxTextExtent);
1457            map_image=ReadImage(map_info,exception);
1458            map_info=DestroyImageInfo(map_info);
1459            CatchException(exception);
1460            if (map_image == (Image *) NULL)
1461              break;
1462            (void) MapImage(*image,map_image,quantize_info->dither);
1463            map_image=DestroyImage(map_image);
1464            break;
1465          }
1466        if (LocaleCompare("mask",option+1) == 0)
1467          {
1468            Image
1469              *mask;
1470
1471            ImageInfo
1472              *mask_info;
1473
1474            if (*option == '+')
1475              {
1476                /*
1477                  Remove a mask.
1478                */
1479                (void) SetImageMask(*image,(Image *) NULL);
1480                break;
1481              }
1482            /*
1483              Set the image mask.
1484            */
1485            mask_info=CloneImageInfo(image_info);
1486            (void) CopyMagickString(mask_info->filename,argv[i+1],
1487              MaxTextExtent);
1488            mask=ReadImage(mask_info,exception);
1489            CatchException(exception);
1490            mask_info=DestroyImageInfo(mask_info);
1491            if (mask == (Image *) NULL)
1492              break;
1493            (void) SetImageMask(*image,mask);
1494            break;
1495          }
1496        if (LocaleCompare("matte",option+1) == 0)
1497          {
1498            if (*option == '-')
1499              if ((*image)->matte == MagickFalse)
1500                (void) SetImageOpacity(*image,OpaqueOpacity);
1501            (*image)->matte=(*option == '-') ? MagickTrue : MagickFalse;
1502            break;
1503          }
1504        if (LocaleCompare("mattecolor",option+1) == 0)
1505          {
1506            if (*option == '+')
1507              {
1508                (void) QueryColorDatabase(MatteColor,&(*image)->matte_color,
1509                  exception);
1510                break;
1511              }
1512            (void) QueryColorDatabase(argv[i+1],&(*image)->matte_color,
1513              exception);
1514            break;
1515          }
1516        if (LocaleCompare("median",option+1) == 0)
1517          {
1518            Image
1519              *median_image;
1520
1521            /*
1522              Median filter image.
1523            */
1524            (void) ParseGeometry(argv[i+1],&geometry_info);
1525            median_image=MedianFilterImage(*image,geometry_info.rho,exception);
1526            if (median_image == (Image *) NULL)
1527              break;
1528            InheritException(&median_image->exception,exception);
1529            *image=DestroyImage(*image);
1530            *image=median_image;
1531            break;
1532          }
1533        if (LocaleCompare("modulate",option+1) == 0)
1534          {
1535            (void) ModulateImage(*image,argv[i+1]);
1536            break;
1537          }
1538        if (LocaleCompare("monitor",option+1) == 0)
1539          {
1540            (void) SetImageProgressMonitor(*image,MonitorProgress,
1541              (void *) NULL);
1542            break;
1543          }
1544        if (LocaleCom

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