diff --git a/vectorizing/util/read.py b/vectorizing/util/read.py index 54edea1..ba53aca 100644 --- a/vectorizing/util/read.py +++ b/vectorizing/util/read.py @@ -23,7 +23,7 @@ def __init__(self): def convert_RGB_A(img): if img.mode == 'RGB' or img.mode == 'RGBA': return img - + map = { '1': 'RGB', 'L': 'RGB', @@ -33,8 +33,9 @@ def convert_RGB_A(img): if not img.mode in map: raise ImageFormatError() - + return img.convert(map.get(img.mode)) + def try_read_image_from_path(path): try: @@ -49,4 +50,4 @@ def try_read_image_from_url(url): img = Image.open(BytesIO(resp.content)) except: raise URLReadError() - return convert_RGB_A(img) \ No newline at end of file + return convert_RGB_A(img)