New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PNG image that gets corrupted when embedded #324
Comments
Hello @isc! I was able to reproduce the issue. I suspect it does have something to do with the specific PNG image you are trying to embed. However, that does not mean your image is invalid. It is likely a bug in the PNG parsing library used by I am planning to replace the current PNG parsing library with a different one as soon as I have time (see #307). We'll see if that resolves this issue as well. I tried exporting your image using Preview ( |
Thank you for the prompt answer. |
I don't know if it is related, but I'm having the isse with PNG : Error: Invalid filter algorithm: 16. I have tried with many PNG and they all give error with different numbers, in example 40. I don't know what else to do to make this work. |
@demalmar Yes, I would expect that the errors you're encountering are due to this bug. I'm working on getting this fixed, but haven't had much time to devote to it. One workaround would be to "rewrite" you PNG images such that they are no longer interlaced, prior to embedding them. I haven't done it myself, but I'd suggest trying to use https://github.com/lukeapage/pngjs to load and rewrite the images if you need to do so in an automated way. However, if you have a static set of images that needs to be converted, you can try doing so with image editors/viewers (as I explained above: #324 (comment)). |
@isc @demalmar Just wanted to update you guys on this. Today I finished swapping out |
Hi,
Thank you for this library which seems to fit perfectly to our needs.
We do have an issue though when we try to embed a PNG image.
The following image is displayed correctly in a browser or on my system Preview app: https://i.postimg.cc/q7qD277r/signature.png
However when embedded in a PDF with PDF-lib, the image gets corrupted as you can see in the modified JSFiddle demo:
https://jsfiddle.net/0uk2qbax/1/
Is it something in our PNG file that prevents it from being properly displayed once embedded with PDF-lib?
Thank you in advance for your help
The text was updated successfully, but these errors were encountered: