ordeq_pillow
PDF2Image
dataclass
¶
Bases: Input[list[Image]]
Input that loads images from a PDF file.
Example:
>>> from ordeq_pillow import PDF2Image
>>> from pathlib import Path
>>> pdf_path = PDF2Image(path=Path("example.pdf"))
>>> images = pdf_path.load() # doctest: +SKIP
>>> len(images) # doctest: +SKIP
3 # Number of pages in the PDF
>>> images[0].size # doctest: +SKIP
(612, 792) # Size of the first page image
PillowImage
dataclass
¶
Bases: IO[Image]
IO that loads and saves PIL Image objects to and from disk.
Example:
>>> from ordeq_pillow import PillowImage
>>> from PIL import Image
>>> from pathlib import Path
>>> image = PillowImage(path=Path("example.png"))
>>> img = Image.new("RGB", (100, 100), color="red")
>>> image.save(img)
>>> loaded_img = image.load()
>>> loaded_img.size
(100, 100)