-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Compositing PNG with tile=true where height > 512px, "pngload_buffer: out of order read at line" #3767
Comments
Are you using the latest version of sharp? Do you see this problem when using the prebuilt binaries (that provide libspng) instead of a globally-installed libvips (probably using libpng)? |
I am using the latest version of sharp. I just tried it using the prebuilt binaries in my docker container and it still gave me the same error.
I did the same on my Mac too. I uninstalled my installation of libvips and opted for the prebuilt binaries, but the operations completed without any errors. I would try to wrap it in a try catch block, however I have no idea where I would put it since the error is not giving me any context as to where the error is occurring. |
Thank you. Given you're using a globally-installed libvips and compiling sharp from source, please can you try applying the following patch: Line 656 in 44a0ee3
- compositeImage = compositeImage.replicate(across, down);
+ compositeImage = compositeImage.copy_memory().replicate(across, down); |
Thanks for the reply! I am not actually building sharp myself from source, I am just allowing it to automatically build from the npm installation command. How can I go about building it myself? Maybe I am not looking hard enough but I can't find any instructions in the documentation. Thanks. |
If you're using a globally-installed version of libvips then sharp will attempt to re-compile itself from source at https://sharp.pixelplumbing.com/install#building-from-source |
@lovell I try to apply the patch and compile sharp from source on a M1 Mac for AWS Lambda. But I got Thank you!
|
@lovell Thanks again for the reply. I understand now that it is built at install, but I'm still a bit confused on how I would apply that patch. Wouldn't I need to install the package first before making any changes? Would it be easier for me just to make a fork? The problem is, my docker container runs |
I've now been able to reproduce this locally and can confirm the suggested fix works. The problem occurs when compositing a PNG with Commit 4340d60 adds the fix and a test that would previously have failed to help prevent regression. |
Hey @lovell, Also, I just had this bug when I flipped my gif to have a vertical resolution, and it works perfectly fine now with the fix you shipped yesterday. |
v0.32.6 now available, thanks for reporting. |
Question about an existing feature
What are you trying to achieve?
I am currently trying to overlay text onto an image. I am doing this by generating the text using canvas, converting it to a png, then placing it on the source image. When running my code on my Mac outside of docker, everything works as intended, but as soon as I build the project into a docker container, it gives me this error when trying to overlay the text. The weird thing is, it works when overlaying text the first time, but it errors on the second time. I am not sure why. I would assume it might have to do with the image being corrupted, but if it was corrupted it should fail to work in both environments.
For additional context, here is my docker build file:
When you searched for similar issues, what did you find that might be related?
#3600 Had a similar error to mine. The proposed solution there was to set
sequentialRead: false
when creating a new sharp instance, however trying this gave me a segment fault error on both my Mac environment and docker environment.Please provide a minimal, standalone code sample, without other dependencies, that demonstrates this question
It's kind of hard to recreate this issue in a standalone example since it's very specific, but here's the link to the code where I am performing the image operations.
https://github.com/DriedSponge/chica/blob/main/src/commands/image/Caption.ts#L24-L77
Here is a quick summary of what is happening
Please keep in mind that this error only occurs inside of my docker container, it works perfectly fine on the outside. Also that is the entire error. It did not give me a full stack trace or specific file/line number where the error was occurring.
Please let me know if you need more context, I am happy to provide it. Also even if you can't provide a direct solution, I'm happy to hear any ideas as to why you think this may be happening.
The images were too big to upload to github so here's an imgur link https://imgur.com/a/00dM1iV
Thank you!
The text was updated successfully, but these errors were encountered: