Update readme, fix minor issues

This commit is contained in:
AuroraWright
2025-05-04 09:00:19 +02:00
parent e48f388755
commit f31526a339
4 changed files with 12 additions and 6 deletions

View File

@@ -13,7 +13,7 @@ parser = argparse.ArgumentParser(prog='owocr', description=textwrap.dedent('''\
parser.add_argument('-r', '--read_from', type=str, default=argparse.SUPPRESS,
help='Where to read input images from. Can be either "clipboard", "websocket", "unixsocket" (on macOS/Linux), "screencapture", or a path to a directory.')
parser.add_argument('-rs', '--read_from_secondary', type=str, default=argparse.SUPPRESS,
help='Where to read input images from. Can be either "clipboard", "websocket", "unixsocket" (on macOS/Linux), "screencapture", or a path to a directory.')
help="Optional secondary source to read input images from. Same options as read_from, but they can't both be directory paths.")
parser.add_argument('-w', '--write_to', type=str, default=argparse.SUPPRESS,
help='Where to save recognized texts to. Can be either "clipboard", "websocket", or a path to a text file.')
parser.add_argument('-e', '--engine', type=str, default=argparse.SUPPRESS,
@@ -49,7 +49,7 @@ class Config:
__engine_config = {}
__default_config = {
'read_from': 'clipboard',
'read_from_secondary': None,
'read_from_secondary': '',
'write_to': 'clipboard',
'engine': '',
'pause_at_startup': False,

View File

@@ -320,8 +320,9 @@ class GoogleLens:
new_h = int(new_w / aspect_ratio)
img_resized = img.resize((new_w, new_h), Image.Resampling.LANCZOS)
img.close()
img = img_resized
return (pil_image_to_bytes(img_resized), img_resized.width, img_resized.height)
return (pil_image_to_bytes(img), img.width, img.height)
class GoogleLensWeb:
name = 'glensweb'
@@ -415,8 +416,9 @@ class GoogleLensWeb:
new_h = int(new_w / aspect_ratio)
img_resized = img.resize((new_w, new_h), Image.Resampling.LANCZOS)
img.close()
img = img_resized
return pil_image_to_bytes(img_resized)
return pil_image_to_bytes(img)
class Bing:
name = 'bing'
@@ -541,8 +543,9 @@ class Bing:
new_h = int(img.height * resize_factor)
img_resized = img.resize((new_w, new_h), Image.Resampling.LANCZOS)
img.close()
img = img_resized
img_bytes, _ = limit_image_size(img_resized, max_byte_size)
img_bytes, _ = limit_image_size(img, max_byte_size)
if img_bytes:
res = base64.b64encode(img_bytes).decode('utf-8')
@@ -838,8 +841,9 @@ class AzureImageAnalysis:
new_h = int(img.height * resize_factor)
img_resized = img.resize((new_w, new_h), Image.Resampling.LANCZOS)
img.close()
img = img_resized
return pil_image_to_bytes(img_resized)
return pil_image_to_bytes(img)
class EasyOCR:
name = 'easyocr'