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

svgo --precision #210

Closed
gurgeous opened this issue Oct 18, 2024 · 2 comments · Fixed by #211
Closed

svgo --precision #210

gurgeous opened this issue Oct 18, 2024 · 2 comments · Fixed by #211

Comments

@gurgeous
Copy link
Contributor

I love this gem, how am I just discovering it?!? Especially appreciate the separate pack gem. Great stuff. Thanks for all your hard work creating and maintaining.

When I compress SVGs I always use -p1, which has a tremendous impact on file size. SVG tools always export with tons of extra sigfigs, which svgo can easily remove. Using one of my recent SVG files:

original - 4.5k
after svgo - 3.3k
after svgo -p1 - 2.1k

I've used the precision flag for years on hundreds of SVGs, never noticed a visual difference. It's technically lossy, though.

Can we add support for this? Either --svgo-allow-lossy or --svgo-precision? Happy to try a PR if that would be helpful.

@toy
Copy link
Owner

toy commented Nov 10, 2024

Thank you

From what I understand visibility of reducing number of fractional digits will highly depend on svg, from no difference to significant, so it is definitely a lossy option. It can work as similar option for pngquant, jpegoptim or jpegrecompress - if allow_lossy is on, then precision can be specified. Glancing over svgo code, I'd go with default precision to be 3. PR will be very welcome

@gurgeous
Copy link
Contributor Author

See #211

@toy toy mentioned this issue Nov 17, 2024
@toy toy linked a pull request Nov 17, 2024 that will close this issue
@toy toy closed this as completed in #211 Nov 17, 2024
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

Successfully merging a pull request may close this issue.

2 participants