]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Wed, 4 Sep 2013 11:31:30 +0000 (11:31 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Wed, 4 Sep 2013 11:31:30 +0000 (11:31 +0000)
MagickCore/compare.c
MagickWand/operation.c

index 4f00054b7f688cfbd5d5305527fd698786fdedce..cb0f43185d8a5ebea956585f1a72125dcc4e7511 100644 (file)
@@ -1212,7 +1212,8 @@ MagickExport MagickBooleanType GetImageDistortion(Image *image,
   }
   *distortion=channel_distortion[CompositePixelChannel];
   channel_distortion=(double *) RelinquishMagickMemory(channel_distortion);
-  (void) FormatImageProperty(image,"distortion","%.20g",*distortion);
+  (void) FormatImageProperty(image,"distortion","%.*g",GetMagickPercision(),
+    *distortion);
   return(status);
 }
 \f
index 6fb80da19708750a33fb9cba6afb3f13045ed197..e9ab8c6c88515c1121ba4d65f90c9e14dd7dd7be 100644 (file)
@@ -3631,6 +3631,39 @@ WandPrivate MagickBooleanType CLIListOperatorImages(MagickCLI *cli_wand,
           new_images=CombineImages(_images,(ColorspaceType) parse,_exception);
           break;
         }
+      if (LocaleCompare("compare",option+1) == 0)
+        {
+          double
+            distortion;
+
+          Image
+            *image,
+            *reconstruct_image;
+
+          MetricType
+            metric;
+
+          /*
+            Mathematically and visually annotate the difference between an
+            image and its reconstruction.
+          */
+          image=RemoveFirstImageFromList(&_images);
+          reconstruct_image=RemoveFirstImageFromList(&_images);
+          /* FUTURE - produce Exception, rather than silent fail */
+          if (reconstruct_image == (Image *) NULL)
+            break;
+          metric=UndefinedErrorMetric;
+          option=GetImageOption(_image_info,"metric");
+          if (option != (const char *) NULL)
+            metric=(MetricType) ParseCommandOption(MagickMetricOptions,
+              MagickFalse,option);
+          new_images=CompareImages(image,reconstruct_image,metric,&distortion,
+            _exception);
+          (void) distortion;
+          reconstruct_image=DestroyImage(reconstruct_image);
+          image=DestroyImage(image);
+          break;
+        }
       if (LocaleCompare("composite",option+1) == 0)
         {
           CompositeOperator
@@ -4027,6 +4060,8 @@ WandPrivate MagickBooleanType CLIListOperatorImages(MagickCLI *cli_wand,
           (void) RemapImages(_quantize_info,_images,(Image *) NULL,_exception);
           break;
         }
+      if (LocaleCompare("metric",option+1) == 0)
+        break;
       if (LocaleCompare("morph",option+1) == 0)
         {
           Image