From 47c1b1966b8da54092afd29e70b126fe0bddf0eb Mon Sep 17 00:00:00 2001 From: Marc Foley Date: Wed, 2 Aug 2023 18:07:03 +0100 Subject: [PATCH] fix zero width images --- src/diffenator2/renderer.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/diffenator2/renderer.py b/src/diffenator2/renderer.py index 94bf58e..21037b8 100644 --- a/src/diffenator2/renderer.py +++ b/src/diffenator2/renderer.py @@ -213,6 +213,10 @@ def set_features(self, features): def diff(self, string): img_a = self.renderer_a.render(string) img_b = self.renderer_b.render(string) + if img_a.size == (0, 0) and img_b.size != (0, 0): + return 99.99, [] + if img_b.size == (0, 0) and img_a.size != (0, 0): + return 99.99, [] if img_a.size != img_b.size: img_a = img_a.resize(img_b.size) img_a = np.asarray(img_a)