Skip to content
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

Stroke-Width incorrectly applied if between 0 and 1 or if using percentage #338

Open
RMY1 opened this issue Aug 28, 2017 · 7 comments
Open
Labels

Comments

@RMY1
Copy link

RMY1 commented Aug 28, 2017

Hi guys.

It seems stroke-width is ignored when it has value between 0 and 1.
Stroke-width value, in that case, is taken by default and is equal to 1.

Does anyone else experience that behavour ?
Thanks.

@heindlalex
Copy link
Contributor

I was not able to reproduce this.
My test image shows with stroke-width="0.5" half the width (second circle) as with stroke-width="1" (default) - first circle.
Although a stroke-width with percentage seems to be calculated wrong (3rd circle):
output

Testfiles:
__issue-338-01_stroke_width.zip

Output png IE:
__issue-338-01_stroke_width

@mrbean-bremen mrbean-bremen changed the title Stroke-Width is not applied when converting from svg to png Stroke-Width incorrectly applied if using percentage Dec 30, 2018
@mrbean-bremen
Copy link
Member

Thanks, @heindlalex - I updated the title accordingly.

mrbean-bremen pushed a commit that referenced this issue Dec 30, 2018
…viewbox width/height normalised diagonale for x/y elements e.g. circle

Test images and svg under #338
@mrbean-bremen mrbean-bremen changed the title Stroke-Width incorrectly applied if using percentage Stroke-Width incorrectly applied if between 0 and 1 or if using percentage Jan 6, 2019
@mrbean-bremen
Copy link
Member

Just noticed that the original issue is still there for paths. This can be seen in the test image __issue-323-01.svg after the crash is fixed (will do that in a moment).

@mrbean-bremen
Copy link
Member

Looks like the problem occurs if the physical line width is between 0 and 1 due to missing anti-aliasing.
I found a reference to a respective bug in GDI+ - so the only viable option seems to be to adapt the color (make it more transparent?). I tried this, and the result looks better, though not perfect, but I'm unsure if this is the way to go... Any ideas are welcome.

@H1Gdev

This comment has been minimized.

@mrbean-bremen
Copy link
Member

mrbean-bremen commented May 25, 2019

@H1Gdev - this is to be expected - anti-aliasing "smears" the lines a bit by design. The problem here is with lines with a width less than 1 pixel. This can be seen in the mentioned example image (Bolivian flag). This is the expected image:
grafik
And this is rendered by the SVG lib:
grafik
Note the black lines, which all have a width of less than a pixel. Anti-aliasing doesn't help here.

@Seb-Eck
Copy link

Seb-Eck commented Jan 15, 2021

This issue still persists on Ubuntu with libgdiplus. I use SVG.Net to render SVGs to PNG files. The images below display a path with stroke-width="0.2" as seen in Chrome, rasterized on Windows and rasterized on Ubuntu:

Chrome:

Windows:

Ubuntu:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants