Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Benni013
Copy link
Contributor

First of all, thanks for this great project!

Description

This PR removes duplicate tags if there is no content in them. It also removes the xmlns attribute from the text tags because it's not needed AFAIK. In total, the SVG size is roughly halved.

File Comparison

This is the original (formatted) file
starcharts_fmt
and this is the optimized (formatted) file
starcharts_fix_fmt
Both are formatted to make them easier to compare (after saving), but nothing has been changed after the generation except for whitespace.
Also, ignore the 2021-10-12 vs 2021-10-13 date difference. That might be because I'm using slightly different go dependencies, or I can't generate both images at exactly the same time.

P.S.: The way Inkscape optimizes SVGs is also interesting, but this exceeds my basic knowledge of SVGs. See this file for comparison
starcharts_opt

Duplicate tags are no longer generated if tags have no content
@caarlos0 caarlos0 merged commit 31d8f93 into caarlos0:main Mar 14, 2025
@caarlos0
Copy link
Owner

nice, thank you!

@Benni013 Benni013 deleted the optimize-svg branch March 14, 2025 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants