]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Thu, 28 Mar 2013 12:39:39 +0000 (12:39 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Thu, 28 Mar 2013 12:39:39 +0000 (12:39 +0000)
MagickCore/option.c
MagickWand/convert.c
MagickWand/mogrify.c
MagickWand/operation.c
PerlMagick/quantum/quantum.xs.in
utilities/convert.1
utilities/convert.1.in
utilities/mogrify.1
utilities/mogrify.1.in

index df485560058aed893698628804d029b164f648a2..fa7c0d0747169321adcfe04d96dd941333bb564d 100644 (file)
@@ -424,6 +424,8 @@ static const OptionInfo
     { "-geometry", 1L, SimpleOperatorFlag, MagickFalse },
     { "+gravity", 0L, ImageInfoOptionFlag | DrawInfoOptionFlag, MagickFalse },
     { "-gravity", 1L, ImageInfoOptionFlag | DrawInfoOptionFlag, MagickFalse },
+    { "+grayscale", 1L, SimpleOperatorFlag, MagickTrue },
+    { "-grayscale", 1L, SimpleOperatorFlag, MagickFalse },
     { "+green-primary", 0L, ImageInfoOptionFlag, MagickFalse },
     { "-green-primary", 1L, ImageInfoOptionFlag, MagickFalse },
     { "+hald-clut", 0L, DeprecateOptionFlag | FireOptionFlag, MagickTrue },
index a90593935694364ed729202e1ff9a1f9bc5c40c6..8e900c1de471df179fa7dc2389ed3930e560291e 100644 (file)
@@ -222,7 +222,6 @@ static MagickBooleanType ConvertUsage(void)
       "-interpolative-resize geometry",
       "                     resize image using interpolation",
       "-lat geometry        local adaptive thresholding",
-      "-layers method       optimize, merge,  or compare image layers",
       "-level value         adjust the level of image contrast",
       "-level-colors color,color",
       "                     level image with the given colors",
@@ -324,6 +323,7 @@ static MagickBooleanType ConvertUsage(void)
       "-flatten             flatten a sequence of images",
       "-fx expression       apply mathematical expression to an image channel(s)",
       "-hald-clut           apply a Hald color lookup table to the image",
+      "-layers method       optimize, merge, or compare image layers",
       "-morph value         morph an image sequence",
       "-mosaic              create a mosaic from an image sequence",
       "-poly terms          build a polynomial from the image sequence and the corresponding",
index f473ef783e14454561c6ac569d4da11a74b7edcd..d9067a0497c83e9f84561b17551c8b4ade7c01a7 100644 (file)
@@ -1753,6 +1753,20 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc,
               MagickGravityOptions,MagickFalse,argv[i+1]);
             break;
           }
+        if (LocaleCompare("grayscale",option+1) == 0)
+          {
+            (void) SyncImageSettings(mogrify_info,*image,exception);
+            if (*option == '+')
+              {
+                (void) TransformImageColorspace(*image,sRGBColorspace,
+                  exception);
+                break;
+              }
+            (*image)->intensity=(PixelIntensityMethod) ParseCommandOption(
+              MagickPixelIntensityOptions,MagickFalse,argv[i+1]);
+            (void) TransformImageColorspace(*image,GRAYColorspace,exception);
+            break;
+          }
         break;
       }
       case 'h':
@@ -3297,7 +3311,6 @@ static MagickBooleanType MogrifyUsage(void)
       "-interpolative-resize geometry",
       "                     resize image using interpolation",
       "-lat geometry        local adaptive thresholding",
-      "-layers method       optimize, merge,  or compare image layers",
       "-level value         adjust the level of image contrast",
       "-level-colors color,color",
       "                     level image with the given colors",
@@ -3398,6 +3411,7 @@ static MagickBooleanType MogrifyUsage(void)
       "-flatten             flatten a sequence of images",
       "-fx expression       apply mathematical expression to an image channel(s)",
       "-hald-clut           apply a Hald color lookup table to the image",
+      "-layers method       optimize, merge, or compare image layers",
       "-morph value         morph an image sequence",
       "-mosaic              create a mosaic from an image sequence",
       "-poly terms          build a polynomial from the image sequence and the corresponding",
@@ -4731,12 +4745,30 @@ WandExport MagickBooleanType MogrifyImageCommand(ImageInfo *image_info,
             i++;
             if (i == (ssize_t) argc)
               ThrowMogrifyException(OptionError,"MissingArgument",option);
-            gravity=ParseCommandOption(MagickGravityOptions,MagickFalse,argv[i]);
+            gravity=ParseCommandOption(MagickGravityOptions,MagickFalse,
+              argv[i]);
             if (gravity < 0)
               ThrowMogrifyException(OptionError,"UnrecognizedGravityType",
                 argv[i]);
             break;
           }
+        if (LocaleCompare("grayscale",option+1) == 0)
+          {
+            ssize_t
+              type;
+
+            if (*option == '+')
+              break;
+            i++;
+            if (i == (ssize_t) (argc-1))
+              ThrowMogrifyException(OptionError,"MissingArgument",option);
+            type=ParseCommandOption(MagickPixelIntensityOptions,MagickFalse,
+              argv[i]);
+            if (type < 0)
+              ThrowMogrifyException(OptionError,"UnrecognizedIntensityMethod",
+                argv[i]);
+            break;
+          }
         if (LocaleCompare("green-primary",option+1) == 0)
           {
             if (*option == '+')
@@ -4786,10 +4818,11 @@ WandExport MagickBooleanType MogrifyImageCommand(ImageInfo *image_info,
             i++;
             if (i == (ssize_t) (argc-1))
               ThrowMogrifyException(OptionError,"MissingArgument",option);
-            intensity=ParseCommandOption(MagickPixelIntensityOptions,MagickFalse,argv[i]);
+            intensity=ParseCommandOption(MagickPixelIntensityOptions,
+              MagickFalse,argv[i]);
             if (intensity < 0)
-              ThrowMogrifyException(OptionError,"UnrecognizedPixelIntensityMethod",
-                argv[i]);
+              ThrowMogrifyException(OptionError,
+                "UnrecognizedPixelIntensityMethod",argv[i]);
             break;
           }
         if (LocaleCompare("intent",option+1) == 0)
index 6d4f8bddde606cc4582f878885a61c1b0f720c11..1d904ac99146f64959823dbc76d3360de92d13ec 100644 (file)
@@ -2050,7 +2050,7 @@ static MagickBooleanType CLISimpleOperatorImage(MagickCLI *cli_wand,
              That seems to be a little strange!
           */
           (void) TransformImageColorspace(_image,
-                    IfNormalOp ? _image_info->colorspace : RGBColorspace,
+                    IfNormalOp ? _image_info->colorspace : sRGBColorspace,
                     _exception);
           break;
         }
@@ -2445,6 +2445,19 @@ static MagickBooleanType CLISimpleOperatorImage(MagickCLI *cli_wand,
               _image->filter,_exception);
           break;
         }
+      if (LocaleCompare("distort",option+1) == 0)
+        {
+          parse = ParseCommandOption(MagickPixelIntensityOptions,
+            MagickFalse,arg1);
+          if ( parse < 0 )
+             CLIWandExceptArgBreak(OptionError,"UnrecognizedIntensityMethod",
+               option,arg1);
+          _image->intensity = (PixelIntensityMethod) parse;
+          (void) TransformImageColorspace(_image,
+                    IfNormalOp ? _image_info->colorspace : GRAYColorspace,
+                    _exception);
+          break;
+        }
       CLIWandExceptionBreak(OptionError,"UnrecognizedOption",option);
     }
     case 'i':
index e5a82dd1c953bba6a96f7feccc208ef81ab8183b..2b76eb531acd1b05b81c478acea3fd172261ae6d 100644 (file)
@@ -542,6 +542,7 @@ static struct
       {"channel", MagickChannelOptions} } },
     { "Poly", { {"terms", ArrayReference},
       {"channel", MagickChannelOptions} } }
+    { "Grayscale", { {"method", MagickNoiseOptions} } },
   };
 
 static SplayTreeInfo
@@ -7362,6 +7363,8 @@ Mogrify(ref,...)
     PerceptibleImage   = 272
     Poly               = 273
     PolyImage          = 274
+    Grayscale          = 275
+    GrayscaleImage     = 276
     MogrifyRegion      = 666
   PPCODE:
   {
@@ -10923,6 +10926,14 @@ Mogrify(ref,...)
           terms=(double *) RelinquishMagickMemory(terms);
           break;
         }
+        case 137:  /* Grayscale */
+        {
+          if (attribute_flag[0] != 0)
+            image->intensity=(PixelIntensityMethod)
+              argument_list[0].integer_reference;
+          (void) TransformImageColorspace(image,GRAYColorspace,exception);
+          break;
+        }
       }
       if (next != (Image *) NULL)
         (void) CatchImageException(next);
index bac169b9d3a2ca6b1b2e5e5467600e858fd1e626..42eefeb0fe8d59b145883e723b3b5197f0ba10d8 100644 (file)
@@ -150,6 +150,7 @@ Image Operators:
   \-gaussian-blur geometry
                        reduce image noise and reduce detail levels
   \-geometry geometry   preferred size or location of the image
+  \-grayscale method    convert image to grayscale
   \-identify            identify the format and characteristics of the image
   \-ift                 implements the inverse discrete Fourier transform (DFT)
   \-implode amount      implode image pixels about the center
index 831964a2356685ff1e9ad3b8574ecd13d357734f..b9a4f93529dc0d346fe4194d6a13a8b5b69fd754 100644 (file)
@@ -150,6 +150,7 @@ Image Operators:
   \-gaussian-blur geometry
                        reduce image noise and reduce detail levels
   \-geometry geometry   preferred size or location of the image
+  \-grayscale method    convert image to grayscale
   \-identify            identify the format and characteristics of the image
   \-ift                 implements the inverse discrete Fourier transform (DFT)
   \-implode amount      implode image pixels about the center
index 4b7678dda2a13a6208627934e34926fcc0d74a7d..f3e1ac23d46bd3ae04b9c61deedf15266f7d1f3c 100644 (file)
@@ -153,6 +153,7 @@ Image Operators:
   \-gaussian-blur geometry
                        reduce image noise and reduce detail levels
   \-geometry geometry   preferred size or location of the image
+  \-grayscale method    convert image to grayscale
   \-ift                 implements the inverse discrete Fourier transform (DFT)
   \-help                print program options
   \-identify            identify the format and characteristics of the image
index 1ef26479b1d2e9d157ae0594203197f5a5dc2c15..4314037c5b1b6b978e76be4d09a32ffc7e991491 100644 (file)
@@ -153,6 +153,7 @@ Image Operators:
   \-gaussian-blur geometry
                        reduce image noise and reduce detail levels
   \-geometry geometry   preferred size or location of the image
+  \-grayscale method    convert image to grayscale
   \-ift                 implements the inverse discrete Fourier transform (DFT)
   \-help                print program options
   \-identify            identify the format and characteristics of the image