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
Inconsistent white border in different image sizes #3862
Comments
Both these images appear to be rendered as-expected, both have a transparent background. I suspect your question relates to the semi-transparent pixels around some of the edges in the 1200px PNG example. The logic to calculate the "natural size" of an SVG is not entirely straightforward - see https://github.com/libvips/libvips/blob/35053f55e372bd3e687e987c2d68ea5cf62f85cd/libvips/foreign/svgload.c#L402 - and may result in scaling via cairo, which can introduce anti-aliasing at edges for some dimensions. Given the - <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 500 500">
+ <svg xmlns="http://www.w3.org/2000/svg" width="500" height="500"> |
Thank you for pointing me to the right direction. Unfortunately neither replacing viewBox with width and height nor simply adding it along viewBox did not change output for 1200x. |
You could also try using shape-rendering to reduce anti-aliasing. - <path d="M32 32h300l-172 54L332 332H32Z" />
+ <path d="M32 32h300l-172 54L332 332H32Z" shape-rendering="crispEdges" /> |
@danielwerg Were you able to make any progress with this? |
@lovell Nope, learned to accept it when I was still working on project that needed it. |
Thanks for the update, I'll close for now. |
Question about an existing feature
What are you trying to achieve?
Consistent output without white border.
When you searched for similar issues, what did you find that might be related?
Nothing, not sure what to search for.
Please provide a minimal, standalone code sample, without other dependencies, that demonstrates this question
Please provide sample image(s) that help explain this question
1000x (no white border)
1200x (white border)
The text was updated successfully, but these errors were encountered: