Commit 702175ac4 for imagemagick.org
commit 702175ac44c5e3a4bae9f8b5ab693211c4c894d8
Author: Cristy <urban-warrior@imagemagick.org>
Date: Sun Jun 21 15:01:59 2026 -0400
quantize hash image depth
diff --git a/MagickCore/statistic.c b/MagickCore/statistic.c
index 86ed8ae59..615fc4f40 100644
--- a/MagickCore/statistic.c
+++ b/MagickCore/statistic.c
@@ -44,6 +44,7 @@
#include "MagickCore/accelerate-private.h"
#include "MagickCore/animate.h"
#include "MagickCore/artifact.h"
+#include "MagickCore/attribute.h"
#include "MagickCore/blob.h"
#include "MagickCore/blob-private.h"
#include "MagickCore/cache.h"
@@ -1782,11 +1783,19 @@ MagickExport ChannelPerceptualHash *GetImagePerceptualHash(const Image *image,
hash_image=BlurImage(image,0.0,1.0,exception);
if (hash_image == (Image *) NULL)
break;
- hash_image->depth=8;
status=TransformImageColorspace(hash_image,(ColorspaceType) colorspace,
exception);
if (status == MagickFalse)
- break;
+ {
+ hash_image=DestroyImage(hash_image);
+ break;
+ }
+ status=SetImageDepth(hash_image,8,exception);
+ if (status == MagickFalse)
+ {
+ hash_image=DestroyImage(hash_image);
+ break;
+ }
moments=GetImageMoments(hash_image,exception);
if (moments == (ChannelMoments *) NULL)
{