Skip to content

Commit

Permalink
Merge pull request #82 from m4rc1e/size-match
Browse files Browse the repository at this point in the history
resize before images if they are not the same size
  • Loading branch information
m4rc1e authored Jul 31, 2023
2 parents 7b8c152 + 63d43cb commit d1bb517
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/diffenator2/renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +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)
width = min([img_a.width, img_b.width])
height = min([img_a.height, img_b.height])
img_a = np.asarray(img_a)[0:height, 0:width, :]
img_b = np.asarray(img_b)[0:height, 0:width, :]
if img_a.size != img_b.size:
img_a = img_a.resize(img_b.size)
img_a = np.asarray(img_a)
img_b = np.asarray(img_b)

diff_map = np.abs(img_a-img_b)
if np.size(diff_map) == 0:
Expand Down

0 comments on commit d1bb517

Please sign in to comment.