Skip to content

Commit

Permalink
fix zero width images
Browse files Browse the repository at this point in the history
  • Loading branch information
m4rc1e committed Aug 2, 2023
1 parent 3a63bba commit 47c1b19
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/diffenator2/renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 47c1b19

Please sign in to comment.