From e863c054d49031af35b73066f5394af223de7df5 Mon Sep 17 00:00:00 2001 From: cristy Date: Wed, 4 Sep 2013 11:31:30 +0000 Subject: [PATCH] --- MagickCore/compare.c | 3 ++- MagickWand/operation.c | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/MagickCore/compare.c b/MagickCore/compare.c index 4f00054b7..cb0f43185 100644 --- a/MagickCore/compare.c +++ b/MagickCore/compare.c @@ -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); } diff --git a/MagickWand/operation.c b/MagickWand/operation.c index 6fb80da19..e9ab8c6c8 100644 --- a/MagickWand/operation.c +++ b/MagickWand/operation.c @@ -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 -- 2.40.0