sharp icon indicating copy to clipboard operation
sharp copied to clipboard

Expose background option in constructor for PDF input

Open omegayal opened this issue 3 years ago • 4 comments

Question about an existing feature

When install a custom libvips with PDF support, we can convert a PDF file to an PNG image with sharp. However, when the PDF has transparent background, the output image always shows white background.

What are you trying to achieve?

https://github.com/libvips/libvips/issues/995 It seems that libvips provides the option "background" when converting PDF to PNG with transparent background: vips copy transparent.pdf[background=0] x.png Does sharp also have such option? Thanks.

omegayal avatar Aug 04 '22 09:08 omegayal

We'd need to expose the background option in the constructor API. Happy to accept a PR, if you're able.

https://sharp.pixelplumbing.com/api-constructor#parameters https://www.libvips.org/API/current/VipsForeignSave.html#vips-pdfload

lovell avatar Aug 04 '22 09:08 lovell