I want to convert a bunch of Webp images to individual PDFs. I'm able to do it with this command:

parallel convert '{} {.}.pdf' ::: *.webp

or I can use this FFMPEG command:

find ./ -name "*.webp" -exec dwebp {} -o {}.pdf \;

However during the process of conversion the Webp files are decoded and the resultant PDFs have a much bigger file size. When I use the above commands for JPG-to-PDF conversion the PDF size is reasonably close to the JPG image size.

This command works fine with JPGs, but the program img2pdf doesn't work with the Webp format:

find ./ -name "*.jpg" -exec img2pdf {} -o {}.pdf \;

I also tried Webp-to-PDF conversion with this online service, but the PDF was huge.

How can I keep the PDF size down to the Webp file size?

  • One possibility is to first convert the webp images to jpg, then to pdf. This might reduce the quality a little, but should work.
    – meuh
    Commented Jan 15, 2018 at 21:25
  • Yes this would work, but I am specifically asking how to do this with webp files.
    – whitewings
    Commented Jan 16, 2018 at 16:01
  • You will only get a small size pdf if you go via an intermediate jpg stage, as jpg compression is supported natively in pdf, but webp is not.
    – meuh
    Commented Jan 16, 2018 at 16:03
  • Could I get webp compression supported in pdf through some other program?
    – whitewings
    Commented Jan 16, 2018 at 18:22
  • Yeah, I guess until pdf supports webp natively (or someone writes a PS implementation of the webp decode in a way small enough to include in a PDF!) this won't be possible without losing significant quality Commented Mar 21, 2020 at 12:52

1 Answer 1


Why not just use Imagemagick and Ghostscript?

convert img.webp img.pdf
gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dPDFSETTINGS=/ebook -sOutputFile=img-small.pdf img.pdf

In my test with your sample file I got a pdf result of about 3.2 MB.


You could follow these instructions on Ubuntu to make sure that imagemagick was built with webp. Install this package for Windows or on macos do this:

brew install webp
brew install imagemagick
  • I have ImageMagick already and have tried some commands. Your command takes a series of webp images that amount to 2mb and creates a 100mb pdf. Even when I reduce the quality to 80 and the density to 50x50. I want a command that will give me a pdf that is roughly equal in size to the source webp images.
    – whitewings
    Commented Jan 16, 2018 at 15:59
  • @user8547 can you post a link to webp file example you are working on? Commented Jan 16, 2018 at 17:40
  • Here's a link. When I try all the methods of converting this to pdf it comes out around 150mb. cdn.pbrd.co/images/H3e1vmd.webp
    – whitewings
    Commented Jan 16, 2018 at 18:20
  • @user8547 updated with working sample script. Commented Jan 16, 2018 at 20:05
  • 1
    My bad - autocorrect bit again, it should be ebook without the camel case. I updated the answer for you Commented Jan 17, 2018 at 1:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .