Opened 9 years ago
Closed 9 years ago
#10877 closed defect (fixed)
motorway_junction.svg optimization
Reported by: | rickmastfan67 | Owned by: | team |
---|---|---|---|
Priority: | trivial | Milestone: | 14.12 |
Component: | Core | Version: | latest |
Keywords: | svg icon | Cc: | Klumbumbus |
Description
I just noticed you were playing around with the new SVG for this icon in [o30870] to add back the white background (something that I personally agree with) that the PNG version had. Anyways, I noticed that you made the icon in Inkscape and was wondering why it wasn't saved as a 'plain SVG' for the JOSM dist. If it had been saved as a 'plain SVG' instead of an 'Inkscape SVG', you could have saved over 1KB in size. (3.18kb -> 2.07kb) I know, that doesn't seem like a lot, but, if other SVGs in JOSM were saved as 'Inkscape SVGs' instead of 'plain SVGs' (this is the only one I checked), the extra size could add up.
I've attached a 'Plain SVG' of the icon to this post. I've also did a little bit of cleanup beyond the conversion to 'Plain SVG', like fixing the 'y="-9.9920072e-016"' line to 'y="0"' for the rectangle which frees up a few more bites. Also fixed the location on the motorway icon where it was using the 'transform' to move it a minor 0.25 (transform="translate(-0.25,-0.25)") to also gain back a few more bites. With these extra minor tweaks, I have brought down the file size to 2.00kb, a savings of 1.18kb, or 37.1% over the current file.
I hope this minor work is appreciated as I always try to optimize the SVG files I make for my other personal projects in Inkscape.
-
(On a side note Klumbumbus, I don't know what platform you use, but I notice you're using Inkscape 0.48.4 per the file info. Inkscape 0.48.5 is now out and has been for several months. Also, 0.91 is coming out soon too. Just thought I would mention this in case you didn't know this yet.)
Attachments (1)
Change History (11)
follow-up: 5 comment:1 by , 9 years ago
Keywords: | svg icon added |
---|---|
Milestone: | → 14.12 |
comment:2 by , 9 years ago
Keywords: | svg icon removed |
---|---|
Milestone: | 14.12 |
Just noticed there were a few unnecessary handles on straight segments between nodes on the top and bottom of the motorway icon. Was able to cut the file even farther down to 1.94kb. Updating the attachment with the even smaller version.
comment:3 by , 9 years ago
Keywords: | svg icon added |
---|---|
Milestone: | → 14.12 |
by , 9 years ago
Attachment: | motorway_junction.svg added |
---|
follow-up: 7 comment:4 by , 9 years ago
Keywords: | svg icon removed |
---|---|
Milestone: | 14.12 |
The final size of current file is 782 byte in JOSM :-)
Your last variant would go down to 655 byte when cleaned.
comment:5 by , 9 years ago
Replying to Don-vip:
Thanks, all feedback is appreciated, even the minor one :)
FYI however we do have an SVG optimization when the JOSM jar is built. All SVG files are processed as follows before being included in the jar file:
find ${TARGET} -iname "*.svg" -printf 'svgcleaner-cli "%p" "%p"\n'| shStill, manual optimization is better as we're sure of the result :)
That I didn't know. Still, I don't think it would have caught the handles part which I just fixed manually. :)
comment:6 by , 9 years ago
Keywords: | svg icon added |
---|---|
Milestone: | → 14.12 |
comment:7 by , 9 years ago
Replying to stoecker:
The final size of current file is 782 byte in JOSM :-)
Your last variant would go down to 655 byte when cleaned.
Heh, a savings of 127 bytes when super-optimized. Still, that's a savings of about 16% over the previous one inside the JAR file. I think the manual cleanup was worth it. :)
There might be others out there that could use the manual cleanup. I might take a look later at the JAR to see which ones didn't compress that well and see if there are any minor manual optimizations that might be worthwhile to do.
follow-up: 10 comment:8 by , 9 years ago
Yes, I didn't care much about the size because of the auto cleanup. As I do not have much experience with manually editing raw svg code, I think I will not do this in the near future. For future svg I can save them as plain svg and/or use the svg cleaner before I upload. Is it worth it despite the auto clean up?
I just updated my inkscape.
comment:10 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Replying to Klumbumbus:
Yes, I didn't care much about the size because of the auto cleanup. As I do not have much experience with manually editing raw svg code, I think I will not do this in the near future. For future svg I can save them as plain svg and/or use the svg cleaner before I upload. Is it worth it despite the auto clean up?
Don't use the auto-cleaner before uploading to SVN! The result is really small, but the structure is horrible. :-)
Structural optimizations like removing useless points, ... are fine. Removing inkscape tags or something alike is useless, as the auto-cleaner will catch these.
Thanks, all feedback is appreciated, even the minor one :)
FYI however we do have an SVG optimization when the JOSM jar is built. All SVG files are processed as follows before being included in the jar file:
Still, manual optimization is better as we're sure of the result :)