NFDI4BIOIMAGE / training

https://nfdi4bioimage.github.io/training
Creative Commons Attribution 4.0 International
12 stars 7 forks source link

Simplify installation for PDF->image conversion #509

Open haesleinhuepf opened 5 days ago

haesleinhuepf commented 5 days ago

In this script: https://github.com/NFDI4BIOIMAGE/training/blob/089c26a86a6625499809be0955ce58977251a757/scripts/highlights-download-statistics.py#L7

we use a relatively complicated to install python library for rendering PDFs into images. We could use pdfium instead:

pdf = pdfium.PdfDocument(pdf_path)
page = pdf[0]
pil_image = page.render(
                scale=2.0,  # Adjust scale for higher resolution images
                rotation=0
).to_pil()