Commit c92cd3515 for imagemagick.org
commit c92cd3515d881b4ef4f8a27ecf866f2bc3b7af6e
Author: Cristy <urban-warrior@imagemagick.org>
Date: Sun Apr 19 19:45:56 2026 -0400
scale the pixel distortion
diff --git a/MagickCore/compare.c b/MagickCore/compare.c
index b29bf4f18..8cb2996ae 100644
--- a/MagickCore/compare.c
+++ b/MagickCore/compare.c
@@ -1616,7 +1616,7 @@ static MagickBooleanType GetPDCSimilarity(const Image *image,
channel,q);
else
error=Sa*p[i]-Da*GetPixelChannel(reconstruct_image,channel,q);
- if ((error*error) > fuzz)
+ if (MagickSafeSignificantError(error*error,fuzz) != MagickFalse)
{
channel_similarity[i]++;
count++;
diff --git a/MagickWand/compare.c b/MagickWand/compare.c
index ea23d68c8..357e271a6 100644
--- a/MagickWand/compare.c
+++ b/MagickWand/compare.c
@@ -1455,7 +1455,6 @@ WandExport MagickBooleanType CompareImagesCommand(ImageInfo *image_info,
case PeakSignalToNoiseRatioErrorMetric:
case PerceptualHashErrorMetric:
case PhaseCorrelationErrorMetric:
- case PixelDifferenceCountErrorMetric:
case StructuralSimilarityErrorMetric:
case StructuralDissimilarityErrorMetric:
{
@@ -1519,6 +1518,65 @@ WandExport MagickBooleanType CompareImagesCommand(ImageInfo *image_info,
GetMagickPrecision(),image->error.normalized_maximum_error);
break;
}
+ case PixelDifferenceCountErrorMetric:
+ {
+ switch (image->colorspace)
+ {
+ case RGBColorspace:
+ default:
+ {
+ (void) FormatLocaleFile(stderr," red: %.*g\n",
+ GetMagickPrecision(),
+ scale*channel_distortion[RedPixelChannel]);
+ (void) FormatLocaleFile(stderr," green: %.*g\n",
+ GetMagickPrecision(),
+ scale*channel_distortion[GreenPixelChannel]);
+ (void) FormatLocaleFile(stderr," blue: %.*g\n",
+ GetMagickPrecision(),
+ scale*channel_distortion[BluePixelChannel]);
+ if (image->alpha_trait != UndefinedPixelTrait)
+ (void) FormatLocaleFile(stderr," alpha: %.*g\n",
+ GetMagickPrecision(),
+ scale*channel_distortion[AlphaPixelChannel]);
+ break;
+ }
+ case CMYKColorspace:
+ {
+ (void) FormatLocaleFile(stderr," cyan: %.*g\n",
+ GetMagickPrecision(),channel_distortion[CyanPixelChannel]);
+ (void) FormatLocaleFile(stderr," magenta: %.*g\n",
+ GetMagickPrecision(),
+ scale*channel_distortion[MagentaPixelChannel]);
+ (void) FormatLocaleFile(stderr," yellow: %.*g\n",
+ GetMagickPrecision(),
+ scale*channel_distortion[YellowPixelChannel]);
+ (void) FormatLocaleFile(stderr," black: %.*g\n",
+ GetMagickPrecision(),
+ scale*channel_distortion[BlackPixelChannel]);
+ if (image->alpha_trait != UndefinedPixelTrait)
+ (void) FormatLocaleFile(stderr," alpha: %.*g\n",
+ GetMagickPrecision(),
+ scale*channel_distortion[AlphaPixelChannel]);
+ break;
+ }
+ case LinearGRAYColorspace:
+ case GRAYColorspace:
+ {
+ (void) FormatLocaleFile(stderr," gray: %.*g\n",
+ GetMagickPrecision(),
+ scale*channel_distortion[GrayPixelChannel]);
+ if (image->alpha_trait != UndefinedPixelTrait)
+ (void) FormatLocaleFile(stderr," alpha: %.*g\n",
+ GetMagickPrecision(),
+ scale*channel_distortion[AlphaPixelChannel]);
+ break;
+ }
+ }
+ (void) FormatLocaleFile(stderr," all: %.*g\n",
+ GetMagickPrecision(),
+ scale*channel_distortion[MaxPixelChannels]);
+ break;
+ }
case UndefinedErrorMetric:
break;
}