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
Reduced grayscale png file size is larger than original png #938
Comments
This question is asked regularly of sharp - see lovell/sharp#478 (and the linked issues). |
I used imagick " identiy -verbose " to inspect the two png files. You can find out that the two have exactly the same colorspace, channels and depth . 1. Output for original :Format: PNG (Portable Network Graphics) Output for resized:Image: nike-logo.png.resized.png |
Another factor is the shape of the edge. Your original has very sharp edges and will be easy to compress well -- after lanczo3 they will be smoother and have a bit of ringing. You could try using bilinear instead. |
I see:
|
I am testing libvips' resize API and found out it's really convenient. Great job.
But I found out when png is grayscale, that exported png file with smaller dimension is acutally larger than the original. When it is colorful, the reduced png size is proportional.
Why is it? Is there anyway to tune the code so png file with smalled dimensions is always smaller in term of file size?
Below is the code I used to resize then crop:
And to export to png:
Original png, width: 1024
Resized, width: 900
Thanks
The text was updated successfully, but these errors were encountered: