How to convert WEBP to PDF without increasing size?
#91
Closed
opened 3 years ago by josch
·
0 comments
Loading…
Reference in New Issue
There is no content yet.
Delete Branch '%!s(<nil>)'
Deleting a branch is permanent. It CANNOT be undone. Continue?
By Bob on 2021-03-07T11:03:59.556Z
Hello,
I would like to convert a list of WEBP images to a PDF.
When do it with
img2pdf
, the size is multiplied by 10!Is there a way to have a PDF file using the WEBP images without a convertion to PNG?
By josch on 2021-03-07T11:40:16.986Z
I'm actually surprised that img2pdf is able to use webp images an input without throwing any errors! This is probably because PIL has no problem with the webp format.
I'm not surprised that the file size is multiplied by 10. Since the webp format is not jpeg and not png, the image has to re-encoded and to not loose any information, img2pdf will encode the image to png which for photos lets the file size explode.
I see two ways to achieve what you want :
The best option would be the first but I do not see any support of webp images in the pdf standard. I'll leave this bug open because support for it might be added in the future though I fear if any new image format is added to pdf, then it might be AVIF instead because that one outperforms webp.
img2pdf will never support option three out-of-the-box because img2pdf will always be lossless. So if you are find with the conversion being lossy, then you have to do the conversion yourself before passing the files to img2pdf.
By Bob on 2021-03-10T14:01:52.899Z
You said:
OK, that's the answer I needed. I looked in the internet but it wasn't that clear.
Thank you for your answer!
By Bob on 2021-03-10T14:01:53.148Z
Status changed to closed