Modify

Opened 5 years ago

Closed 5 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)

motorway_junction.svg (1.9 KB) - added by rickmastfan67 5 years ago.

Download all attachments as: .zip

Change History (11)

comment:1 Changed 5 years ago by Don-vip

Keywords: svg icon added
Milestone: 14.12

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'| sh

Still, manual optimization is better as we're sure of the result :)

comment:2 Changed 5 years ago by rickmastfan67

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 Changed 5 years ago by rickmastfan67

Keywords: svg icon added
Milestone: 14.12

Changed 5 years ago by rickmastfan67

Attachment: motorway_junction.svg added

comment:4 Changed 5 years ago by stoecker

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.

Last edited 5 years ago by stoecker (previous) (diff)

comment:5 in reply to:  1 Changed 5 years ago by rickmastfan67

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'| sh

Still, 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 Changed 5 years ago by Don-vip

Keywords: svg icon added
Milestone: 14.12

comment:7 in reply to:  4 Changed 5 years ago by rickmastfan67

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.

comment:8 Changed 5 years ago by 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?

I just updated my inkscape.

comment:9 Changed 5 years ago by Klumbumbus

replaced icon see [o30874]

comment:10 in reply to:  8 Changed 5 years ago by stoecker

Resolution: fixed
Status: newclosed

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.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.