You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But the second one is 100 byte smaller because it uses fewer digits. the viewbox-relative coordinates however are the same.
so the idea is so find if all or most of the coordinate inside a document have common factor. In this scenario the number 25 appears very often. we scale all these numbers down so that they can be expressed with a single digit. also we scale up the viewbox so everything will appear the same.
This only creates smaller results if the graphic was created using a grid. This is true for graphics like flags. See for instance the Flag of Italy: which can be expressed in a 3 by 2 viewbox.
The text was updated successfully, but these errors were encountered:
However, it's difficult to implement in real life. What if there is some point that doesn't fit the pattern. Several points? Notable count of points? How would you count this? (I mean float numbers, that requires rounding.)
I don't see an effective algorithm other than scaling the whole image with trials and errors, which is not that effective in matter of execution time. If you know such, please, let us know.
There even an article describing such an algorithm using SVGO. However, in real life with non-integer coordinates it depends on judging is image “breaks”, which cannot be automatized due to subjective nature.
here is just a quick Idea. I have no idea what an algorithm would look like that actually do that.
The following two svgs are visually identical:
But the second one is 100 byte smaller because it uses fewer digits. the viewbox-relative coordinates however are the same.
so the idea is so find if all or most of the coordinate inside a document have common factor. In this scenario the number 25 appears very often. we scale all these numbers down so that they can be expressed with a single digit. also we scale up the viewbox so everything will appear the same.
This only creates smaller results if the graphic was created using a grid. This is true for graphics like flags. See for instance the Flag of Italy:
which can be expressed in a 3 by 2 viewbox.
The text was updated successfully, but these errors were encountered: