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
Weird artifacts when encoding PNG #4063
Comments
https://sharp.pixelplumbing.com/api-output#png
When |
Ah, I see. I understand that it's a lossy output, but the output from my example is still very unexpected for me. The background color is a single color, and it just adds a completely different color but just in some areas. Is this the desired/expected functionality? |
Is there any way to prevent this from happening while still setting a |
The prebuilt binaries provided by sharp include the BSD-licenced libimagequant v2.4.1 for generating and mapping image palettes. You may have some luck building your own libvips from source compiled with support for an alternative quantisation library such as a more recent GPL-licenced libimagequant or quantizr, but this is left as an exercise for the reader. |
Thanks! I ended up setting |
Ah yes, this does look like dithering gone a bit wrong, so altering the |
Possible bug
Is this a possible bug in a feature of sharp, unrelated to installation?
npm install sharp
completes without error.node -e "require('sharp')"
completes without error.Are you using the latest version of sharp?
sharp
as reported bynpm view sharp dist-tags.latest
.What is the output of running
npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp
?What are the steps to reproduce?
Encode the below file as a PNG with quality 85:
It will result in the following file:
As you can see, there are some weird triangle artifacts at the bottom. Increasing the quality to 86 seems to completely remove those artifacts.
Here's a JS snippet that just does that:
The text was updated successfully, but these errors were encountered: