Skip to content

Commit

Permalink
Merge pull request #30 from ali6parmak/fix-zero-size-error
Browse files Browse the repository at this point in the history
Fix "ValueError: height and width must be > 0" in minmax_size method
  • Loading branch information
SWHL authored Oct 24, 2024
2 parents da45481 + 5f85a05 commit b5258f8
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions rapid_latex_ocr/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ def minmax_size(
ratios = [a / b for a, b in zip(img.size, self.max_dims)]
if any([r > 1 for r in ratios]):
size = np.array(img.size) // max(ratios)
size = np.maximum(size, 1)
img = img.resize(tuple(size.astype(int)), Image.BILINEAR)

if self.min_dims is not None:
Expand Down

0 comments on commit b5258f8

Please sign in to comment.