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

msvg: flattens curved paths too coarsely in upscaled SVGs #7465

Closed
peteroupc opened this issue Jul 7, 2024 · 1 comment
Closed

msvg: flattens curved paths too coarsely in upscaled SVGs #7465

peteroupc opened this issue Jul 7, 2024 · 1 comment

Comments

@peteroupc
Copy link

ImageMagick version

7.1.1-33

Operating system

Linux

Operating system, version and so on

Fedora 40

Description

I have noticed that, when rasterizing SVGs to an upscaled raster image, msvg: appears to flatten curved paths in the SVG as though the SVG were displayed in its original resolution rather than in the upscaled resolution. This can be undesirable where the paths are flattened so coarsely that straight lines can be seen. Meanwhile, rsvg: renders curved paths more smoothly because the flattening takes place at the desired pixel size, not the original size, leading to a much more desirable behavior with such paths.

Thus, msvg: should behave like rsvg: in this respect.

Steps to Reproduce

curved1.svg:

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 8 8" xmlns:xlink="http://www.w3.org/1999/xlink">
  <ellipse style='stroke:none;fill:blue' cx='4' cy='4' rx='4' ry='4'/>
</svg>

curved2.svg:

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 8 8" xmlns:xlink="http://www.w3.org/1999/xlink">
  <path style='stroke:none;fill:blue' d="M1 4Q1 1 4 1Q7 1 7 4Q7 7 4 7Q1 7 1 4Z"/>
</svg>

In both SVGs, the "original" resolution is 8x8. Now run the following commands and compare the results:

magick -size 256x256 msvg:curved1.svg msvgcurved1.png
magick -size 256x256 rsvg:curved1.svg rsvgcurved1.png
magick -size 256x256 msvg:curved2.svg msvgcurved2.png
magick -size 256x256 rsvg:curved2.svg rsvgcurved2.png

Notice that rsvgcurved1.png and rsvgcurved2.png are much smoother compared to msvgcurved1.png and msvgcurved2.png.

Images

No response

@urban-warrior
Copy link
Member

Thank you for reporting the issue. We have successfully reproduced it and are actively working on a patch to resolve it. You can expect this patch to be merged into the main GIT branch, later today. As part of our commitment to quality, this fix will also be included in the upcoming beta releases of ImageMagick by tomorrow. Your patience and feedback are greatly appreciated.

urban-warrior pushed a commit to ImageMagick/ImageMagick6 that referenced this issue Jul 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants