-
-
Notifications
You must be signed in to change notification settings - Fork 91
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
Reduce map svg size #375
Reduce map svg size #375
Conversation
…aces and added room rendering with labels.
…ents. Fixed various typing hints. Code cleanups.
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## dev #375 +/- ##
==========================================
+ Coverage 79.66% 80.77% +1.11%
==========================================
Files 64 64
Lines 2582 2648 +66
Branches 468 487 +19
==========================================
+ Hits 2057 2139 +82
+ Misses 481 464 -17
- Partials 44 45 +1 ☔ View full report in Codecov by Sentry. |
Co-authored-by: Robert Resch <[email protected]>
Fixed some comments. Fixed a pylance error on svg_map to str conversion.
The map svg was reduced from 33kB to 19kB with the same level of details. @lukakama, can you test my changes and give me feedback on them? |
Reduced it even further to 17kB |
Nice! I will try to check it tomorrow :) . |
Also, please consider to use SVGZ (a standardized gzipped SVG) to achieve minimum size. It could be also handled in the Image Entity of the HA integration, if you want to keep the library generated SVG in clear text. |
I will ask after Christmas if the frontend applies automatically gzip for now I would leave it in cleartext |
I just made a quick test removing the "_as_str" method overridden int the custom Path class, and trace paths are rendered correctly (disconnected point are kept disconnected), so the issue should be in that code. Maybe the comparison between current and previous path command which filter out instruction that should not be filtered. Maybe it is enough to spot the issue. If not, I will be able to perform further analysis after Christmas. And... Merry Christmas :D ! |
Thanks and also Merry Christmas :) Thanks for the feedback:) |
Co-authored-by: mvladislav <[email protected]>
579a6c9
to
c5dd249
Compare
The following optimizations are done in this PR:
svg.PathData
and extendingPath
classRGBA
toP
(Pallette) image (old png map image would be 7kB instead of 14kB)x
ory
of a point is zero, useh
/v
to avoid an unnecessary zeroImage.frombytes
instead of looping over each pixel