Open r4mp opened 3 years ago
Can you upload the PNG file to GitHub?
As far as I know, images with an alpha channel aren't supported right now because that would require support for "soft masks" in the PDF, which isn't implemented yet.
It really seems to be the problem/reason you described.
I'm putting soft masks on my todo list, it's not that hard to implement (you need to split out the alpha channel and then reference it as a separate greyscale image). Can't say when I'll get back to working on printpdf though.
for newcomer going here, this is the workaround https://github.com/fschutt/printpdf/issues/119#issuecomment-1120434233 (work only with Rgba color space)
Hi, I find SoftMask is ready, but how to use it? it has no constructor function.
@BXHlixiaodong This is a stub API, it doesn't work yet
@fschutt, I'm also interested in soft mask functionality and would be willing to help out if you'd like. If interested, could you point out some relevant parts of the code where you think it would make sense to plug it in and I'll see if I can help out?
I went ahead and submitted a PR that adds support for rgba8 images. I think it may be helpful to more people so ideally we can merge it, but I am as of now unblocked via my fork. Here is the diff https://github.com/fschutt/printpdf/pull/158
printpdf version: 0.3.3
If I try to add a png with transparency, the image wouldn't shown. Other png files works fine.