-
-
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
How to use .png() to save a greyscale (1 channel), 1 bit image? #2834
Comments
Convert to greyscale and save as 1-bit palette PNG: const png1 = await sharp(input)
.greyscale()
.png({ colours: 2 })
.toBuffer() Convert to greyscale and save as as 2-bit palette PNG: const png2 = await sharp(input)
.greyscale()
.png({ colours: 4 })
.toBuffer() |
am i to understand from link |
When you provide a value for |
I get a smaller file with
than
if (assumingly) in PNG, quality just changes the palette, |
Dropping the colours to 2 may increase the amount of dithering, which can increase entropy and reduce the LZW compression ratio. Dropping |
setting dither to zero had no effect on image size |
Is this issue superseded by #2855? |
I hope this information helped. I'll close as it looks like #2855 supersede this, but please feel free to re-open with more details if further assistance is required. |
I'm trying to use the .png() function to save:
I couldn't understand from the docs what should be the right "options" parameters.
appreciate any help.
awsome library BTW.
The text was updated successfully, but these errors were encountered: