Skip to content

Commit

Permalink
Fixes Issue #81: Failing when region to small
Browse files Browse the repository at this point in the history
  • Loading branch information
dynobo committed Oct 30, 2020
1 parent 0112d86 commit 185f2bb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions normcap/handlers/ocr_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ def handle(self, request: NormcapData) -> NormcapData:
return request

def img_to_dict(self, img, lang) -> list:
if not img.size or img.size[0] * img.size[1] <= 10:
self._logger.warning("Image too small for OCR. Dimensions: %s", img.size)
return []

img.format = "PNG" # WORKAROUND for a pyinstaller bug on Win

# 0 = Orientation and script detection (OSD) only.
Expand Down

0 comments on commit 185f2bb

Please sign in to comment.