How to Convert WebP to PDF with Python? Need a Simple Solution! or Best Way to Convert WebP to PDF wi

18 Replies, 1362 Views

Pro tip: If PIL’s giving you grief, try `opencv` to read the webp, then `pdfkit` to convert:

```python
import cv2
img = cv2.imread('image.webp')
cv2.imwrite('temp.png', img) # Save as PNG
import pdfkit
pdfkit.from_file('temp.png', 'output.pdf')
```

A bit roundabout, but gets the job done.

Messages In This Thread



Users browsing this thread: 1 Guest(s)