MouseClicks_duplicate / convert2img.py
TameemADR's picture
Update convert2img.py
20c6a8d verified
raw
history blame contribute delete
294 Bytes
import pypdfium2 as pdfium
import numpy as np
import cv2
from PIL import Image
def convert2img(path):
pdf = pdfium.PdfDocument(path)
page = pdf.get_page(0)
pil_image = page.render().to_pil()
pl1=np.array(pil_image)
img = cv2.cvtColor(pl1, cv2.COLOR_RGB2BGR)
return img