Read an image file (or a collection of image files) and convert it into an image in numpy format >>> from doctr.io import DocumentFile >>> pages = DocumentFile.from_images(["path/to/your/page1.png", "path/to/your/page2.png"]) Args: files: the path to the image f
(cls, files: Sequence[AbstractFile] | AbstractFile, **kwargs)
| 61 | |
| 62 | @classmethod |
| 63 | def from_images(cls, files: Sequence[AbstractFile] | AbstractFile, **kwargs) -> list[np.ndarray]: |
| 64 | """Read an image file (or a collection of image files) and convert it into an image in numpy format |
| 65 | |
| 66 | >>> from doctr.io import DocumentFile |
| 67 | >>> pages = DocumentFile.from_images(["path/to/your/page1.png", "path/to/your/page2.png"]) |
| 68 | |
| 69 | Args: |
| 70 | files: the path to the image file or a binary stream, or a collection of those |
| 71 | **kwargs: additional parameters to :meth:`doctr.io.image.read_img_as_numpy` |
| 72 | |
| 73 | Returns: |
| 74 | the list of pages decoded as numpy ndarray of shape H x W x 3 |
| 75 | """ |
| 76 | if isinstance(files, (str, Path, bytes)): |
| 77 | files = [files] |
| 78 | |
| 79 | return [read_img_as_numpy(file, **kwargs) for file in files] |