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

precission of convertTransform too low. #1021

Open
JoKalliauer opened this issue Aug 30, 2018 · 5 comments
Open

precission of convertTransform too low. #1021

JoKalliauer opened this issue Aug 30, 2018 · 5 comments

Comments

@JoKalliauer
Copy link

It seems that the background precission is too low, and the precission set is just the rounding afterwards.

In svgcleaner I need a precission of '--transforms-precision 7' or higher, but in SVGO I can increase the precission, but nothing changes (I tried everything in the range of -p 2 up to -p 10, without any visual changes).

##Original file
Bug1SVGOinput.svg.txt
bug1svgoinput

##Optimizced file
Bug1SVGOoutput.svg.txt
bug1svgooutput


Copyright

License: {{self|cc-by-sa-3.0|GFDL}}

Author: https://commons.wikimedia.org/wiki/User:Addicted04

Source: https://upload.wikimedia.org/wikipedia/commons/5/50/Philippines_%28orthographic_projection%29.svg

Details: https://commons.wikimedia.org/wiki/File:Philippines_(orthographic_projection).svg

@GreLI
Copy link
Member

GreLI commented Sep 15, 2018

Well, it's a balance between file size and image precision. It's ok for usual icons and web images, but one should use more precision for high-detailed images like this. If I change it for better precision, many image files size would be bigger without real need for it.

In SVGO in convertPrecision plugin it has default precision floatPrecision + 2 (i.e. -p option plus two), but there is another plugin convertPathData that also has transformPrecision option.

@JoKalliauer
Copy link
Author

JoKalliauer commented Sep 16, 2018

@GreLI Thanks for answering:
I further optimiced the input with SVGO, with convertPathData (and other options except convertTransform), but it didn't help.

Input

Bug1021_Input2.svg.txt

$ svgo -i Bug1021_Input2.svg.txt -o Bug1021_Input2.svg.txt --pretty --indent=1 --disable=convertTransform --enable=convertPathData

  • Bug1021_Input2.svg.txt:
  • Done in 2423 ms!
  • 611.409 KiB - 0% = 611.409 KiB

bug1021_input2

Optimization -p 8 fails

Now I run convertTransform with -p 8: Bug1021_Output2.svg.txt

$ svgo -i Bug1021_Input2.svg.txt -o Bug1021_Output2.svg.txt -p 8 --pretty --indent=1 --enable=convertTransform --disable=convertPathData

bug1021_output2

optimizations with -p 2 works (after other opimizaion):

But if you can run svgo with -p 2 --enable=convertTransform after other optimization:

$ svgo -i Philippines (orthographic projection).svg -o
Bug1021_SolvedOutput.svg.txt
--pretty --indent=1 -p 2 --enable=convertTransform
min.svg:
Done in 1815 ms!
401.268 KiB - 0% = 401.131 KiB

And the Output is perfect:
bug1021_solvedoutput

Therefore I would like to have doublefloatpreccision-calculation, and rounding aferwards, this might solve this issue, with increasing precission, without increasing file size. (But maybe increasing processingtime.)


Copyright

License: {{self|cc-by-sa-3.0|GFDL}}

Author: https://commons.wikimedia.org/wiki/User:Addicted04

Source: https://upload.wikimedia.org/wikipedia/commons/5/50/Philippines_%28orthographic_projection%29.svg

Details: https://commons.wikimedia.org/wiki/File:Philippines_(orthographic_projection).svg

@KTibow
Copy link
Contributor

KTibow commented Dec 2, 2023

convertTransform isn't a real plugin - you need to configure it in the convertPathData settings.

@JoKalliauer
Copy link
Author

convertTransform isn't a real plugin - you need to configure it in the convertPathData settings.

Not sure what that means, what can I change?


Steps to reproduce:

input output
Bug1021_Input2024-01-04 Bug1021_Output
1234567890123456789012345678901234567890123456 1234567890123456789012345678901234567890123456

and also replicated locally with svgo 3.2.0 with svgo.config.js.txt

@KTibow
Copy link
Contributor

KTibow commented Jan 3, 2024

First problem: your config is still using an old format, from what I understand active was removed in SVGO v3.
Second thing: as of #1916, convertTransform is now a separate plugin which you can easily disable.

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

No branches or pull requests

3 participants