-
Notifications
You must be signed in to change notification settings - Fork 231
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
Impreciseness when rewriting an SVG file with usvg
.
#877
Comments
Seems like your coordinates/transform precision is too low. I tried with 3 and 4 like you do and get the same, if I up both to 8 (like in the usvg CLI) it looks fine. I guess your SVG has some weird transforms or coordinates that are really small where each decimal place matters. |
Mh ... Is this expected ? From the doc it is (smaller precision => malformed output possible) So the precision is set on the coordinates and transforms separately but it's not "normalized" (meaning you can't have a "I want a precision to the i-th decimal on the final coordinate" option). I feel like the SVG being weird is probably the answer there, though I'm kinda surprised the transform/coordinates could be so unbalanced numerically. If you think it's worth having something in usvg to re balance things like that (or have a precision on the end coordinate), maybe I can turn this issue into a feature request. Otherwise, we can close this |
Yeah, I'm not entirely sure either, perhaps there is something we can do about it. We would have to investigate the root cause. But in any case, at least there is an easy way to work around it. :) Thought I should mention that the But we can leave the issue open for now. |
usvg::Tree::from_str
usvg
.
There is a difference between the svg before and after the simplification (some paths are longer, some elements are slightly larger).
It's probably not the most beautiful svg out there, but I'm not sure where the problem is (
clip-path="url(#clip-0)"
attributes ?ClipPath
element ? The very numeroususe
elements ?)Comparison in firefox (left is original, right is after usvg)
Options used for the call are here :
https://github.com/flxzt/rnote/blob/2ef66c5000c8ab4577ee2c2a73d2c6b5c3316d06/crates/rnote-engine/src/strokes/vectorimage.rs#L148-L164
After:
Before:
The text was updated successfully, but these errors were encountered: