From ff73d7485173d0830e1ed8b29353520a501482c8 Mon Sep 17 00:00:00 2001 From: Robert Date: Sat, 26 Apr 2025 18:31:50 -0400 Subject: [PATCH] Invalid Image detection. --- dedup.py | 6 +++++- junk.jpg | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 junk.jpg diff --git a/dedup.py b/dedup.py index 87b5b6a..c71f196 100644 --- a/dedup.py +++ b/dedup.py @@ -370,7 +370,7 @@ def get_image_dimensions_cv(img): if img is not None: height, width = img.shape[:2] return width, height - return None + return None, None """ xxhash is about 5–10x faster than SHA256, non-cryptographic. @@ -414,6 +414,10 @@ if __name__ == "__main__": w, h = get_image_dimensions_cv(large_img1) w2, h2 = get_image_dimensions_cv(large_img2) + if w == None or w2 == None or h == None or h2 == None: + print("Aborting...Invalid Image!") + timer() + exit(8) if w != w2 and w != h2: print("Diffent Resolutions") timer() diff --git a/junk.jpg b/junk.jpg new file mode 100644 index 0000000..ab207bc --- /dev/null +++ b/junk.jpg @@ -0,0 +1 @@ +njxczsfjsdfjhklfdsklfsdfklsdlfjkdsljfldsfklsdaf