From 4d43e385c5fb919b3e9e7ca4b8f76cc140413a8c Mon Sep 17 00:00:00 2001 From: Julius Unverfehrt Date: Mon, 6 Feb 2023 09:43:28 +0100 Subject: [PATCH] replace image extraction logic final --- image_prediction/image_extractor/extractors/parsable.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/image_prediction/image_extractor/extractors/parsable.py b/image_prediction/image_extractor/extractors/parsable.py index 9da3ec7..3f3f21e 100644 --- a/image_prediction/image_extractor/extractors/parsable.py +++ b/image_prediction/image_extractor/extractors/parsable.py @@ -148,10 +148,6 @@ def xref_to_image(doc, xref) -> Union[Image.Image, None]: pixmap = fitz.Pixmap(doc, xref) array = np.frombuffer(pixmap.samples, dtype=np.uint8).reshape(pixmap.h, pixmap.w, pixmap.n) array = normalize_channels(array) - print(array.shape) - assert array.shape[-1] == 3 - # # TODO: Find a better solution: PIL.Image.fromarray doesn't take grayscale images of the shape (h, w, 1) but (h, w) - # array = array[:, :, 0] if array.shape[2] == 1 else array return Image.fromarray(array) except ValueError: logger.debug(f"Xref {xref} is invalid, skipping extraction ...")