From 44ed146c8f93743db16240d392bb7eb69663f9f5 Mon Sep 17 00:00:00 2001 From: Paul Friederichsen Date: Fri, 11 Aug 2023 21:57:58 -0500 Subject: [PATCH] When an image can't be rendered return empty set for phash --- hydrus/client/ClientImageHandling.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/hydrus/client/ClientImageHandling.py b/hydrus/client/ClientImageHandling.py index a51e4068..f7f473dd 100644 --- a/hydrus/client/ClientImageHandling.py +++ b/hydrus/client/ClientImageHandling.py @@ -40,9 +40,15 @@ def GenerateShapePerceptualHashes( path, mime ): HydrusData.ShowText( 'phash generation: loading image' ) - numpy_image = GenerateNumPyImage( path, mime ) + try: + + numpy_image = GenerateNumPyImage( path, mime ) + + return GenerateShapePerceptualHashesNumPy( numpy_image ) - return GenerateShapePerceptualHashesNumPy( numpy_image ) + except: + + return set() def GenerateShapePerceptualHashesNumPy( numpy_image ):