fix: add error if no image provided upong starting
This commit is contained in:
@@ -18,7 +18,9 @@ MAX_GLYPHS = 256
|
||||
|
||||
class Reader:
|
||||
def __init__(self, params: Parameters) -> None:
|
||||
self.source_image_path = pathlib.Path(params.source_image_path)
|
||||
self.source_image_path = (
|
||||
pathlib.Path(params.source_image_path) if params.source_image_path else None
|
||||
)
|
||||
self.source_names_path = (
|
||||
pathlib.Path(params.source_names_path) if params.source_names_path else None
|
||||
)
|
||||
@@ -60,6 +62,11 @@ class Reader:
|
||||
return self.__read_sentences(names)
|
||||
|
||||
def __read_image(self) -> list[Glyph]:
|
||||
if not self.source_image_path:
|
||||
self.log.error(
|
||||
"No input image provided"
|
||||
)
|
||||
sys.exit(1)
|
||||
try:
|
||||
img = Image.open(self.source_image_path).convert("1")
|
||||
if img.width % 8 != 0 or img.height % 8 != 0:
|
||||
|
||||
Reference in New Issue
Block a user